changeset 3316:c7b48272e11e

client: fairway availability: removed unnecessary computed property Since entries() was only used for stretches/sections the check for type=bottlenecks was not necessary. To make think even more clear and straight forward, I just removed this computed entries property and just added a new select, so that now every type has it's own select. Bit more html but less bloated component logic.
author Markus Kottlaender <markus@intevation.de>
date Fri, 17 May 2019 14:58:59 +0200
parents d61b88439c85
children deea2f15400f
files client/src/components/fairway/AvailableFairwayDepthDialogue.vue
diffstat 1 files changed, 21 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthDialogue.vue	Fri May 17 14:41:28 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthDialogue.vue	Fri May 17 14:58:59 2019 +0200
@@ -30,7 +30,6 @@
           </div>
         </div>
         <select
-          :key="1"
           v-if="type === $options.BOTTLENECKS"
           @change="entrySelected"
           class="form-control font-weight-bold"
@@ -52,19 +51,34 @@
           </optgroup>
         </select>
         <select
-          :key="2"
-          v-else
+          v-else-if="type === $options.STRETCHES"
           @change="entrySelected"
           class="form-control font-weight-bold"
           v-model="selectedEntry"
         >
           <option :value="null">{{ placeholder }}</option>
           <option
-            v-for="(entry, index) in entries"
-            :value="entry"
-            :key="index"
-            >{{ entry.properties.name }}</option
+            v-for="stretch in stretches"
+            :value="stretch"
+            :key="stretch.id"
           >
+            {{ stretch.properties.name }}
+          </option>
+        </select>
+        <select
+          v-else-if="type === $options.SECTIONS"
+          @change="entrySelected"
+          class="form-control font-weight-bold"
+          v-model="selectedEntry"
+        >
+          <option :value="null">{{ placeholder }}</option>
+          <option
+            v-for="section in sections"
+            :value="section"
+            :key="section.id"
+          >
+            {{ section.properties.name }}
+          </option>
         </select>
         <div class="d-flex mt-2">
           <div class="d-flex flex-column w-50 mr-1">
@@ -253,12 +267,6 @@
         );
       }
     },
-    entries() {
-      if (this.type === this.$options.BOTTLENECKS) return this.bottlenecksList;
-      if (this.type === this.$options.STRETCHES) return this.stretches;
-      if (this.type === this.$options.SECTIONS) return this.sections;
-      return [];
-    },
     label() {
       return this.$gettext("Available fairway depth");
     },