Mercurial > gemma
comparison client/src/components/importschedule/Importschedule.vue @ 2033:431f97fd873b unify_imports
importschedule: extracted to separate store
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 25 Jan 2019 11:09:21 +0100 |
parents | b43ee5f73c05 |
children | 41218dd386a9 |
comparison
equal
deleted
inserted
replaced
2032:15db4fb07af4 | 2033:431f97fd873b |
---|---|
136 this.getSchedules(); | 136 this.getSchedules(); |
137 }, | 137 }, |
138 methods: { | 138 methods: { |
139 editSchedule(id) { | 139 editSchedule(id) { |
140 this.$store | 140 this.$store |
141 .dispatch("imports/loadSchedule", id) | 141 .dispatch("importschedule/loadSchedule", id) |
142 .then(() => { | 142 .then(() => { |
143 this.$store.commit("imports/setImportScheduleDetailVisible"); | 143 this.$store.commit("importschedule/setImportScheduleDetailVisible"); |
144 }) | 144 }) |
145 .catch(error => { | 145 .catch(error => { |
146 const { status, data } = error.response; | 146 const { status, data } = error.response; |
147 displayError({ | 147 displayError({ |
148 title: this.$gettext("Backend Error"), | 148 title: this.$gettext("Backend Error"), |
168 message: `${status}: ${data.message || data}` | 168 message: `${status}: ${data.message || data}` |
169 }); | 169 }); |
170 }); | 170 }); |
171 }, | 171 }, |
172 getSchedules() { | 172 getSchedules() { |
173 this.$store.dispatch("imports/loadSchedules").catch(error => { | 173 this.$store.dispatch("importschedule/loadSchedules").catch(error => { |
174 const { status, data } = error.response; | 174 const { status, data } = error.response; |
175 displayError({ | 175 displayError({ |
176 title: this.$gettext("Backend Error"), | 176 title: this.$gettext("Backend Error"), |
177 message: `${status}: ${data.message || data}` | 177 message: `${status}: ${data.message || data}` |
178 }); | 178 }); |
179 }); | 179 }); |
180 }, | 180 }, |
181 newImport() { | 181 newImport() { |
182 this.$store.commit("imports/setImportScheduleDetailVisible"); | 182 this.$store.commit("importschedule/setImportScheduleDetailVisible"); |
183 }, | 183 }, |
184 deleteSchedule(index) { | 184 deleteSchedule(index) { |
185 if (this.importScheduleDetailVisible) return; | 185 if (this.importScheduleDetailVisible) return; |
186 this.$store | 186 this.$store |
187 .dispatch("imports/deleteSchedule", index) | 187 .dispatch("importschedule/deleteSchedule", index) |
188 .then(() => { | 188 .then(() => { |
189 this.getSchedules(); | 189 this.getSchedules(); |
190 displayInfo({ | 190 displayInfo({ |
191 title: this.$gettext("Imports"), | 191 title: this.$gettext("Imports"), |
192 message: this.$gettext("Deleted import: #") + index | 192 message: this.$gettext("Deleted import: #") + index |
201 }); | 201 }); |
202 } | 202 } |
203 }, | 203 }, |
204 computed: { | 204 computed: { |
205 ...mapState("application", ["showSidebar"]), | 205 ...mapState("application", ["showSidebar"]), |
206 ...mapState("imports", ["schedules", "importScheduleDetailVisible"]), | 206 ...mapState("importschedule", ["schedules", "importScheduleDetailVisible"]), |
207 activeStyle() { | 207 activeStyle() { |
208 const color = this.importScheduleDetailVisible ? "#aeaeae" : "#000000"; | 208 const color = this.importScheduleDetailVisible ? "#aeaeae" : "#000000"; |
209 return { color: color }; | 209 return { color: color }; |
210 }, | 210 }, |
211 spacerStyle() { | 211 spacerStyle() { |