changeset 2399:e120631797f6 staging_consolidation

wip
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 27 Feb 2019 13:50:24 +0100
parents 0b8793a1947c
children 08780099f729
files client/src/components/App.vue client/src/components/Contextbox.vue client/src/components/Sidebar.vue client/src/router.js client/src/store/imports.js
diffstat 5 files changed, 59 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/App.vue	Mon Feb 25 17:30:07 2019 +0100
+++ b/client/src/components/App.vue	Wed Feb 27 13:50:24 2019 +0100
@@ -90,7 +90,9 @@
     ...mapState("user", ["isAuthenticated"]),
     ...mapState("application", ["contextBoxContent", "showSearchbar"]),
     isMapVisible() {
-      return /stretches|review|bottlenecks|mainview/.test(this.routeName);
+      return /importoverview|stretches|review|bottlenecks|mainview/.test(
+        this.routeName
+      );
     },
     routeName() {
       const routeName = this.$route.name;
--- a/client/src/components/Contextbox.vue	Mon Feb 25 17:30:07 2019 +0100
+++ b/client/src/components/Contextbox.vue	Wed Feb 27 13:50:24 2019 +0100
@@ -3,6 +3,9 @@
     <Bottlenecks v-if="contextBoxContent === 'bottlenecks'"></Bottlenecks>
     <Staging v-if="contextBoxContent === 'staging'"></Staging>
     <Stretches v-if="contextBoxContent === 'stretches'"></Stretches>
+    <ImportOverview
+      v-if="contextBoxContent === 'importoverview'"
+    ></ImportOverview>
   </div>
 </template>
 
@@ -25,9 +28,11 @@
 export default {
   name: "contextbox",
   components: {
-    Bottlenecks: () => import("./Bottlenecks"),
-    Staging: () => import("./staging/Staging.vue"),
-    Stretches: () => import("./ImportStretches.vue")
+    Bottlenecks: () => import("@/components/Bottlenecks"),
+    Staging: () => import("@/components/staging/Staging.vue"),
+    Stretches: () => import("@/components/ImportStretches.vue"),
+    ImportOverview: () =>
+      import("@/components/importoverview/ImportOverview.vue")
   },
   computed: {
     ...mapState("application", [
--- a/client/src/components/Sidebar.vue	Mon Feb 25 17:30:07 2019 +0100
+++ b/client/src/components/Sidebar.vue	Wed Feb 27 13:50:24 2019 +0100
@@ -40,6 +40,19 @@
             </span>
           </router-link>
         </div>
+        <div v-if="isWaterwayAdmin">
+          <router-link to="/imports/overview" class="position-relative">
+            <font-awesome-icon
+              class="fa-fw mr-2"
+              fixed-width
+              icon="clipboard-check"
+            ></font-awesome-icon>
+            <span class="fix-trans-space" v-translate>Staging area</span>
+            <span class="indicator" v-if="showSidebar && staging.length">
+              {{ staging.length }}
+            </span>
+          </router-link>
+        </div>
         <div v-if="isSysAdmin">
           <router-link to="/stretches">
             <font-awesome-icon
--- a/client/src/router.js	Mon Feb 25 17:30:07 2019 +0100
+++ b/client/src/router.js	Wed Feb 27 13:50:24 2019 +0100
@@ -208,6 +208,25 @@
       }
     },
     {
+      path: "/imports/overview/:id?",
+      name: "importoverview",
+      component: Main,
+      meta: {
+        requiresAuth: true
+      },
+      beforeEnter: (to, from, next) => {
+        const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
+        if (!isWaterwayAdmin) {
+          next("/");
+        } else {
+          store.commit("application/showContextBox", true);
+          store.commit("application/contextBoxContent", "importoverview");
+          store.commit("application/showSearchbar", true);
+          next();
+        }
+      }
+    },
+    {
       path: "/stretches",
       name: "stretches",
       component: Main,
--- a/client/src/store/imports.js	Mon Feb 25 17:30:07 2019 +0100
+++ b/client/src/store/imports.js	Wed Feb 27 13:50:24 2019 +0100
@@ -165,6 +165,22 @@
             reject(error);
           });
       });
+    },
+    confirmReview({ commit }, reviewResults) {
+      return new Promise((resolve, reject) => {
+        HTTP.patch("/imports", reviewResults, {
+          headers: {
+            "X-Gemma-Auth": localStorage.getItem("token"),
+            "Content-type": "application/json"
+          }
+        })
+          .then(response => {
+            resolve(response);
+          })
+          .catch(error => {
+            reject(error);
+          });
+      });
     }
   }
 };