From 1ec0abd9be2967b51a64f25a660d88ac7ee368a2 Mon Sep 17 00:00:00 2001 From: oliviareichl Date: Thu, 27 Jun 2024 11:54:20 +0200 Subject: [PATCH 1/4] feat: popup of entity on network when detailview is enabled --- components/data-graph.vue | 9 ++++++- components/data-map-view.vue | 27 +++++++++++++++++++- components/data-network-view.vue | 10 +++++++- components/network.client.vue | 44 ++++++++++++++++++++++++++++++++ layouts/visualization.vue | 2 +- 5 files changed, 88 insertions(+), 4 deletions(-) diff --git a/components/data-graph.vue b/components/data-graph.vue index b07a35b3..964d42fd 100644 --- a/components/data-graph.vue +++ b/components/data-graph.vue @@ -4,10 +4,12 @@ import Graph from "graphology"; import type { NetworkEntity } from "@/types/api"; import { colors } from "../project.config.json"; +import { number } from "zod"; const props = defineProps<{ networkData: NetworkEntity; searchNode: string; + detailNode?: string; }>(); const graph = new Graph(); @@ -62,5 +64,10 @@ function getNodeColor(nodeClass: string) { diff --git a/components/data-map-view.vue b/components/data-map-view.vue index 2cab6c7e..f2c1e619 100644 --- a/components/data-map-view.vue +++ b/components/data-map-view.vue @@ -16,12 +16,17 @@ const route = useRoute(); const t = useTranslations(); const currentView = useGetCurrentView(); +const { getUnprefixedId } = useIdPrefix(); const searchFiltersSchema = v.object({ category: v.fallback(v.picklist(categories), "entityName"), search: v.fallback(v.string(), ""), }); +const detailEntityId = computed(() => { + return route.params.id as string; +}); + const searchFilters = computed(() => { return v.parse(searchFiltersSchema, route.query); }); @@ -48,7 +53,7 @@ const { data, isPending, isPlaceholderData } = useGetSearchResults( : [], show: ["geometry", "when"], centroid: true, - system_classes: ["place", "object_location"], + system_classes: ["place"], limit: 0, }; }), @@ -141,6 +146,26 @@ watch(data, () => { */ popover.value = null; }); + +watch( + detailEntityId, + (detailEntityId) => { + const entity = entities.value.find((feature) => { + const id = getUnprefixedId(feature["@id"]); + return id === detailEntityId; + }); + }, + { immediate: true }, +); + +onMounted(() => { + if (detailEntityId) { + const entity = features.value.find((feature) => { + const id = feature.id as string; + return id === detailEntityId.value; + }); + } +});