changeset 3753:78ba9b2574ff

search: include id in search result to mark sections/stretches as selected
author Markus Kottlaender <markus@intevation.de>
date Tue, 25 Jun 2019 10:27:09 +0200
parents bdc7ff183db0
children c493e3be54ba 5bdee22f3ce0
files client/src/components/Search.vue schema/search_functions.sql
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Search.vue	Tue Jun 25 10:25:38 2019 +0200
+++ b/client/src/components/Search.vue	Tue Jun 25 10:27:09 2019 +0200
@@ -317,11 +317,19 @@
           .setVisible(true);
       }
       if (resultEntry.type === "stretch") {
+        this.$store.commit(
+          "imports/selectedStretchId",
+          "stretches_geoserver." + resultEntry.id
+        );
         this.openLayersMap()
           .getLayer("STRETCHES")
           .setVisible(true);
       }
       if (resultEntry.type === "section") {
+        this.$store.commit(
+          "imports/selectedSectionId",
+          "sections_geoserver." + resultEntry.id
+        );
         this.openLayersMap()
           .getLayer("SECTIONS")
           .setVisible(true);
--- a/schema/search_functions.sql	Tue Jun 25 10:25:38 2019 +0200
+++ b/schema/search_functions.sql	Tue Jun 25 10:27:09 2019 +0200
@@ -119,7 +119,8 @@
 BEGIN
   SELECT COALESCE(json_agg(r),'[]')
     INTO _result
-    FROM (SELECT objnam AS name,
+    FROM (SELECT id,
+                 objnam AS name,
                  ST_AsGeoJSON(ST_Envelope(area::geometry))::json AS geom,
                  'section' AS type
             FROM waterway.sections
@@ -138,7 +139,8 @@
 BEGIN
   SELECT COALESCE(json_agg(r),'[]')
     INTO _result
-    FROM (SELECT objnam AS name,
+    FROM (SELECT id,
+                 objnam AS name,
                  ST_AsGeoJSON(ST_Envelope(area::geometry))::json AS geom,
                  'stretch' AS type
             FROM waterway.stretches