comparison client/src/components/Sidebar.vue @ 2676:906e9a13592f

sidebar: only update staging info for appropriate usergroups
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 15 Mar 2019 11:14:21 +0100
parents 9f3856337f55
children bd615f978164
comparison
equal deleted inserted replaced
2674:b219ca1514f4 2676:906e9a13592f
164 stagingNotifications: null 164 stagingNotifications: null
165 }; 165 };
166 }, 166 },
167 computed: { 167 computed: {
168 ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), 168 ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]),
169 ...mapState("user", ["user"]), 169 ...mapState("user", ["user", "roles"]),
170 ...mapState("application", [ 170 ...mapState("application", [
171 "showSidebar", 171 "showSidebar",
172 "showSearchbarLastState", 172 "showSearchbarLastState",
173 "contextBoxContent", 173 "contextBoxContent",
174 "showContextBox" 174 "showContextBox"
200 this.contextBoxContent === item && 200 this.contextBoxContent === item &&
201 this.routeName == "mainview" 201 this.routeName == "mainview"
202 ); 202 );
203 }, 203 },
204 updateIndicators() { 204 updateIndicators() {
205 this.$store; 205 if (this.isWaterwayAdmin) {
206 HTTP.get("/imports?states=pending", { 206 this.$store;
207 headers: { "X-Gemma-Auth": localStorage.getItem("token") } 207 HTTP.get("/imports?states=pending", {
208 }) 208 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
209 .then(response => {
210 const { imports } = response.data;
211 this.stagingNotifications = imports.length;
212 }) 209 })
213 .catch(error => { 210 .then(response => {
214 const { status, data } = error.response; 211 const { imports } = response.data;
215 displayError({ 212 this.stagingNotifications = imports.length;
216 title: "Backend Error", 213 })
217 message: `${status}: ${data.message || data}` 214 .catch(error => {
215 const { status, data } = error.response;
216 displayError({
217 title: "Backend Error",
218 message: `${status}: ${data.message || data}`
219 });
218 }); 220 });
219 }); 221 }
220 } 222 }
221 }, 223 },
222 mounted() { 224 mounted() {
223 this.updateIndicators(); 225 this.updateIndicators();
224 setInterval(this.updateIndicators, 15000); 226 setInterval(this.updateIndicators, 15000);