Mercurial > gemma
comparison client/src/router.js @ 1879:9a2fbeaabd52 dev-pdf-generation
merging in from branch default
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Tue, 15 Jan 2019 10:07:10 +0100 |
parents | 11669276e197 |
children | 733cfc3db48a |
comparison
equal
deleted
inserted
replaced
1878:f030182f82f1 | 1879:9a2fbeaabd52 |
---|---|
18 import store from "./store"; | 18 import store from "./store"; |
19 import { sessionStillActive, toMillisFromString } from "./lib/session"; | 19 import { sessionStillActive, toMillisFromString } from "./lib/session"; |
20 | 20 |
21 /* facilitate codesplitting */ | 21 /* facilitate codesplitting */ |
22 const Login = () => import("./components/Login.vue"); | 22 const Login = () => import("./components/Login.vue"); |
23 const Main = () => import("./components/Main.vue"); | |
24 const Usermanagement = () => | |
25 import("./components/usermanagement/Usermanagement.vue"); | |
26 const Logs = () => import("./components/Logs.vue"); | |
27 const Importqueue = () => import("./components/importqueue/Importqueue.vue"); | |
28 const Importschedule = () => | |
29 import("./components/importschedule/Importschedule.vue"); | |
30 const Systemconfiguration = () => | |
31 import("./components/Systemconfiguration.vue"); | |
32 const Importsoundingresults = () => | |
33 import("./components/ImportSoundingresults.vue"); | |
34 | |
35 const Importstretches = () => import("./components/ImportStretches.vue"); | |
36 | 23 |
37 Vue.use(Router); | 24 Vue.use(Router); |
38 | 25 |
39 const router = new Router({ | 26 const router = new Router({ |
40 routes: [ | 27 routes: [ |
44 component: Login | 31 component: Login |
45 }, | 32 }, |
46 { | 33 { |
47 path: "/usermanagement", | 34 path: "/usermanagement", |
48 name: "usermanagement", | 35 name: "usermanagement", |
49 component: Usermanagement, | 36 component: () => import("./components/usermanagement/Usermanagement.vue"), |
50 meta: { | 37 meta: { |
51 requiresAuth: true | 38 requiresAuth: true |
52 }, | 39 }, |
53 beforeEnter: (to, from, next) => { | 40 beforeEnter: (to, from, next) => { |
54 const isSysadmin = store.getters["user/isSysAdmin"]; | 41 const isSysadmin = store.getters["user/isSysAdmin"]; |
60 } | 47 } |
61 }, | 48 }, |
62 { | 49 { |
63 path: "/logs", | 50 path: "/logs", |
64 name: "logs", | 51 name: "logs", |
65 component: Logs, | 52 component: () => import("./components/Logs.vue"), |
66 meta: { | 53 meta: { |
67 requiresAuth: true | 54 requiresAuth: true |
68 }, | 55 }, |
69 beforeEnter: (to, from, next) => { | 56 beforeEnter: (to, from, next) => { |
70 const isSysadmin = store.getters["user/isSysAdmin"]; | 57 const isSysadmin = store.getters["user/isSysAdmin"]; |
76 } | 63 } |
77 }, | 64 }, |
78 { | 65 { |
79 path: "/systemconfiguration", | 66 path: "/systemconfiguration", |
80 name: "systemconfiguration", | 67 name: "systemconfiguration", |
81 component: Systemconfiguration, | 68 component: () => import("./components/Systemconfiguration.vue"), |
82 meta: { | 69 meta: { |
83 requiresAuth: true | 70 requiresAuth: true |
84 }, | 71 }, |
85 beforeEnter: (to, from, next) => { | 72 beforeEnter: (to, from, next) => { |
86 const isSysadmin = store.getters["user/isSysAdmin"]; | 73 const isSysadmin = store.getters["user/isSysAdmin"]; |
91 } | 78 } |
92 } | 79 } |
93 }, | 80 }, |
94 { | 81 { |
95 path: "/importqueue", | 82 path: "/importqueue", |
83 name: "importqueues", | |
84 component: () => import("./components/importqueue/Importqueue.vue"), | |
85 meta: { | |
86 requiresAuth: true | |
87 }, | |
88 beforeEnter: (to, from, next) => { | |
89 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; | |
90 if (!isWaterwayAdmin) { | |
91 next("/"); | |
92 } else { | |
93 next(); | |
94 } | |
95 } | |
96 }, | |
97 { | |
98 path: "/importqueue/:id", | |
96 name: "importqueue", | 99 name: "importqueue", |
97 component: Importqueue, | 100 component: () => import("./components/importqueue/Importqueue.vue"), |
98 meta: { | 101 meta: { |
99 requiresAuth: true | 102 requiresAuth: true |
100 }, | 103 }, |
101 beforeEnter: (to, from, next) => { | 104 beforeEnter: (to, from, next) => { |
102 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; | 105 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; |
108 } | 111 } |
109 }, | 112 }, |
110 { | 113 { |
111 path: "/importsoundingresults", | 114 path: "/importsoundingresults", |
112 name: "importsoundingresults", | 115 name: "importsoundingresults", |
113 component: Importsoundingresults, | 116 component: () => import("./components/ImportSoundingresults.vue"), |
114 meta: { | 117 meta: { |
115 requiresAuth: true | 118 requiresAuth: true |
116 }, | 119 }, |
117 beforeEnter: (to, from, next) => { | 120 beforeEnter: (to, from, next) => { |
118 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; | 121 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; |
119 if (!isWaterwayAdmin) { | 122 if (!isWaterwayAdmin) { |
120 next("/"); | 123 next("/"); |
121 } else { | 124 } else { |
122 next(); | 125 next(); |
123 } | 126 } |
124 } | 127 } |
125 }, | 128 }, |
126 { | 129 { |
127 path: "/importstretches", | 130 path: "/importwaterwayprofiles", |
128 name: "importstretches", | 131 name: "waterwayprofiles", |
129 component: Importstretches, | 132 component: () => import("./components/ImportWaterwayProfiles"), |
133 meta: { | |
134 requiresAuth: true | |
135 }, | |
136 beforeEnter: (to, from, next) => { | |
137 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; | |
138 if (!isWaterwayAdmin) { | |
139 next("/"); | |
140 } else { | |
141 next(); | |
142 } | |
143 } | |
144 }, | |
145 { | |
146 path: "/importapprovedgaugemeasurement", | |
147 name: "approvedgaugemeasurement", | |
148 component: () => import("./components/ImportApprovedGaugeMeasurement"), | |
130 meta: { | 149 meta: { |
131 requiresAuth: true | 150 requiresAuth: true |
132 }, | 151 }, |
133 beforeEnter: (to, from, next) => { | 152 beforeEnter: (to, from, next) => { |
134 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; | 153 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; |
140 } | 159 } |
141 }, | 160 }, |
142 { | 161 { |
143 path: "/importschedule", | 162 path: "/importschedule", |
144 name: "importschedule", | 163 name: "importschedule", |
145 component: Importschedule, | 164 component: () => import("./components/importschedule/Importschedule.vue"), |
146 meta: { | 165 meta: { |
147 requiresAuth: true | 166 requiresAuth: true |
148 }, | 167 }, |
149 beforeEnter: (to, from, next) => { | 168 beforeEnter: (to, from, next) => { |
150 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; | 169 const isWaterwayAdmin = store.getters["user/isWaterwayAdmin"]; |
156 } | 175 } |
157 }, | 176 }, |
158 { | 177 { |
159 path: "/", | 178 path: "/", |
160 name: "mainview", | 179 name: "mainview", |
161 component: Main, | 180 component: () => import("./components/Main.vue"), |
162 meta: { | 181 meta: { |
163 requiresAuth: true | 182 requiresAuth: true |
164 }, | 183 }, |
165 beforeEnter: (to, from, next) => { | 184 beforeEnter: (to, from, next) => { |
166 const expiresFromPastSession = toMillisFromString( | 185 const expiresFromPastSession = toMillisFromString( |