changeset 1248:9f37424f0cfa

merge
author Markus Kottlaender <markus@intevation.de>
date Wed, 21 Nov 2018 11:38:35 +0100
parents c14353e2cdb9 (current diff) b41494821b02 (diff)
children 104d41ea7c15
files client/src/importqueue/Importqueue.vue client/src/locale/en_GB/LC_MESSAGES/app.po~
diffstat 7 files changed, 195 insertions(+), 192 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgchurn	Wed Nov 21 11:38:35 2018 +0100
@@ -0,0 +1,1 @@
+teichmann@intevation.de = sascha.teichmann@intevation.de
--- a/client/src/application/Sidebar.vue	Wed Nov 21 08:15:28 2018 +0100
+++ b/client/src/application/Sidebar.vue	Wed Nov 21 11:38:35 2018 +0100
@@ -12,23 +12,19 @@
                     <i class="fa fa-map-o align-self-center navicon"></i>Map
                 </router-link>
                 <div class="d-flex flex-row nav-link">
-                    <i v-if="routeName == 'mainview'" class="fa fa-ship align-self-center navicon"></i>
+                    <i class="fa fa-ship align-self-center navicon"></i>
                     <a
                         class="text-body d-flex flex-row"
-                        v-if="routeName == 'mainview'"
                         href="#"
                         @click="toggleContextBox('bottlenecks')"
                     >Bottlenecks</a>
                 </div>
                 <div v-if="isSysAdmin">
                     <hr>
-                    <div
-                        v-if="routeName == 'mainview'"
-                        class="nav-link d-flex menupadding text-muted"
-                    >Administration</div>
+                    <div class="nav-link d-flex menupadding text-muted">Administration</div>
                 </div>
                 <div v-if="isWaterwayAdmin">
-                    <div v-if="routeName == 'mainview'" class="d-flex flex-row nav-link">
+                    <div class="d-flex flex-row nav-link">
                         <i class="fa fa-upload align-self-center navicon"></i>
                         <a
                             href="#"
@@ -36,7 +32,7 @@
                             @click="toggleContextBox('imports')"
                         >Import soundingresults</a>
                     </div>
-                    <div v-if="routeName == 'mainview'" class="d-flex flex-row nav-link">
+                    <div class="d-flex flex-row nav-link">
                         <i class="fa fa-list-ol align-self-center navicon"></i>
                         <a
                             href="#"
