Mercurial > gemma
comparison client/src/components/fairway/AvailableFairwayDepthDialogue.vue @ 3272:a9d047ccf408
client: fairway availability: set stretch in dialog when selecting stretch from map/list
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Wed, 15 May 2019 14:54:53 +0200 |
parents | 94e966ebef35 |
children | 5f0c6e931e7f |
comparison
equal
deleted
inserted
replaced
3271:b74e9768231d | 3272:a9d047ccf408 |
---|---|
179 to: this.to, | 179 to: this.to, |
180 frequency: this.frequency, | 180 frequency: this.frequency, |
181 LOS: this.los | 181 LOS: this.los |
182 }) | 182 }) |
183 .then(() => { | 183 .then(() => { |
184 this.loading = false; | |
185 this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH"); | 184 this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH"); |
186 }) | 185 }) |
187 .catch(error => { | 186 .catch(error => { |
188 console.log(error); | 187 console.log(error); |
189 const { status, data } = error.response; | 188 const { status, data } = error.response; |
190 displayError({ | 189 displayError({ |
191 title: this.$gettext("Backend Error"), | 190 title: this.$gettext("Backend Error"), |
192 message: `${status}: ${data.message || data}` | 191 message: `${status}: ${data.message || data}` |
193 }); | 192 }); |
193 }) | |
194 .finally(() => { | |
195 this.loading = false; | |
194 }); | 196 }); |
195 }, | 197 }, |
196 close() { | 198 close() { |
197 this.$store.commit("application/showFairwayDepth", false); | 199 this.$store.commit("application/showFairwayDepth", false); |
198 }, | 200 }, |
226 x => x.properties.name === this.selectedBottleneck | 228 x => x.properties.name === this.selectedBottleneck |
227 )[0]; | 229 )[0]; |
228 this.$store.commit( | 230 this.$store.commit( |
229 "fairwayavailability/setSelectedFairwayAvailability", | 231 "fairwayavailability/setSelectedFairwayAvailability", |
230 bn | 232 bn |
233 ); | |
234 }, | |
235 setSelectedStretch() { | |
236 const stretch = this.stretches.find(x => x.id === this.selectedStretchId); | |
237 this.$store.commit( | |
238 "fairwayavailability/setSelectedFairwayAvailability", | |
239 stretch | |
231 ); | 240 ); |
232 } | 241 } |
233 }, | 242 }, |
234 computed: { | 243 computed: { |
235 ...mapState("application", [ | 244 ...mapState("application", [ |
242 "from", | 251 "from", |
243 "to", | 252 "to", |
244 "frequency", | 253 "frequency", |
245 "LOS" | 254 "LOS" |
246 ]), | 255 ]), |
247 ...mapState("imports", ["stretches"]), | 256 ...mapState("imports", ["stretches", "selectedStretchId"]), |
248 ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]), | 257 ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]), |
249 ...mapGetters("map", ["openLayersMap"]), | 258 ...mapGetters("map", ["openLayersMap"]), |
250 ...mapGetters("bottlenecks", ["orderedBottlenecks"]), | 259 ...mapGetters("bottlenecks", ["orderedBottlenecks"]), |
251 isComplete() { | 260 isComplete() { |
252 return ( | 261 return ( |
330 this.setSelectedBottleneck(); | 339 this.setSelectedBottleneck(); |
331 }, | 340 }, |
332 type() { | 341 type() { |
333 if (this.type === this.$options.BOTTLENECKS && this.selectedBottleneck) { | 342 if (this.type === this.$options.BOTTLENECKS && this.selectedBottleneck) { |
334 this.setSelectedBottleneck(); | 343 this.setSelectedBottleneck(); |
344 } else if ( | |
345 this.type === this.$options.STRETCHES && | |
346 this.selectedStretchId | |
347 ) { | |
348 this.setSelectedStretch(); | |
335 } else { | 349 } else { |
336 this.$store.commit( | 350 this.$store.commit( |
337 "fairwayavailability/setSelectedFairwayAvailability", | 351 "fairwayavailability/setSelectedFairwayAvailability", |
338 null | 352 null |
339 ); | 353 ); |