changeset 3298:ec27ee21f7bc

client: define sections: added route and support in context box
author Markus Kottlaender <markus@intevation.de>
date Thu, 16 May 2019 16:33:29 +0200
parents 0358bf723769
children ef52926ce2fc
files client/src/components/App.vue client/src/components/Contextbox.vue client/src/router.js
diffstat 3 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/App.vue	Thu May 16 16:27:28 2019 +0200
+++ b/client/src/components/App.vue	Thu May 16 16:33:29 2019 +0200
@@ -78,7 +78,7 @@
     ...mapState("user", ["isAuthenticated"]),
     ...mapState("application", ["contextBoxContent", "showSearchbar"]),
     isMapVisible() {
-      return /importconfiguration|importoverview|stretches|review|bottlenecks|mainview/.test(
+      return /importconfiguration|importoverview|stretches|sections|review|bottlenecks|mainview/.test(
         this.$route.name
       );
     },
--- a/client/src/components/Contextbox.vue	Thu May 16 16:27:28 2019 +0200
+++ b/client/src/components/Contextbox.vue	Thu May 16 16:33:29 2019 +0200
@@ -3,6 +3,7 @@
     <Bottlenecks v-if="contextBoxContent === 'bottlenecks'" />
     <Staging v-if="contextBoxContent === 'staging'" />
     <Stretches v-if="contextBoxContent === 'stretches'" />
+    <Sections v-if="contextBoxContent === 'sections'" />
     <ImportOverview v-if="contextBoxContent === 'importoverview'" />
     <ImportConfiguration v-if="contextBoxContent === 'importconfiguration'" />
   </div>
@@ -29,6 +30,7 @@
   components: {
     Bottlenecks: () => import("@/components/Bottlenecks"),
     Stretches: () => import("@/components/stretches/Stretches"),
+    Sections: () => import("@/components/sections/Sections"),
     ImportOverview: () => import("@/components/importoverview/ImportOverview"),
     ImportConfiguration: () => import("@/components/importconfiguration/Import")
   },
--- a/client/src/router.js	Thu May 16 16:27:28 2019 +0200
+++ b/client/src/router.js	Thu May 16 16:33:29 2019 +0200
@@ -170,6 +170,26 @@
       }
     },
     {
+      path: "/sections",
+      name: "sections",
+      component: Main,
+      meta: {
+        requiresAuth: true
+      },
+      beforeEnter: (to, from, next) => {
+        const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
+        if (!isWaterwayAdmin) {
+          next("/login");
+        } else {
+          store.commit("application/searchQuery", "");
+          store.commit("application/showContextBox", true);
+          store.commit("application/contextBoxContent", "sections");
+          store.commit("application/showSearchbar", true);
+          next();
+        }
+      }
+    },
+    {
       path: "/fairwaydepth",
       name: "fairwaydepth",
       component: () => import("./components/fairway/AvailableFairwayDepth"),