@@ -128,10 +124,13 @@
       this.$router.push("/login");
     },
     toggleContextBox(context) {
-      this.$store.commit(
-        "application/showInContextBox",
-        this.showInContextBox === context ? null : context
-      );
+      const SHOW = context;
+      const HIDE = null;
+      const isElementAlreadyShown = this.showInContextBox === context;
+      let toggleState =
+        isElementAlreadyShown && this.routeName === "mainview" ? HIDE : SHOW;
+      this.$router.push("/");
+      this.$store.commit("application/showInContextBox", toggleState);
       if (this.showInContextBox === context) {
         this.$store.commit("application/showSearchbar", true);
       } else {
--- a/client/src/importqueue/Importqueue.vue	Wed Nov 21 08:15:28 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-<template>
-    <div class="d-flex flex-row">
-        <div :class="spacerStyle"></div>
-        <div class="mt-3 mx-auto">
-            <div class="card importqueuecard">
-                <div class="card-header shadow-sm text-white bg-info mb-3">Importqueue</div>
-                <div class="card-body importcardbody">
-                    <div class="card-body importcardbody">
-                        <div class="searchandfilter d-flex flex-row">
-                            <div class="searchgroup input-group">
-                                <div class="input-group-prepend">
-                                    <span class="input-group-text" id="search">
-                                        <i class="fa fa-search"></i>
-                                    </span>
-                                </div>
-                                <input
-                                    type="text"
-                                    class="form-control"
-                                    placeholder=""
-                                    aria-label="Search"
-                                    aria-describedby="search"
-                                >
-                            </div>
-                            <div class="filters">
-                                <button
-                                    @click="setFilter('successful')"
-                                    :class="successfulStyle"
-                                >Successful</button>
-                                <button @click="setFilter('failed')" :class="failedStyle">Failed</button>
-                                <button @click="setFilter('pending')" :class="pendingStyle">Pending</button>
-                            </div>
-                        </div>
-                        <table class="table">
-                            <thead>
-                                <tr>
-                                    <th>Enqueued</th>
-                                    <th>Kind</th>
-                                    <th>User</th>
-                                    <th>State</th>
-                                </tr>
-                            </thead>
-                            <tbody>
-                                <tr v-for="job in imports" :key="job.id">
-                                    <td>{{job.enqueued}}</td>
-                                    <td>{{job.kind}}</td>
-                                    <td>{{job.user}}</td>
-                                    <td>{{job.state}}</td>
-                                </tr>
-                            </tbody>
-                        </table>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</template>
-
-<script>
-import { displayError } from "../application/lib/errors.js";
-import { mapState } from "vuex";
-
-export default {
-  name: "importqueue",
-  data() {
-    return {
-      successful: false,
-      failed: false,
-      pending: false
-    };
-  },
-  methods: {
-    setFilter(name) {
-      this[name] = !this[name];
-      const allSet = this.successful && this.failed && this.pending;
-      if (allSet) {
-        this.all = false;
-        this.successful = false;
-        this.failed = false;
-        this.pending = false;
-      }
-    }
-  },
-  computed: {
-    ...mapState("imports", ["imports"]),
-    ...mapState("application", ["showSidebar"]),
-    spacerStyle() {
-      return [
-        "spacer ml-3",
-        {
-          "spacer-expanded": this.showSidebar,
-          "spacer-collapsed": !this.showSidebar
-        }
-      ];
-    },
-    successfulStyle() {
-      return {
-        btn: true,
-        "btn-light": !this.successful,
-        "btn-dark": this.successful
-      };
-    },
-    pendingStyle() {
-      return {
-        btn: true,
-        "btn-light": !this.pending,
-        "btn-dark": this.pending
-      };
-    },
-    failedStyle() {
-      return {
-        btn: true,
-        "btn-light": !this.failed,
-        "btn-dark": this.failed
-      };
-    }
-  },
-  mounted() {
-    this.$store.dispatch("imports/getImports").catch(error => {
-      const { status, data } = error.response;
-      displayError({
-        title: "Backend Error",
-        message: `${status}: ${data.message || data}`
-      });
-    });
-  }
-};
-</script>
-
-<style lang="sass" scoped>
-.spacer
-  height: 100vh
-
-.spacer-collapsed
-  min-width: $icon-width + $offset
-  transition: $transition-fast
-
-.spacer-expanded
-  min-width: $sidebar-width + $offset
-
-.importqueuecard
-  width: 80vw
-  min-height: 20rem
-
-.card-body
-  width: 100%
-  margin-left: auto
-  margin-right: auto
-
-.searchandfilter
-  position: relative
-  margin-bottom: $xx-large-offset
-
-.filters
-  position: absolute
-  right: 0
-
-.filters button
-  margin-right: $small-offset
-
-.table td,
-.table th
-  border-top: 0 !important
-  text-align: left
-  padding: $small-offset !important
-
-.searchgroup
-  position: absolute
-  left: 0
-  width: 50%
-</style>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/imports/Importqueue.vue	Wed Nov 21 11:38:35 2018 +0100
@@ -0,0 +1,170 @@
+<template>
+    <div class="d-flex flex-row">
+        <div :class="spacerStyle"></div>
+        <div class="mt-3 mx-auto">
+            <div class="card importqueuecard">
+                <div class="card-header shadow-sm text-white bg-info mb-3">Importqueue</div>
+                <div class="card-body importcardbody">
+                    <div class="card-body importcardbody">
+                        <div class="searchandfilter d-flex flex-row">
+                            <div class="searchgroup input-group">
+                                <div class="input-group-prepend">
+                                    <span class="input-group-text" id="search">
+                                        <i class="fa fa-search"></i>
+                                    </span>
+                                </div>
+                                <input
+                                    type="text"
+                                    class="form-control"
+                                    placeholder=""
+                                    aria-label="Search"
+                                    aria-describedby="search"
+                                >
+                            </div>
+                            <div class="filters">
+                                <button
+                                    @click="setFilter('successful')"
+                                    :class="successfulStyle"
+                                >Successful</button>
+                                <button @click="setFilter('failed')" :class="failedStyle">Failed</button>
+                                <button @click="setFilter('pending')" :class="pendingStyle">Pending</button>
+                            </div>
+                        </div>
+                        <table class="table">
+                            <thead>
+                                <tr>
+                                    <th>Enqueued</th>
+                                    <th>Kind</th>
+                                    <th>User</th>
+                                    <th>State</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                <tr v-for="job in imports" :key="job.id">
+                                    <td>{{job.enqueued}}</td>
+                                    <td>{{job.kind}}</td>
+                                    <td>{{job.user}}</td>
+                                    <td>{{job.state}}</td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import { displayError } from "../application/lib/errors.js";
+import { mapState } from "vuex";
+
+export default {
+  name: "importqueue",
+  data() {
+    return {
+      successful: false,
+      failed: false,
+      pending: false
+    };
+  },
+  methods: {
+    setFilter(name) {
+      this[name] = !this[name];
+      const allSet = this.successful && this.failed && this.pending;
+      if (allSet) {
+        this.all = false;
+        this.successful = false;
+        this.failed = false;
+        this.pending = false;
+      }
+    }
+  },
+  computed: {
+    ...mapState("imports", ["imports"]),
+    ...mapState("application", ["showSidebar"]),
+    spacerStyle() {
+      return [
+        "spacer ml-3",
+        {
+          "spacer-expanded": this.showSidebar,
+          "spacer-collapsed": !this.showSidebar
+        }
+      ];
+    },
+    successfulStyle() {
+      return {
+        btn: true,
+        "btn-light": !this.successful,
+        "btn-dark": this.successful
+      };
+    },
+    pendingStyle() {
+      return {
+        btn: true,
+        "btn-light": !this.pending,
+        "btn-dark": this.pending
+      };
+    },
+    failedStyle() {
+      return {
+        btn: true,
+        "btn-light": !this.failed,
+        "btn-dark": this.failed
+      };
+    }
+  },
+  mounted() {
+    this.$store.dispatch("imports/getImports").catch(error => {
+      const { status, data } = error.response;
+      displayError({
+        title: "Backend Error",
+        message: `${status}: ${data.message || data}`
+      });
+    });
+  }
+};
+</script>
+
+<style lang="sass" scoped>
+.spacer
+  height: 100vh
+
+.spacer-collapsed
+  min-width: $icon-width + $offset
+  transition: $transition-fast
+
+.spacer-expanded
+  min-width: $sidebar-width + $offset
+
+.importqueuecard
+  width: 80vw
+  min-height: 20rem
+
+.card-body
+  width: 100%
+  margin-left: auto
+  margin-right: auto
+
+.searchandfilter
+  position: relative
+  margin-bottom: $xx-large-offset
+
+.filters
+  position: absolute
+  right: 0
+
+.filters button
+  margin-right: $small-offset
+
+.table td,
+.table th
+  border-top: 0 !important
+  text-align: left
+  padding: $small-offset !important
+
+.searchgroup
+  position: absolute
+  left: 0
+  width: 50%
+</style>
--- a/client/src/imports/Imports.vue	Wed Nov 21 08:15:28 2018 +0100
+++ b/client/src/imports/Imports.vue	Wed Nov 21 11:38:35 2018 +0100
@@ -23,7 +23,7 @@
                 </div>
                 <input
                     id="importdate"
-                    type="text"
+                    type="date"
                     class="form-control"
                     placeholder="Date of import"
                     aria-label="bottleneck"
@@ -157,20 +157,24 @@
           this.importState = IMPORTSTATE.EDIT;
           this.bottleneck = bottleneck;
           this.depthReference = depthReference;
-          this.importDate = date;
+          this.importDate = new Date(date).toISOString().split("T")[0];
           this.token = response.data.token;
         })
         .catch(error => {
           const { status, data } = error.response;
+          const messages = data.messages ? data.messages.join(", ") : "";
           displayError({
             title: "Backend Error",
-            message: `${status}: ${data.message || data}`
+            message: `${status}: ${messages}`
           });
         });
     },
     confirm() {
       let formData = new FormData();
       formData.append("token", this.token);
+      ["bottleneck", "importDate", "depthReference"].forEach(x => {
+        if (this[x]) formData.append(x, this[x]);
+      });
       HTTP.post("/imports/soundingresult", formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
@@ -180,7 +184,7 @@
         .then(() => {
           displayInfo({
             title: "Import",
-            message: "Successfully imported " + this.bottleneck
+            message: "Starting import for " + this.bottleneck
           });
           this.initialState();
         })
--- a/client/src/main.js	Wed Nov 21 08:15:28 2018 +0100
+++ b/client/src/main.js	Wed Nov 21 11:38:35 2018 +0100
@@ -1,14 +1,13 @@
-/*
- * This is Free Software under GNU Affero General Public License v >= 3.0
+/* This is Free Software under GNU Affero General Public License v >= 3.0
  * without warranty, see README.md and license for details.
- * 
+ *
  * SPDX-License-Identifier: AGPL-3.0-or-later
  * License-Filename: LICENSES/AGPL-3.0.txt
- * 
+ *
  * Copyright (C) 2018 by via donau 
  *   – Österreichische Wasserstraßen-Gesellschaft mbH
  * Software engineering by Intevation GmbH
- * 
+ *
  * Author(s):
  * Thomas Junk <thomas.junk@intevation.de>
  */
--- a/client/src/router.js	Wed Nov 21 08:15:28 2018 +0100
+++ b/client/src/router.js	Wed Nov 21 11:38:35 2018 +0100
@@ -25,7 +25,7 @@
 const Main = () => import("./application/Main.vue");
 const Usermanagement = () => import("./usermanagement/Usermanagement.vue");
 const Logs = () => import("./logs/logs.vue");
-const Importqueue = () => import("./importqueue/Importqueue.vue");
+const Importqueue = () => import("./imports/Importqueue.vue");
 const Systemconfiguration = () =>
   import("./systemconfiguration/systemconfiguration.vue");