changeset 1222:a8b682f3d13d

staging area: zoom to location
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 19 Nov 2018 16:23:14 +0100
parents c193649d4f11
children a20fcfacda98
files client/src/staging/Staging.vue
diffstat 1 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/staging/Staging.vue	Mon Nov 19 16:15:30 2018 +0100
+++ b/client/src/staging/Staging.vue	Mon Nov 19 16:23:14 2018 +0100
@@ -26,9 +26,14 @@
                     <tbody>
                         <tr v-for="data in filteredData" :key="data.id">
                             <td>{{data.name}}</td>
-                            <td>{{data.location}}</td>
+                            <td>
+                                <a
+                                    @click="zoomTo(data.location)"
+                                    href="#"
+                                >{{data.location[0]}}, {{data.location[1]}}</a>
+                            </td>
+                            <td>{{data.type}}</td>
                             <td>{{data.date}}</td>
-                            <td>{{data.type}}</td>
                             <td>{{data.importID}}</td>
                             <td>
                                 <input
@@ -52,7 +57,7 @@
     id: 1,
     name: "B1",
     date: "2018-11-19",
-    location: "bla",
+    location: [16.5364, 48.1471],
     status: "Not approved",
     importID: "123456789",
     type: "bottleneck"
@@ -61,7 +66,7 @@
     id: 2,
     name: "B2",
     date: "2018-11-19",
-    location: "bla",
+    location: [16.5364, 48.1472],
     status: "Not approved",
     importID: "123456789",
     type: "bottleneck"
@@ -70,7 +75,7 @@
     id: 3,
     name: "s1",
     date: "2018-11-13",
-    location: "bla",
+    location: [16.5364, 48.1473],
     status: "Not approved",
     importID: "987654321",
     type: "soundingresult"
@@ -79,7 +84,7 @@
     id: 4,
     name: "s2",
     date: "2018-11-13",
-    location: "bla",
+    location: [16.5364, 48.1474],
     status: "Not approved",
     importID: "987654321",
     type: "soundingresult"
@@ -87,6 +92,15 @@
 ];
 
 export default {
+  methods: {
+    zoomTo(coordinates) {
+      this.$store.commit("map/moveMap", {
+        coordinates: coordinates,
+        zoom: 17,
+        preventZoomOut: true
+      });
+    }
+  },
   computed: {
     ...mapState("application", ["showStagingArea"]),
     filteredData() {