changeset 3506:e2ed741545e1

import_overview: added country column
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 28 May 2019 13:47:18 +0200
parents d136ceed5d41
children a606d003730c
files client/src/components/importoverview/ImportOverview.vue client/src/components/importoverview/LogEntry.vue client/src/store/usermanagement.js
diffstat 3 files changed, 28 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue	Tue May 28 12:44:13 2019 +0200
+++ b/client/src/components/importoverview/ImportOverview.vue	Tue May 28 13:47:18 2019 +0200
@@ -74,11 +74,12 @@
       </div>
       <UITableHeader
         :columns="[
-          { id: 'id', title: `${idLabel}`, width: '79px' },
+          { id: 'id', title: `${idLabel}`, width: '75px' },
           { id: 'kind', title: `${kindLabel}`, width: '53px' },
           { id: 'enqueued', title: `${enqueuedLabel}`, width: '138px' },
-          { id: 'user', title: `${userLabel}`, width: '105px' },
-          { id: 'signer', title: `${signerLabel}`, width: '105px' },
+          { id: 'user', title: `${userLabel}`, width: '80px' },
+          { id: 'country', title: `${countryLabel}`, width: '55px' },
+          { id: 'signer', title: `${signerLabel}`, width: '80px' },
           { id: 'state', title: `${statusLabel}`, width: '72px' },
           { id: 'warnings', icon: 'exclamation-triangle', width: '44px' }
         ]"
@@ -169,6 +170,9 @@
       "next"
     ]),
     ...mapGetters("imports", ["filters"]),
+    countryLabel() {
+      return this.$gettext("Country");
+    },
     importReviewLabel() {
       return this.$gettext("Import review");
     },
@@ -437,6 +441,13 @@
     }
   },
   mounted() {
+    this.$store.dispatch("usermanagement/loadUsers").catch(error => {
+      const { status, data } = error.response;
+      displayError({
+        title: this.$gettext("Backend Error"),
+        message: `${status}: ${data.message || data}`
+      });
+    });
     const { id } = this.$route.params;
     if (id) {
       this.showSingleRessource(id);
--- a/client/src/components/importoverview/LogEntry.vue	Tue May 28 12:44:13 2019 +0200
+++ b/client/src/components/importoverview/LogEntry.vue	Tue May 28 13:47:18 2019 +0200
@@ -1,6 +1,6 @@
 <template>
   <div class="row w-100 no-gutters text-left">
-    <div style="width: 79px;" class="table-cell d-flex justify-content-between">
+    <div style="width: 75px;" class="table-cell d-flex justify-content-between">
       <UISpinnerButton
         @click="toggleDetails"
         :loading="loading"
@@ -15,10 +15,13 @@
     <div style="width: 138px;" class="table-cell center">
       {{ entry.enqueued | dateTime }}
     </div>
-    <div style="width: 105px;" class="table-cell truncate">
+    <div style="width: 80px;" class="table-cell truncate">
       {{ entry.user }}
     </div>
-    <div style="width: 105px;" class="table-cell truncate">
+    <div style="width: 55px;" class="table-cell center">
+      {{ userCountries[entry.user] }}
+    </div>
+    <div style="width: 80px;" class="table-cell truncate">
       {{ entry.signer }}
     </div>
     <div style="width: 72px;" :class="stateStyle">
@@ -93,7 +96,7 @@
  * * Thomas Junk <thomas.junk@intevation.de>
  * * Markus Kottländer <markus.kottlaender@intevation.de>
  */
-import { mapState } from "vuex";
+import { mapState, mapGetters } from "vuex";
 import { STATES } from "@/store/imports";
 import { displayError } from "@/lib/errors";
 import { HTTP } from "@/lib/http";
@@ -108,6 +111,7 @@
   },
   computed: {
     ...mapState("imports", ["show"]),
+    ...mapGetters("usermanagement", ["userCountries"]),
     stateStyle() {
       return [
         "table-cell",
--- a/client/src/store/usermanagement.js	Tue May 28 12:44:13 2019 +0200
+++ b/client/src/store/usermanagement.js	Tue May 28 13:47:18 2019 +0200
@@ -41,6 +41,12 @@
   namespaced: true,
   state: init(),
   getters: {
+    userCountries: state => {
+      return state.users.reduce((o, n) => {
+        o[n.user] = n.country !== "--" ? n.country : "global";
+        return o;
+      }, {});
+    },
     isUserDetailsVisible: state => {
       return state.userDetailsVisible;
     },