changeset 3767:fd6d62b08af7

review_agm: fixed open diff bug. Only selected diff is opened and stays open
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 27 Jun 2019 16:27:48 +0200
parents 96ee62fb88fd
children 57c8cfff4920 bb62c98fcf05
files client/src/components/importoverview/AGMLogItem.vue client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/AGMLogItem.vue	Thu Jun 27 15:11:02 2019 +0200
+++ b/client/src/components/importoverview/AGMLogItem.vue	Thu Jun 27 16:27:48 2019 +0200
@@ -2,7 +2,7 @@
   <div class="d-flex flex-column">
     <div class="px-2 d-flex justify-content-between">
       <div class="d-flex">
-        <div @click="show = !show" class="my-auto text-left">
+        <div @click="toggleShow(index)" class="my-auto text-left">
           <UISpinnerButton
             :state="show"
             :icons="['angle-right', 'angle-down']"
@@ -56,12 +56,15 @@
 <script>
 export default {
   props: ["line", "index", "showDiff"],
-  data() {
-    return {
-      show: this.index == this.showDiff
-    };
+  computed: {
+    show() {
+      return this.index === this.showDiff;
+    }
   },
   methods: {
+    toggleShow(index) {
+      this.$emit("openDiff", index);
+    },
     isNew(result) {
       return result && result.versions && result.versions.length === 1;
     },
--- a/client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue	Thu Jun 27 15:11:02 2019 +0200
+++ b/client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue	Thu Jun 27 16:27:48 2019 +0200
@@ -10,6 +10,7 @@
       <Item
         class="d-flex flex-row px-2 border-top"
         v-for="(item, index) in details.summary"
+        @openDiff="toggleDiff"
         :key="index"
         :line="item"
         :index="index"
@@ -94,6 +95,7 @@
   },
   methods: {
     toggleDiff(number) {
+      console.log(number);
       if (this.showDiff !== number) {
         this.showDiff = number;
       } else {