Mercurial > gemma
comparison client/src/components/Sidebar.vue @ 3605:d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 05 Jun 2019 11:48:15 +0200 |
parents | 954f8b751fb0 |
children | 3eb19b38446e |
comparison
equal
deleted
inserted
replaced
3604:6248a4bc10c7 | 3605:d02d4e31491b |
---|---|
98 * Markus Kottländer <markus.kottlaender@intevation.de> | 98 * Markus Kottländer <markus.kottlaender@intevation.de> |
99 */ | 99 */ |
100 import { mapGetters, mapState } from "vuex"; | 100 import { mapGetters, mapState } from "vuex"; |
101 import { logOff } from "@/lib/session"; | 101 import { logOff } from "@/lib/session"; |
102 import { displayError } from "@/lib/errors"; | 102 import { displayError } from "@/lib/errors"; |
103 import { HTTP } from "@/lib/http"; | |
104 | 103 |
105 export default { | 104 export default { |
106 name: "sidebar", | 105 name: "sidebar", |
107 data() { | |
108 return { | |
109 stagingNotifications: null | |
110 }; | |
111 }, | |
112 computed: { | 106 computed: { |
113 ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), | 107 ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), |
114 ...mapState("user", ["user", "roles", "isAuthenticated"]), | 108 ...mapState("user", ["user", "roles", "isAuthenticated"]), |
109 ...mapState("imports", ["stagingNotifications"]), | |
115 ...mapState("application", [ | 110 ...mapState("application", [ |
116 "showSidebar", | 111 "showSidebar", |
117 "showSearchbarLastState", | 112 "showSearchbarLastState", |
118 "contextBoxContent", | 113 "contextBoxContent", |
119 "showContextBox" | 114 "showContextBox" |
148 } | 143 } |
149 }, | 144 }, |
150 mounted() { | 145 mounted() { |
151 const updateIndicators = () => { | 146 const updateIndicators = () => { |
152 if (this.isWaterwayAdmin) { | 147 if (this.isWaterwayAdmin) { |
153 this.$store; | 148 this.$store |
154 HTTP.get("/imports?states=pending&count=true", { | 149 .dispatch("imports/loadStagingNotifications") |
155 headers: { "X-Gemma-Auth": localStorage.getItem("token") } | 150 .then(() => { |
156 }) | |
157 .then(response => { | |
158 this.stagingNotifications = response.data; | |
159 if (this.isAuthenticated) { | 151 if (this.isAuthenticated) { |
160 setTimeout(updateIndicators, 15000); | 152 setTimeout(updateIndicators, 15000); |
161 } | 153 } |
162 }) | 154 }) |
163 .catch(error => { | 155 .catch(error => { |