From 4e2830b6986aef2486d12c20ffc37d4bb595ced4 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Fri, 8 Jul 2022 14:50:21 +1000 Subject: Send activeRoot to server, for reducing toroot response sizes --- src/App.vue | 7 ++++--- src/components/SearchModal.vue | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/App.vue b/src/App.vue index 434eb08..e379a1d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -49,7 +49,8 @@ - @@ -542,7 +543,7 @@ export default defineComponent({ layoutNode.addDescendantChain(nodesToAdd, this.tolMap, this.layoutMap); // Expand-to-view on target-node's parent targetNode = this.layoutMap.get(name); - if (targetNode.parent != this.activeRoot){ + if (targetNode!.parent != this.activeRoot){ await this.onLeafClickHeld(targetNode!.parent!, true); } else { await this.onLeafClick(targetNode!.parent!, true); @@ -864,7 +865,7 @@ export default defineComponent({ let urlParams = new URLSearchParams({type: 'node', tree: this.uiOpts.tree}); if (nodeName != null){ urlParams.append('name', nodeName); - urlParams.append('toroot', 'true'); + urlParams.append('toroot', this.activeRoot.name); } let responseObj: {[x: string]: TolNode} = await this.loadFromServer(urlParams); if (responseObj == null){ diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue index de6bc75..990312a 100644 --- a/src/components/SearchModal.vue +++ b/src/components/SearchModal.vue @@ -43,6 +43,7 @@ import {queryServer, SearchSugg, SearchSuggResponse, UiOptions} from '../lib'; export default defineComponent({ props: { lytMap: {type: Object as PropType, required: true}, // Used to check if a searched-for node exists + activeRoot: {type: Object as PropType, required: true}, // Sent to server to reduce response size tolMap: {type: Object as PropType, required: true}, // Upon a search response, gets new nodes added lytOpts: {type: Object as PropType, required: true}, uiOpts: {type: Object as PropType, required: true}, @@ -205,7 +206,7 @@ export default defineComponent({ let urlParams = new URLSearchParams({ type: 'node', name: tolNodeName, - toroot: 'true', + toroot: this.activeRoot.name, tree: this.uiOpts.tree, }); this.$emit('net-wait'); // Allows the parent component to show a loading-indicator -- cgit v1.2.3