From 7fd7f2f61e984623e90bf8be97e1532ace470d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katharina=20W=C3=BCnsche?= Date: Tue, 17 Sep 2024 17:10:05 +0200 Subject: [PATCH 1/6] feat: display number of nodes and edges --- components/networkVisualization.vue | 23 +++++++++++++++++++---- messages/de.json | 4 +++- messages/en.json | 4 +++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/components/networkVisualization.vue b/components/networkVisualization.vue index f5f22cf..936cdbe 100644 --- a/components/networkVisualization.vue +++ b/components/networkVisualization.vue @@ -2,7 +2,7 @@ import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headlessui/vue"; import { useQuery } from "@tanstack/vue-query"; import type { LinkObject } from "force-graph"; -import { Check, ChevronDown, MoveHorizontal, Share2 } from "lucide-vue-next"; +import { Check, ChevronUp, MoveHorizontal, Share2 } from "lucide-vue-next"; import { bgColors, colorCodes } from "@/lib/colors"; import { loadNetworkData } from "@/lib/load-network-data"; @@ -69,7 +69,6 @@ function getGraph(data: Array, minDegree = 0) { flattenedEdges.forEach((edge) => { graph.links.push({ source: edge.split("-")[0], target: edge.split("-")[1] }); }); - console.log(graph.nodes.length); return graph; } const minDegree = ref(1); @@ -137,7 +136,7 @@ const nodeDistance = ref(10); {{ t(`Pages.searchviews.${className.replace("apis_ontology.", "")}.label`) }} - @@ -149,7 +148,7 @@ const nodeDistance = ref(10); -
+
+
+
+ + {{ t("Pages.network.nodes") }} + + {{ graph.nodes.length }} +
+
+ + {{ t("Pages.network.links") }} + + {{ graph.links.length }} +
+
diff --git a/messages/de.json b/messages/de.json index 505342d..0939056 100644 --- a/messages/de.json +++ b/messages/de.json @@ -166,7 +166,9 @@ "network": { "title": "Netzwerk", "hide-nodes": "Knoten mit wenigen Verbindungen verbergen", - "node-distance": "Distanz zwischen Knoten ändern" + "node-distance": "Distanz zwischen Knoten ändern", + "nodes": "Knoten", + "links": "Kanten" } }, "References": { diff --git a/messages/en.json b/messages/en.json index 67dab3d..d27c0b5 100644 --- a/messages/en.json +++ b/messages/en.json @@ -166,7 +166,9 @@ "network": { "title": "Network", "hide-nodes": "Hide nodes with few links", - "node-distance": "Set distance between nodes" + "node-distance": "Set distance between nodes", + "nodes": "Nodes", + "links": "Links" } }, "References": { From 56358b9f7a6941ff22cb6bea5c48b0a2e525ed3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katharina=20W=C3=BCnsche?= Date: Wed, 18 Sep 2024 11:26:41 +0200 Subject: [PATCH 2/6] fix: scroll to top after navigating to next/prev page (#8) --- components/search-page.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/search-page.vue b/components/search-page.vue index d9123bd..96a281c 100644 --- a/components/search-page.vue +++ b/components/search-page.vue @@ -173,6 +173,13 @@ const initFacetSelection = () => { .flat()), ); }; + +watch( + () => route.query, + () => { + document.body.scrollTo(0, 0); + }, +);