changeset 2343:33d2ef9f9e5d

client: use the name constants for Layer names
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 20 Feb 2019 10:00:01 +0100
parents 4e325dda6a2d
children a5b87a695469
files client/src/components/layers/Layerselect.vue
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/layers/Layerselect.vue	Wed Feb 20 08:53:30 2019 +0100
+++ b/client/src/components/layers/Layerselect.vue	Wed Feb 20 10:00:01 2019 +0100
@@ -18,7 +18,7 @@
         >{{ layername }}</label
       >
     </div>
-    <div v-if="isVisible && layername == 'Bottleneck isolines'">
+    <div v-if="isVisible && isBottleneckIsolineLayer">
       <img class="rounded my-1 d-block" :src="isolinesLegendImgDataURL" />
     </div>
   </div>
@@ -50,6 +50,7 @@
  */
 import { HTTP } from "@/lib/http";
 import { mapState } from "vuex";
+import { LAYERS } from "@/store/map.js";
 export default {
   props: ["layername", "layerindex", "isVisible"],
   name: "layerselect",
@@ -57,7 +58,10 @@
     LegendElement: () => import("./LegendElement.vue")
   },
   computed: {
-    ...mapState("map", ["isolinesLegendImgDataURL"])
+    ...mapState("map", ["isolinesLegendImgDataURL"]),
+    isBottleneckIsolineLayer() {
+      return this.layername == LAYERS.BOTTLENECKISOLINE;
+    }
   },
   methods: {
     visibilityToggled() {
@@ -67,7 +71,7 @@
   created() {
     // fetch legend image for bottleneck isolines
     // directly read it as dataURL so it is reusable later
-    if (this.layername == "Bottleneck isolines") {
+    if (this.isBottleneckIsolineLayer) {
       const src =
         "/internal/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=sounding_results_contour_lines_geoserver&legend_options=columns:4;fontAntiAliasing:true";
       HTTP.get(src, {