Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9154 Fixed map crash when expanding timeline with time intervals #9155

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions web/client/epics/__tests__/timeline-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,67 @@ describe('timeline Epics', () => {
});
});
});
it("setRangeOnInit when the values stored are intervals", (done) => {
testEpic(setRangeOnInit, 3, initializeRange(), ([action1, action2, action3]) => {
try {
const { time, type } = action1;
const { offsetTime, type: typeOff} = action2;
const { type: typeRange, start, end } = action3;
expect(time).toBeTruthy();
expect(offsetTime).toBeTruthy();
expect(type).toBe(SET_CURRENT_TIME);
expect(typeOff).toBe(SET_OFFSET_TIME);
expect(typeRange).toBe(RANGE_CHANGED);
expect(start).toBe("2001-01-01T00:00:00.000Z");
expect(end).toBe("2001-12-31T00:00:00.000Z");
done();
} catch (e) {
done(e);
}
}, {
timeline: {
selectedLayer: "TEST_LAYER",
settings: {
initialMode: 'range',
initialSnap: 'fullRange'
}
},
dimension: {
currentTime: "2000-01-01T00:00:00.000Z",
offsetTime: "2001-12-31T00:00:00.000Z",
data: {
time: {
TEST_LAYER: {
name: "time",
domain: "2001-01-01T00:00:00.000Z/2001-12-31T00:00:00.000Z"
}
}
}
},
layers: {
flat: [{
id: 'TEST_LAYER',
name: 'TEST_LAYER',
type: 'wms',
visibility: true,
url: 'base/web/client/test-resources/wmts/DomainIntervalValues.xml',
dimensions: [
{
source: {
type: 'multidim-extension',
url: 'base/web/client/test-resources/wmts/DomainIntervalValues.xml'
},
name: 'time'
}
],
params: {
time: '2000-06-08T00:00:00.000Z'
}
}]
}
});
});

it("updateTimelineDataOnMapLoad", (done) =>{
const config = {
timelineData: {
Expand Down
3 changes: 2 additions & 1 deletion web/client/epics/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ const updateRangeOnInit = (state, value, currentTime) => {
} else {
values = value;
}

// if values are intervals (separated by /) spread them in the array
values = values.reduce((acc, v) => acc.concat(v.split('/')), []);
if (values.length > 2) {
values = [values[0], values[values.length - 1]]; // more than 2 values, start and end are the first and last values
}
Expand Down