changeset 5132:8d5e3ce27d20

client: Time based search * Add Time parameter to the search request when Time slider is active
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 27 Mar 2020 15:30:15 +0100
parents a6e5bb85f0a7
children 53618d18e387
files client/src/components/Search.vue
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Search.vue	Fri Mar 27 12:37:26 2020 +0100
+++ b/client/src/components/Search.vue	Fri Mar 27 15:30:15 2020 +0100
@@ -188,7 +188,9 @@
     ...mapState("application", [
       "showSearchbar",
       "showContextBox",
-      "contextBoxContent"
+      "contextBoxContent",
+      "showTimeSlider",
+      "currentVisibleTime"
     ]),
     ...mapState("imports", ["startDate", "endDate"]),
     ...mapGetters("imports", ["filters"]),
@@ -242,6 +244,9 @@
     searchQuery: function() {
       this.searchQueryIsDirty = true;
       if (!this.showContextBox) this.triggerSearch();
+    },
+    currentVisibleTime() {
+      this.doSearch();
     }
   },
   methods: {
@@ -286,7 +291,12 @@
 
       HTTP.post(
         "/search",
-        { string: this.searchQuery },
+        this.showTimeSlider
+          ? {
+              string: this.searchQuery,
+              time: this.currentVisibleTime.toISOString()
+            }
+          : { string: this.searchQuery },
         {
           headers: {
             "X-Gemma-Auth": localStorage.getItem("token"),