annotate client/src/router.js @ 2413:f39c4b432601 staging_consolidation

merge with default
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 28 Feb 2019 12:29:46 +0100
parents e120631797f6 0ed53a7a1221
children 706121185e63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1296
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
2 * without warranty, see README.md and license for details.
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
3 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
6 *
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
7 * Copyright (C) 2018 by via donau
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
9 * Software engineering by Intevation GmbH
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
10 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
11 * Author(s):
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
12 * Thomas Junk <thomas.junk@intevation.de>
1363
d0c4d17ee7ab add missing authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1362
diff changeset
13 * Bernhard Reiter <bernhard@intevation.de>
d0c4d17ee7ab add missing authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1362
diff changeset
14 * Markus Kottländer <markus@intevation.de>
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 853
diff changeset
15 */
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 import Vue from "vue";
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 import Router from "vue-router";
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 import store from "./store";
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents: 1244
diff changeset
19 import { sessionStillActive, toMillisFromString } from "./lib/session";
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20
483
27502291e564 docs: Added comments on non trivial parts of the code
Thomas Junk <thomas.junk@intevation.de>
parents: 466
diff changeset
21 /* facilitate codesplitting */
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents: 1244
diff changeset
22 const Login = () => import("./components/Login.vue");
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
23 const Main = () => import("./components/Main.vue");
466
e3035621cc52 refac: Small improvement of loading time with code splitting
Thomas Junk <thomas.junk@intevation.de>
parents: 285
diff changeset
24
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 Vue.use(Router);
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 const router = new Router({
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 routes: [
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 {
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
30 path: "/login",
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 name: "login",
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 component: Login
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 },
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 {
581
fb5d9d5ff320 refac: UI redesign
Thomas Junk <thomas.junk@intevation.de>
parents: 483
diff changeset
35 path: "/usermanagement",
fb5d9d5ff320 refac: UI redesign
Thomas Junk <thomas.junk@intevation.de>
parents: 483
diff changeset
36 name: "usermanagement",
1671
89b38d7e7b6a included bundleanalyzer buildstep
Thomas Junk <thomas.junk@intevation.de>
parents: 1610
diff changeset
37 component: () => import("./components/usermanagement/Usermanagement.vue"),
278
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
38 meta: {
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
39 requiresAuth: true
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
40 },
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
41 beforeEnter: (to, from, next) => {
285
8e22d1f16f81 refactor: better variable naming
Thomas Junk <thomas.junk@intevation.de>
parents: 284
diff changeset
42 const isSysadmin = store.getters["user/isSysAdmin"];
284
96860b2bbc0d fix: User management only for sysadmin
Thomas Junk <thomas.junk@intevation.de>
parents: 278
diff changeset
43 if (!isSysadmin) {
278
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
44 next("/");
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
45 } else {
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
46 next();
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
47 }
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
48 }
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
49 },
9c1dfadb53aa feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents: 165
diff changeset
50 {
713
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
51 path: "/logs",
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
52 name: "logs",
1671
89b38d7e7b6a included bundleanalyzer buildstep
Thomas Junk <thomas.junk@intevation.de>
parents: 1610
diff changeset
53 component: () => import("./components/Logs.vue"),
713
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
54 meta: {
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
55 requiresAuth: true
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
56 },
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
57 beforeEnter: (to, from, next) => {
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
58 const isSysadmin = store.getters["user/isSysAdmin"];
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
59 if (!isSysadmin) {
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
60 next("/");
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
61 } else {
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
62 next();
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
63 }
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
64 }
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
65 },
badbc0207418 feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents: 592
diff changeset
66 {
853
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
67 path: "/systemconfiguration",
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
68 name: "systemconfiguration",
2212
733cfc3db48a started pdf template administration
Markus Kottlaender <markus@intevation.de>
parents: 1801
diff changeset
69 component: () =>
733cfc3db48a started pdf template administration
Markus Kottlaender <markus@intevation.de>
parents: 1801
diff changeset
70 import("./components/systemconfiguration/Systemconfiguration.vue"),
853
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
71 meta: {
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
72 requiresAuth: true
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
73 },
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
74 beforeEnter: (to, from, next) => {
2277
5f3110aa1ad1 made configuration page accessible for waterway admins
Markus Kottlaender <markus@intevation.de>
parents: 2212
diff changeset
75 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
5f3110aa1ad1 made configuration page accessible for waterway admins
Markus Kottlaender <markus@intevation.de>
parents: 2212
diff changeset
76 if (!isWaterwayAdmin) {
853
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
77 next("/");
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
78 } else {
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
79 next();
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
80 }
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
81 }
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
82 },
fb39ec3b95a8 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 713
diff changeset
83 {
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
84 path: "/importqueue/:id?",
1793
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
85 name: "importqueue",
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
86 component: () => import("./components/importqueue/Importqueue.vue"),
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
87 meta: {
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
88 requiresAuth: true
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
89 },
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
90 beforeEnter: (to, from, next) => {
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
91 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
92 if (!isWaterwayAdmin) {
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
93 next("/");
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
94 } else {
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
95 next();
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
96 }
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
97 }
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
98 },
c0532a94a0b5 importlog links forward to the according importqueue-entry
Thomas Junk <thomas.junk@intevation.de>
parents: 1753
diff changeset
99 {
1607
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
100 path: "/importsoundingresults",
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
101 name: "importsoundingresults",
1671
89b38d7e7b6a included bundleanalyzer buildstep
Thomas Junk <thomas.junk@intevation.de>
parents: 1610
diff changeset
102 component: () => import("./components/ImportSoundingresults.vue"),
1607
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
103 meta: {
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
104 requiresAuth: true
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
105 },
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
106 beforeEnter: (to, from, next) => {
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
107 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
108 if (!isWaterwayAdmin) {
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
109 next("/");
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
110 } else {
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
111 next();
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
112 }
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
113 }
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
114 },
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1559
diff changeset
115 {
1753
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
116 path: "/importwaterwayprofiles",
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
117 name: "waterwayprofiles",
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
118 component: () => import("./components/ImportWaterwayProfiles"),
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
119 meta: {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
120 requiresAuth: true
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
121 },
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
122 beforeEnter: (to, from, next) => {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
123 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
124 if (!isWaterwayAdmin) {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
125 next("/");
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
126 } else {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
127 next();
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
128 }
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
129 }
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
130 },
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
131 {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
132 path: "/importapprovedgaugemeasurement",
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
133 name: "approvedgaugemeasurement",
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
134 component: () => import("./components/ImportApprovedGaugeMeasurement"),
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
135 meta: {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
136 requiresAuth: true
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
137 },
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
138 beforeEnter: (to, from, next) => {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
139 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
140 if (!isWaterwayAdmin) {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
141 next("/");
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
142 } else {
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
143 next();
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
144 }
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
145 }
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
146 },
68bd990dd8e5 feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents: 1671
diff changeset
147 {
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
148 path: "/importschedule",
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
149 name: "importschedule",
1671
89b38d7e7b6a included bundleanalyzer buildstep
Thomas Junk <thomas.junk@intevation.de>
parents: 1610
diff changeset
150 component: () => import("./components/importschedule/Importschedule.vue"),
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
151 meta: {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
152 requiresAuth: true
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
153 },
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
154 beforeEnter: (to, from, next) => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1363
diff changeset
155 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
156 if (!isWaterwayAdmin) {
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
157 next("/");
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
158 } else {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
159 next();
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
160 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
161 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
162 },
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents: 1122
diff changeset
163 {
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
164 path: "/",
30
7ba0a77fd679 ol component added
Thomas Junk <thomas.junk@intevation.de>
parents: 13
diff changeset
165 name: "mainview",
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
166 component: Main,
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
167 meta: {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
168 requiresAuth: true
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
169 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
170 beforeEnter: (to, from, next) => {
2412
0ed53a7a1221 login fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 2409
diff changeset
171 store.commit("application/searchQuery", "");
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
172 store.commit("application/showContextBox", false);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
173 store.commit("application/contextBoxContent", "");
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
174 store.commit("application/showSearchbar", false);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
175 next();
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
176 }
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
177 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
178 {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
179 path: "/bottlenecks",
2378
c69432c1c4ac router: fixed frontend routing. renamed routes. changed display according to new route names
Thomas Junk <thomas.junk@intevation.de>
parents: 2329
diff changeset
180 name: "bottlenecks",
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
181 component: Main,
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
182 meta: {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
183 requiresAuth: true
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
184 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
185 beforeEnter: (to, from, next) => {
2412
0ed53a7a1221 login fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 2409
diff changeset
186 store.commit("application/searchQuery", "");
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
187 store.commit("application/showContextBox", true);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
188 store.commit("application/contextBoxContent", "bottlenecks");
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
189 store.commit("application/showSearchbar", true);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
190 next();
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
191 }
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
192 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
193 {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
194 path: "/review/:id?",
2378
c69432c1c4ac router: fixed frontend routing. renamed routes. changed display according to new route names
Thomas Junk <thomas.junk@intevation.de>
parents: 2329
diff changeset
195 name: "review",
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
196 component: Main,
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
197 meta: {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
198 requiresAuth: true
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
199 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
200 beforeEnter: (to, from, next) => {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
201 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
202 if (!isWaterwayAdmin) {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
203 next("/");
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
204 } else {
2412
0ed53a7a1221 login fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 2409
diff changeset
205 store.commit("application/searchQuery", "");
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
206 store.commit("application/showContextBox", true);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
207 store.commit("application/contextBoxContent", "staging");
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
208 store.commit("application/showSearchbar", true);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
209 next();
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
210 }
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
211 }
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
212 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
213 {
2399
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
214 path: "/imports/overview/:id?",
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
215 name: "importoverview",
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
216 component: Main,
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
217 meta: {
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
218 requiresAuth: true
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
219 },
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
220 beforeEnter: (to, from, next) => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
221 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"];
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
222 if (!isWaterwayAdmin) {
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
223 next("/");
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
224 } else {
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
225 store.commit("application/showContextBox", true);
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
226 store.commit("application/contextBoxContent", "importoverview");
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
227 store.commit("application/showSearchbar", true);
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
228 next();
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
229 }
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
230 }
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
231 },
Thomas Junk <thomas.junk@intevation.de>
parents: 2378
diff changeset
232 {
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
233 path: "/stretches",
2378
c69432c1c4ac router: fixed frontend routing. renamed routes. changed display according to new route names
Thomas Junk <thomas.junk@intevation.de>
parents: 2329
diff changeset
234 name: "stretches",
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
235 component: Main,
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
236 meta: {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
237 requiresAuth: true
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
238 },
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
239 beforeEnter: (to, from, next) => {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
240 const isSysadmin = store.getters["user/isSysAdmin"];
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
241 if (!isSysadmin) {
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
242 next("/");
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
243 } else {
2412
0ed53a7a1221 login fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 2409
diff changeset
244 store.commit("application/searchQuery", "");
2329
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
245 store.commit("application/showContextBox", true);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
246 store.commit("application/contextBoxContent", "stretches");
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
247 store.commit("application/showSearchbar", true);
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
248 next();
514193fd0120 refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
Thomas Junk <thomas.junk@intevation.de>
parents: 2328
diff changeset
249 }
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
250 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
251 },
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
252 {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
253 path: "*",
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
254 component: Login
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
255 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
256 ]
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
257 });
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
258
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
259 router.beforeEach((to, from, next) => {
165
4bf2173748f3 refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents: 162
diff changeset
260 const expiresFromPastSession = toMillisFromString(
4bf2173748f3 refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents: 162
diff changeset
261 localStorage.getItem("expires")
4bf2173748f3 refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents: 162
diff changeset
262 );
2328
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
263 if (sessionStillActive(expiresFromPastSession)) {
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
264 store.commit("user/setUser", localStorage.getItem("user"));
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
265 store.commit("user/setExpires", expiresFromPastSession);
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
266 store.commit("user/setRoles", localStorage.getItem("roles"));
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
267 store.commit("user/setIsAuthenticate", true);
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
268 } else {
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
269 store.commit("reset");
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
270 store.commit("user/clearAuth");
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
271 }
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
272 const requiresAuth = to.matched.some(record => record.meta.requiresAuth);
c98491f9c466 router: cleanup auth code
Thomas Junk <thomas.junk@intevation.de>
parents: 2277
diff changeset
273 const loggedIn = store.state.user.isAuthenticated;
162
9908260d1e6a Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents: 160
diff changeset
274 const authRequired =
9908260d1e6a Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents: 160
diff changeset
275 requiresAuth && !(loggedIn || sessionStillActive(expiresFromPastSession));
9908260d1e6a Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents: 160
diff changeset
276 if (authRequired) {
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
277 next("/login");
162
9908260d1e6a Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents: 160
diff changeset
278 } else if (!authRequired) {
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
279 next();
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
280 } else {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
281 next();
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
282 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
283 });
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
284
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
285 export default router;