changeset 3543:7219f4b097fe

merge with import_review
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 31 May 2019 09:35:52 +0200
parents b268cae2df39 (current diff) 603055f52834 (diff)
children 067ad32fba69
files
diffstat 4 files changed, 119 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/SectionDetails.vue	Fri May 31 09:34:31 2019 +0200
+++ b/client/src/components/importoverview/SectionDetails.vue	Fri May 31 09:35:52 2019 +0200
@@ -1,11 +1,55 @@
 <template>
-  <div>
-    <a @click="zoomToSection()" class="text-info pointer">{{
-      details.summary.section
-    }}</a>
+  <div
+    :class="{
+      full: !showLogs,
+      split: showLogs
+    }"
+  >
+    <div class="d-flex">
+      <UISpinnerButton
+        @click="showDetails = !showDetails"
+        :state="showDetails"
+        :icons="['angle-right', 'angle-down']"
+        classes="text-info"
+      />
+      <a @click="zoomToSection()" class="text-info pointer">{{
+        details.summary.objnam
+      }}</a>
+    </div>
+    <div>
+      <div v-if="showDetails">
+        <div
+          v-for="(entry, index) in Object.keys(details.summary)"
+          :key="index"
+          class="comparison row no-gutters px-4 text-left"
+        >
+          <span class="col-4">{{ entry }}</span>
+          <span class="col-4">{{ details.summary[entry] }}</span>
+        </div>
+      </div>
+    </div>
   </div>
 </template>
 
+<style lang="scss" scoped>
+.comparison {
+  width: 668px;
+  border-top: dashed 1px #dee2e6;
+}
+
+.comparison:nth-child(odd) {
+  background-color: #f8f9fa;
+}
+
+.split {
+  max-height: 35vh;
+}
+
+.full {
+  max-height: 70vh;
+}
+</style>
+
 <script>
 /* This is Free Software under GNU Affero General Public License v >= 3.0
  * without warranty, see README.md and license for details.
@@ -25,16 +69,21 @@
 
 export default {
   props: ["entry"],
+  data() {
+    return {
+      showDetails: true
+    };
+  },
   mounted() {
     this.$store.commit("imports/hideAdditionalInfo");
   },
   computed: {
-    ...mapState("imports", ["showAdditional", "details"]),
+    ...mapState("imports", ["showAdditional", "showLogs", "details"]),
     ...mapGetters("map", ["openLayersMap"])
   },
   methods: {
     zoomToSection() {
-      const name = this.details.summary.section;
+      const { name } = this.details.summary;
       this.openLayersMap()
         .getLayer("SECTIONS")
         .setVisible(true);
@@ -42,7 +91,7 @@
         .dispatch("imports/loadSection", name)
         .then(response => {
           if (response.data.features.length < 1)
-            throw new Error("no feaures found for: " + name);
+            throw new Error("no features found for: " + name);
           this.$store.commit(
             "imports/selectedSectionId",
             response.data.features[0].id
--- a/client/src/components/importoverview/StretchDetails.vue	Fri May 31 09:34:31 2019 +0200
+++ b/client/src/components/importoverview/StretchDetails.vue	Fri May 31 09:35:52 2019 +0200
@@ -1,11 +1,59 @@
 <template>
-  <div>
-    <a @click="zoomToStretch()" class="text-info pointer">{{
-      details.summary.stretch
-    }}</a>
+  <div
+    :class="{
+      full: !showLogs,
+      split: showLogs
+    }"
+  >
+    <div class="d-flex">
+      <UISpinnerButton
+        @click="showDetails = !showDetails"
+        :state="showDetails"
+        :icons="['angle-right', 'angle-down']"
+        classes="text-info"
+      />
+      <a @click="zoomToStretch()" class="text-info pointer"
+        >{{ details.summary.objnam }} (
+        {{ details.summary.countries.join(", ") }} )</a
+      >
+    </div>
+    <div>
+      <div v-if="showDetails">
+        <div
+          v-for="(entry, index) in Object.keys(details.summary)"
+          :key="index"
+          class="comparison row no-gutters px-4 text-left"
+        >
+          <span class="col-4">{{ entry }}</span>
+          <span v-if="entry === 'countries'" class="col-4">{{
+            details.summary[entry].join(", ")
+          }}</span>
+          <span v-else class="col-4">{{ details.summary[entry] }}</span>
+        </div>
+      </div>
+    </div>
   </div>
 </template>
 
+<style lang="scss" scoped>
+.comparison {
+  width: 668px;
+  border-top: dashed 1px #dee2e6;
+}
+
+.comparison:nth-child(odd) {
+  background-color: #f8f9fa;
+}
+
+.split {
+  max-height: 35vh;
+}
+
+.full {
+  max-height: 70vh;
+}
+</style>
+
 <script>
 /* This is Free Software under GNU Affero General Public License v >= 3.0
  * without warranty, see README.md and license for details.
@@ -24,17 +72,22 @@
 import { mapState, mapGetters } from "vuex";
 
 export default {
+  data() {
+    return {
+      showDetails: true
+    };
+  },
   props: ["entry"],
   mounted() {
     this.$store.commit("imports/hideAdditionalInfo");
   },
   computed: {
-    ...mapState("imports", ["showAdditional", "details"]),
+    ...mapState("imports", ["showAdditional", "showLogs", "details"]),
     ...mapGetters("map", ["openLayersMap"])
   },
   methods: {
     zoomToStretch() {
-      const name = this.details.summary.stretch;
+      const { name } = this.details.summary;
       this.openLayersMap()
         .getLayer("STRETCHES")
         .setVisible(true);
--- a/pkg/imports/sec.go	Fri May 31 09:34:31 2019 +0200
+++ b/pkg/imports/sec.go	Fri May 31 09:35:52 2019 +0200
@@ -201,11 +201,7 @@
 	}
 	feedback.Info("Import of section was successful")
 
-	summary := struct {
-		Section string `json:"section"`
-	}{
-		Section: sec.Name,
-	}
+	summary := sec // to provide full data for review
 
-	return &summary, nil
+	return summary, nil
 }
--- a/pkg/imports/st.go	Fri May 31 09:34:31 2019 +0200
+++ b/pkg/imports/st.go	Fri May 31 09:35:52 2019 +0200
@@ -231,11 +231,7 @@
 	}
 	feedback.Info("Import of stretch was successful")
 
-	summary := struct {
-		Stretch string `json:"stretch"`
-	}{
-		Stretch: st.Name,
-	}
+	summary := st // provide full information for summary
 
-	return &summary, nil
+	return summary, nil
 }