diff --git a/src/router/storeSync/TimeSliderParamConfig.class.js b/src/router/storeSync/TimeSliderParamConfig.class.js index 93742cb1e..c5024f250 100644 --- a/src/router/storeSync/TimeSliderParamConfig.class.js +++ b/src/router/storeSync/TimeSliderParamConfig.class.js @@ -48,9 +48,11 @@ function validateUrlInput(store, query) { ) if (store.getters.visibleLayers.filter((layer) => layer.hasMultipleTimestamps).length === 0) { - validationObject['warnings'] = new WarningMessage( - 'time_slider_no_time_layer_active_url_warning', - {} + if (!validationObject.warnings) { + validationObject.warnings = [] + } + validationObject.warnings.push( + new WarningMessage('time_slider_no_time_layer_active_url_warning', {}) ) } return validationObject diff --git a/src/router/storeSync/__tests__/layersParamParser.spec.js b/src/router/storeSync/__tests__/layersParamParser.spec.js index f7c9e8cf8..cf5c09b3f 100644 --- a/src/router/storeSync/__tests__/layersParamParser.spec.js +++ b/src/router/storeSync/__tests__/layersParamParser.spec.js @@ -127,6 +127,22 @@ describe('Testing layersParamParser', () => { ) }) }) + it('parses correctly a pre-selected feature on a layer', () => { + const layerId = 'fake-layer-id' + const featureId = '1234.050' // some of our IDs end with 0, we have to make sure they are treated as string and not numbers + const result = parseLayersParam(`${layerId}@features=${featureId}`) + checkParsedLayer(result[0], layerId, true, undefined, { + features: featureId, + }) + }) + it('parses correctly multiple pre-selected features on a single layer', () => { + const layerId = 'fake-layer-id' + const featureIds = ['1234.560', 'iAmSomeId'] + const result = parseLayersParam(`${layerId}@features=${featureIds.join(':')}`) + checkParsedLayer(result[0], layerId, true, undefined, { + features: featureIds.join(':'), + }) + }) describe('Visibility/Opacity parsing', () => { it('Parses correctly the visible when specified', () => { diff --git a/src/router/storeSync/layersParamParser.js b/src/router/storeSync/layersParamParser.js index fb4fbcf35..6771a5050 100644 --- a/src/router/storeSync/layersParamParser.js +++ b/src/router/storeSync/layersParamParser.js @@ -115,6 +115,10 @@ export function parseLayersParam(queryValue) { let parsedValue if (value === 'true' || value === 'false') { parsedValue = 'true' === value + } else if (key === 'features') { + // some IDs are "numbers", such as 1314.070, but we NEED the trailing zero + // (they shouldn't be parsed as numbers) + parsedValue = value } else if (isNumber(value)) { parsedValue = Number(value) } else if (key === 'year' && value.toLowerCase() === 'none') {