From ff54588b1f70f2f57cf9f1ee57f4684fc81ad204 Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Wed, 11 Dec 2024 14:14:51 +0100 Subject: [PATCH] Do not show time series window when location not in filterIds locations --- .../spatialdisplay/SpatialDisplay.vue | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/spatialdisplay/SpatialDisplay.vue b/src/components/spatialdisplay/SpatialDisplay.vue index 8d21a7eff..c9aa3d8fd 100644 --- a/src/components/spatialdisplay/SpatialDisplay.vue +++ b/src/components/spatialdisplay/SpatialDisplay.vue @@ -33,7 +33,7 @@ import { computed, ref, watch } from 'vue' import SpatialDisplayComponent from '@/components/spatialdisplay/SpatialDisplayComponent.vue' import { useDisplay } from 'vuetify' import { configManager } from '@/services/application-config' -import { onBeforeRouteUpdate, type RouteLocationNormalized, useRoute, useRouter } from 'vue-router' +import { useRoute, useRouter } from 'vue-router' import { findParentRoute } from '@/router' import { onMounted } from 'vue' import { @@ -255,11 +255,23 @@ function closeTimeSeriesDisplay(): void { } watch( - () => props.layerName, + () => locations.value, () => { if (currentLocationId.value && !props.locationId) { - openLocationTimeSeriesDisplay(currentLocationId.value) + if ( + locations.value?.find((l) => l.locationId === currentLocationId.value) + ) { + openLocationTimeSeriesDisplay(currentLocationId.value) + } else { + currentLocationId.value = undefined + } } + }, +) + +watch( + () => props.layerName, + () => { if ( currentLatitude.value && currentLongitude.value && @@ -273,12 +285,6 @@ watch( } }, ) - -onBeforeRouteUpdate(reroute) - -function reroute(to: RouteLocationNormalized) { - console.log('Spatial Display', to) -}