changeset 5588:94ef43fac0eb surveysperbottleneckid

Make BN for overview distinguishable
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 05 Apr 2022 10:15:37 +0200
parents 2576a399c2cf
children f24c9a7b3e82
files client/src/components/Bottlenecks.vue client/src/store/bottlenecks.js
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Bottlenecks.vue	Mon Apr 04 15:30:54 2022 +0200
+++ b/client/src/components/Bottlenecks.vue	Tue Apr 05 10:15:37 2022 +0200
@@ -29,7 +29,7 @@
       <template v-slot:row="{ item: bottleneck }">
         <div class="table-cell truncate text-left" style="width: 230px">
           <a href="#" @click="selectBottleneck(bottleneck)">{{
-            bottleneck.properties.name
+            bottleneck.properties.displayName
           }}</a>
         </div>
         <div class="table-cell text-center" style="width: 100px">
@@ -86,7 +86,7 @@
  * Author(s):
  * Markus Kottländer <markus.kottlaender@intevation.de>
  */
-import { mapState } from "vuex";
+import { mapState, mapGetters } from "vuex";
 import { HTTP } from "@/lib/http";
 import { displayError } from "@/lib/errors";
 import { sortTable } from "@/lib/mixins";
@@ -104,7 +104,7 @@
   },
   computed: {
     ...mapState("application", ["searchQuery", "showSearchbarLastState"]),
-    ...mapState("bottlenecks", ["bottlenecksList"]),
+    ...mapGetters("bottlenecks", ["bottlenecksForDisplay"]),
     bottlenecksLabel() {
       return this.$gettext("Bottlenecks");
     },
@@ -128,7 +128,7 @@
   },
   methods: {
     filteredBottlenecks() {
-      return this.bottlenecksList.filter(bn => {
+      return this.bottlenecksForDisplay.filter(bn => {
         return bn.properties.name
           .toLowerCase()
           .includes(this.searchQuery.toLowerCase());
--- a/client/src/store/bottlenecks.js	Mon Apr 04 15:30:54 2022 +0200
+++ b/client/src/store/bottlenecks.js	Tue Apr 05 10:15:37 2022 +0200
@@ -42,6 +42,17 @@
         return o;
       }, {});
     },
+    bottlenecksForDisplay: (state, getters) => {
+      const groupedBottlenecks = getters.orderedBottlenecks;
+      return Object.keys(groupedBottlenecks)
+        .map(country => {
+          return groupedBottlenecks[country];
+        })
+        .reduce((o, n) => {
+          o = o.concat(n);
+          return o;
+        }, []);
+    },
     orderedBottlenecks: state => {
       const groupedBottlenecks = {};
       const orderedGroups = {};