changeset 2352:0d7b51930028

staging: fix detailsbutton behaviour with (U)BN. Only open one instead of all subdetailentries
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 20 Feb 2019 12:09:19 +0100
parents 9c4d6a61ad1d
children b9c317236ebc
files client/src/components/staging/StagingDetail.vue
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/staging/StagingDetail.vue	Wed Feb 20 11:08:20 2019 +0100
+++ b/client/src/components/staging/StagingDetail.vue	Wed Feb 20 12:09:19 2019 +0100
@@ -137,25 +137,25 @@
               bottleneck.properties.objnam
             }}</a>
             <div
-              @click="showBottleneckDetails = !showBottleneckDetails"
+              @click="showBottleneckDetails(index)"
               class="small mt-auto mb-auto text-info text-left"
             >
               <font-awesome-icon
                 class="pointer"
-                v-if="showBottleneckDetails"
+                v-if="showBottleneckDetail === index"
                 icon="angle-up"
                 fixed-width
               ></font-awesome-icon>
               <font-awesome-icon
                 class="pointer"
-                v-if="!showBottleneckDetails"
+                v-if="!(showBottleneckDetail === index)"
                 icon="angle-down"
                 fixed-width
               ></font-awesome-icon>
             </div>
           </div>
 
-          <div class="d-flex flex-row" v-if="showBottleneckDetails">
+          <div class="d-flex flex-row" v-if="showBottleneckDetail === index">
             <table>
               <tr
                 v-for="(info, index) in Object.keys(bottleneck.properties)"
@@ -300,6 +300,7 @@
 import { LAYERS } from "@/store/map.js";
 
 const NO_DIFF = -1;
+const NO_BOTTLENECK = -1;
 
 export default {
   name: "stagingdetail",
@@ -308,7 +309,7 @@
     return {
       showDiff: NO_DIFF,
       showAGMDetails: false,
-      showBottleneckDetails: false,
+      showBottleneckDetail: NO_BOTTLENECK,
       show: false,
       loading: false,
       bottlenecks: []
@@ -352,6 +353,13 @@
     }
   },
   methods: {
+    showBottleneckDetails(index) {
+      if (index == this.showBottleneckDetail) {
+        this.showBottleneckDetail = NO_BOTTLENECK;
+        return;
+      }
+      this.showBottleneckDetail = index;
+    },
     toggleDiff(number) {
       if (this.showDiff !== number || this.showDiff == -1) {
         this.showDiff = number;