From 63a5c767e27b9595a680969d38b4726efd0b2218 Mon Sep 17 00:00:00 2001 From: Cyrus Hiatt Date: Mon, 25 Nov 2024 17:06:05 -0800 Subject: [PATCH 1/5] Track feature selection on click --- afrc/src/afrc/Search/SearchPage.vue | 3 +++ .../components/InteractiveMap/InteractiveMap.vue | 11 +++++++++++ .../InteractiveMap/components/MapComponent.vue | 11 ++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/afrc/src/afrc/Search/SearchPage.vue b/afrc/src/afrc/Search/SearchPage.vue index e0b02f5..a6b19b3 100644 --- a/afrc/src/afrc/Search/SearchPage.vue +++ b/afrc/src/afrc/Search/SearchPage.vue @@ -30,6 +30,7 @@ const showMap = ref(false); const basemaps: Ref = ref([]); const overlays: Ref = ref([]); const sources: Ref = ref([]); +const resultsSelected: Ref = ref([]); const dataLoaded = ref(false); const toast = useToast(); const { $gettext } = useGettext(); @@ -97,6 +98,7 @@ const doQuery = function () { console.log(data); searchResults.value = data.results.hits.hits; resultsCount.value = data.total_results; + resultsSelected.value = []; }); // self.updateRequest = $.ajax({ @@ -223,6 +225,7 @@ onMounted(async () =>{ style="width: 100%; height: 100%" > props.basemaps, (updatedBasemaps) => { @@ -84,6 +86,14 @@ watch( { deep: true, immediate: true }, ); +watch( + () => resultsSelected, + (x) => { + console.log("resultsSelected", x); + }, + { deep: true, immediate: true }, +); + onMounted(async () => { await fetchSystemSettings(); }); @@ -113,6 +123,7 @@ function updateSelectedDrawnFeature(feature: Feature) { style="display: flex; height: 100%; width: 100%" > feature.properties?.resourceinstanceid as string)); + resultsSelected.value = Array.from(uniqueResourceIds); + } else { + resultsSelected.value = []; } }; From 705d5b6e767a54544c766dbd5b39308e5a41e2d7 Mon Sep 17 00:00:00 2001 From: Cyrus Hiatt Date: Tue, 26 Nov 2024 09:54:16 -0800 Subject: [PATCH 2/5] Replace v-model with provide/inject --- afrc/src/afrc/Search/SearchPage.vue | 5 +++-- .../components/InteractiveMap/InteractiveMap.vue | 10 ---------- .../InteractiveMap/components/MapComponent.vue | 4 ++-- afrc/src/afrc/Search/components/SearchResultItem.vue | 3 +++ 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/afrc/src/afrc/Search/SearchPage.vue b/afrc/src/afrc/Search/SearchPage.vue index a6b19b3..a754c2d 100644 --- a/afrc/src/afrc/Search/SearchPage.vue +++ b/afrc/src/afrc/Search/SearchPage.vue @@ -1,5 +1,5 @@