changeset 3517:d3ca26b1d104 waterlevel-in-crossprofile

merged default into waterlevel-in-crossprofile branch
author Markus Kottlaender <markus@intevation.de>
date Wed, 29 May 2019 10:44:14 +0200
parents fcb4f3fabde8 (current diff) 6cdfc05fd6b0 (diff)
children 70cd7383325b
files
diffstat 2 files changed, 52 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importconfiguration/Import.vue	Tue May 28 19:22:42 2019 +0200
+++ b/client/src/components/importconfiguration/Import.vue	Wed May 29 10:44:14 2019 +0200
@@ -6,8 +6,9 @@
       <UITableHeader
         :columns="[
           { id: 'id', title: `${idLabel}`, class: 'col-1' },
-          { id: 'kind', title: `${typeLabel}`, class: 'col-2' },
+          { id: 'kind', title: `${typeLabel}`, class: 'col-1' },
           { id: 'user', title: `${authorLabel}`, class: 'col-2' },
+          { id: 'country', title: `${countryLabel}`, class: 'col-1' },
           { id: 'config.cron', title: `${scheduleLabel}`, class: 'col-2' },
           { id: 'config.send-email', title: `${emailLabel}`, class: 'col-2' }
         ]"
@@ -18,10 +19,15 @@
       >
         <template v-slot:row="{ item: schedule }">
           <div class="table-cell py-1 col-1">{{ schedule.id }}</div>
-          <div class="table-cell py-1 col-2">
+          <div class="table-cell py-1 col-1">
             {{ schedule.kind.toUpperCase() }}
           </div>
-          <div class="table-cell py-1 col-2">{{ schedule.user }}</div>
+          <div style="width:115px;" class="table-cell py-1">
+            {{ schedule.user }}
+          </div>
+          <div style="width:55px;" class="table-cell py-1">
+            {{ userCountries[schedule.user] }}
+          </div>
           <div class="table-cell py-1 col-2">{{ schedule.config.cron }}</div>
           <div class="table-cell py-1 col-2">
             <font-awesome-icon
@@ -84,7 +90,7 @@
  * Thomas Junk <thomas.junk@intevation.de>
  * Markus Kottländer <markus.kottlaender@intevation.de>
  */
-import { mapState } from "vuex";
+import { mapState, mapGetters } from "vuex";
 import { displayInfo, displayError } from "@/lib/errors";
 import { HTTP } from "@/lib/http";
 import {
@@ -207,6 +213,10 @@
       "currentSchedule",
       "importScheduleDetailVisible"
     ]),
+    ...mapGetters("usermanagement", ["userCountries"]),
+    countryLabel() {
+      return this.$gettext("Country");
+    },
     isOnetime() {
       for (let kind of [
         this.$options.IMPORTTYPES.SOUNDINGRESULTS,
@@ -247,9 +257,20 @@
     }
   },
   mounted() {
-    this.$store.commit("importschedule/setListMode");
-    this.$store.commit("importschedule/clearCurrentSchedule");
-    this.getSchedules();
+    this.$store
+      .dispatch("usermanagement/loadUsers")
+      .then(() => {
+        this.$store.commit("importschedule/setListMode");
+        this.$store.commit("importschedule/clearCurrentSchedule");
+        this.getSchedules();
+      })
+      .catch(error => {
+        const { status, data } = error.response;
+        displayError({
+          title: this.$gettext("Backend Error"),
+          message: `${status}: ${data.message || data}`
+        });
+      });
   },
   IMPORTTYPES: IMPORTTYPES,
   MODES: MODES
--- a/client/src/components/map/styles.js	Tue May 28 19:22:42 2019 +0200
+++ b/client/src/components/map/styles.js	Wed May 29 10:44:14 2019 +0200
@@ -247,20 +247,31 @@
         geom = new Point(getCenter(feature.getGeometry().getExtent()));
       }
       maps.forEach(m => {
-        let frame = `<polyline points='16,0 32,32 0,32 16,0' stroke='grey' stroke-width='1' fill='white'/>`;
-        let waterlevel = `<polyline points="16,0 24,16 16,32 8,16 16,0" stroke='grey' stroke-width='1' fill='${colorWaterlevel}'/>`;
-        let accuracy = `<polyline points="24,16 32,32 16,32 24,16" stroke='grey' stroke-width='1' fill='${colorAccuracy}'/>`;
-        let comparison = `<polyline points="8,16 16,32 0,32 8,16" stroke='grey' stroke-width='1' fill='${colorComparison}'/>`;
-        let svg = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g>${frame}${waterlevel}${comparison}${accuracy}</g></svg>`;
-        s.push(
-          new Style({
-            geometry: geom,
-            image: new Icon({
-              src: svg,
-              anchor: [-0.5, 1]
+        if (
+          (m.getLayer("BOTTLENECKS").getVisible() &&
+            feature.getId().indexOf("bottlenecks") > -1) ||
+          (m.getLayer("SECTIONS").getVisible() &&
+            feature.getId().indexOf("sections") > -1) ||
+          (m.getLayer("STRETCHES").getVisible() &&
+            feature.getId().indexOf("stretches") > -1) ||
+          (m.getLayer("GAUGES").getVisible() &&
+            feature.getId().indexOf("gauges") > -1)
+        ) {
+          let frame = `<polyline points='16,0 32,32 0,32 16,0' stroke='grey' stroke-width='1' fill='white'/>`;
+          let waterlevel = `<polyline points="16,0 24,16 16,32 8,16 16,0" stroke='grey' stroke-width='1' fill='${colorWaterlevel}'/>`;
+          let accuracy = `<polyline points="24,16 32,32 16,32 24,16" stroke='grey' stroke-width='1' fill='${colorAccuracy}'/>`;
+          let comparison = `<polyline points="8,16 16,32 0,32 8,16" stroke='grey' stroke-width='1' fill='${colorComparison}'/>`;
+          let svg = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g>${frame}${waterlevel}${comparison}${accuracy}</g></svg>`;
+          s.push(
+            new Style({
+              geometry: geom,
+              image: new Icon({
+                src: svg,
+                anchor: [-0.5, 1]
+              })
             })
-          })
-        );
+          );
+        }
 
         if (
           m.getLayer("BOTTLENECKS").getVisible() &&