changeset 2365:242c170e00ce

client:use the name constants instead of strings
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 21 Feb 2019 09:31:02 +0100
parents 341010faf34c
children ff1e4f1b54c6
files client/src/components/fairway/Profiles.vue client/src/store/bottlenecks.js client/src/store/fairway.js
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/Profiles.vue	Wed Feb 20 16:10:54 2019 +0100
+++ b/client/src/components/fairway/Profiles.vue	Thu Feb 21 09:31:02 2019 +0100
@@ -251,6 +251,7 @@
 import LineString from "ol/geom/LineString";
 import { displayError, displayInfo } from "@/lib/errors.js";
 import { formatSurveyDate } from "@/lib/date.js";
+import { LAYERS } from "@/store/map.js";
 
 export default {
   name: "profiles",
@@ -311,7 +312,7 @@
         if (!cut) {
           this.$store.commit("fairwayprofile/clearCurrentProfile");
           this.$store.commit("application/showSplitscreen", false);
-          this.getVSourceByName("Cut Tool").clear();
+          this.getVSourceByName(LAYERS.CUTTOOL).clear();
         }
       }
     },
@@ -400,14 +401,14 @@
       coordinates = coordinates.filter(c => Number(c) === c);
       if (coordinates.length === 4) {
         // draw line on map
-        this.getVSourceByName("Cut Tool").clear();
+        this.getVSourceByName(LAYERS.CUTTOOL).clear();
         const cut = new Feature({
           geometry: new LineString([
             [coordinates[0], coordinates[1]],
             [coordinates[2], coordinates[3]]
           ]).transform("EPSG:4326", "EPSG:3857")
         });
-        this.getVSourceByName("Cut Tool").addFeature(cut);
+        this.getVSourceByName(LAYERS.CUTTOOL).addFeature(cut);
 
         // draw diagram
         this.$store.dispatch("fairwayprofile/cut", cut);
--- a/client/src/store/bottlenecks.js	Wed Feb 20 16:10:54 2019 +0100
+++ b/client/src/store/bottlenecks.js	Thu Feb 21 09:31:02 2019 +0100
@@ -15,6 +15,7 @@
 import { HTTP } from "@/lib/http";
 import { WFS } from "ol/format.js";
 import { displayError } from "@/lib/errors.js";
+import { LAYERS } from "@/store/map.js";
 
 // initial state
 const init = () => {
@@ -63,7 +64,7 @@
           commit("fairwayprofile/clearCurrentProfile", null, { root: true });
           commit("application/showSplitscreen", false, { root: true });
           rootState.map.cutTool.setActive(false);
-          rootGetters["map/getVSourceByName"]("Cut Tool").clear();
+          rootGetters["map/getVSourceByName"](LAYERS.CUTTOOL).clear();
         }
         if (name) {
           commit("application/showProfiles", true, { root: true });
--- a/client/src/store/fairway.js	Wed Feb 20 16:10:54 2019 +0100
+++ b/client/src/store/fairway.js	Thu Feb 21 09:31:02 2019 +0100
@@ -125,7 +125,7 @@
       commit("clearCurrentProfile");
       commit("application/showSplitscreen", false, { root: true });
       rootState.map.cutTool.setActive(false);
-      rootGetters["map/getVSourceByName"]("Cut Tool").clear();
+      rootGetters["map/getVSourceByName"](LAYERS.CUTTOOL).clear();
     },
     loadProfile({ commit, state }, survey) {
       if (state.startPoint && state.endPoint) {