# HG changeset patch # User Markus Kottlaender # Date 1558094889 -7200 # Node ID 70676557a66fd1ed66a85e2f74cfc4b9fe843b1c # Parent b01c2f4747703bc62d166199650b5553539de6da client: available fairway depth: cleanup component a bit diff -r b01c2f474770 -r 70676557a66f client/src/components/fairway/AvailableFairwayDepthDialogue.vue --- a/client/src/components/fairway/AvailableFairwayDepthDialogue.vue Fri May 17 14:07:16 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepthDialogue.vue Fri May 17 14:08:09 2019 +0200 @@ -9,9 +9,7 @@
-
+
@@ -31,111 +29,106 @@
-
- + +
+
+ + Type + + - -
-
-
-
- Type - -
-
- LOS - -
+ {{ option }} + + +
+
+ LOS +
-
-
- Date from -
-
- Date to -
+
+
+
+ + Date from + + +
+
+ + Date to + +
-
-
@@ -178,118 +171,6 @@ loading: false }; }, - methods: { - openFairwaydepthLNWL() { - this.loading = true; - this.$store - .dispatch("fairwayavailability/loadAvailableFairwayDepth", { - feature: this.selectedFairwayAvailabilityFeature, - from: this.from, - to: this.to, - frequency: this.frequency, - LOS: this.los - }) - .then(() => { - this.$store.commit( - "application/paneSetup", - "AVAILABLEFAIRWAYDEPTHLNWL" - ); - }) - .catch(error => { - console.log(error); - const { status, data } = error.response; - displayError({ - title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` - }); - }) - .finally(() => { - this.loading = false; - }); - }, - openFairwaydepth() { - this.loading = true; - this.$store - .dispatch("fairwayavailability/loadAvailableFairwayDepth", { - feature: this.selectedFairwayAvailabilityFeature, - from: this.from, - to: this.to, - frequency: this.frequency, - LOS: this.los - }) - .then(() => { - this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH"); - }) - .catch(error => { - console.log(error); - const { status, data } = error.response; - displayError({ - title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` - }); - }) - .finally(() => { - this.loading = false; - }); - }, - close() { - this.$store.commit("application/showFairwayDepth", false); - this.$store.commit("application/showFairwayDepthLNWL", false); - }, - entrySelected() { - if (this.type === this.$options.BOTTLENECKS) { - this.openLayersMap() - .getLayer("BOTTLENECKS") - .setVisible(true); - if (this.showProfiles) { - this.$store.dispatch( - "bottlenecks/setSelectedBottleneck", - this.selectedFairwayAvailabilityFeature.properties.name - ); - } - } - if (this.type === this.$options.STRETCHES) { - this.openLayersMap() - .getLayer("STRETCHES") - .setVisible(true); - } - if (this.type === this.$options.SECTIONS) { - this.openLayersMap() - .getLayer("SECTIONS") - .setVisible(true); - } - if (this.selectedFairwayAvailabilityFeature) { - this.$store.dispatch("map/moveToFeauture", { - feature: this.selectedFairwayAvailabilityFeature, - zoom: 17, - preventZoomOut: true - }); - } - }, - setSelectedBottleneck() { - const bn = this.bottlenecksList.filter( - x => x.properties.name === this.selectedBottleneck - )[0]; - this.$store.commit( - "fairwayavailability/setSelectedFairwayAvailability", - bn - ); - }, - setSelectedStretch() { - const stretch = this.stretches.find(x => x.id === this.selectedStretchId); - this.$store.commit( - "fairwayavailability/setSelectedFairwayAvailability", - stretch - ); - }, - setSelectedSection() { - const section = this.sections.find(x => x.id === this.selectedSectionId); - this.$store.commit( - "fairwayavailability/setSelectedFairwayAvailability", - section - ); - } - }, computed: { ...mapState("application", [ "showFairwayDepth", @@ -394,21 +275,26 @@ this.type = this.$options.BOTTLENECKS; this.setSelectedBottleneck(); }, - type() { - if (this.type === this.$options.BOTTLENECKS && this.selectedBottleneck) { + selectedStretchId() { + this.type = this.$options.STRETCHES; + this.setSelectedStretch(); + }, + selectedSectionId() { + this.type = this.$options.SECTIONS; + this.setSelectedSection(); + }, + type(type) { + if (type === this.$options.BOTTLENECKS && this.selectedBottleneck) { + this.openLayersMap() + .getLayer("BOTTLENECKS") + .setVisible(true); this.setSelectedBottleneck(); - } else if ( - this.type === this.$options.STRETCHES && - this.selectedStretchId - ) { + } else if (type === this.$options.STRETCHES && this.selectedStretchId) { this.openLayersMap() .getLayer("STRETCHES") .setVisible(true); this.setSelectedStretch(); - } else if ( - this.type === this.$options.SECTIONS && - this.selectedSectionId - ) { + } else if (type === this.$options.SECTIONS && this.selectedSectionId) { this.openLayersMap() .getLayer("SECTIONS") .setVisible(true); @@ -435,6 +321,118 @@ } } }, + methods: { + openFairwaydepthLNWLDiagram() { + this.loading = true; + this.$store + .dispatch("fairwayavailability/loadAvailableFairwayDepth", { + feature: this.selectedFairwayAvailabilityFeature, + from: this.from, + to: this.to, + frequency: this.frequency, + LOS: this.los + }) + .then(() => { + this.$store.commit( + "application/paneSetup", + "AVAILABLEFAIRWAYDEPTHLNWL" + ); + }) + .catch(error => { + console.log(error); + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }) + .finally(() => { + this.loading = false; + }); + }, + openFairwaydepthDiagram() { + this.loading = true; + this.$store + .dispatch("fairwayavailability/loadAvailableFairwayDepth", { + feature: this.selectedFairwayAvailabilityFeature, + from: this.from, + to: this.to, + frequency: this.frequency, + LOS: this.los + }) + .then(() => { + this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH"); + }) + .catch(error => { + console.log(error); + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }) + .finally(() => { + this.loading = false; + }); + }, + close() { + this.$store.commit("application/showFairwayDepth", false); + this.$store.commit("application/showFairwayDepthLNWL", false); + }, + entrySelected() { + if (this.type === this.$options.BOTTLENECKS) { + this.openLayersMap() + .getLayer("BOTTLENECKS") + .setVisible(true); + if (this.showProfiles) { + this.$store.dispatch( + "bottlenecks/setSelectedBottleneck", + this.selectedFairwayAvailabilityFeature.properties.name + ); + } + } + if (this.type === this.$options.STRETCHES) { + this.openLayersMap() + .getLayer("STRETCHES") + .setVisible(true); + } + if (this.type === this.$options.SECTIONS) { + this.openLayersMap() + .getLayer("SECTIONS") + .setVisible(true); + } + if (this.selectedFairwayAvailabilityFeature) { + this.$store.dispatch("map/moveToFeauture", { + feature: this.selectedFairwayAvailabilityFeature, + zoom: 17, + preventZoomOut: true + }); + } + }, + setSelectedBottleneck() { + const bn = this.bottlenecksList.filter( + x => x.properties.name === this.selectedBottleneck + )[0]; + this.$store.commit( + "fairwayavailability/setSelectedFairwayAvailability", + bn + ); + }, + setSelectedStretch() { + const stretch = this.stretches.find(x => x.id === this.selectedStretchId); + this.$store.commit( + "fairwayavailability/setSelectedFairwayAvailability", + stretch + ); + }, + setSelectedSection() { + const section = this.sections.find(x => x.id === this.selectedSectionId); + this.$store.commit( + "fairwayavailability/setSelectedFairwayAvailability", + section + ); + } + }, BOTTLENECKS: "bottlenecks", SECTIONS: "sections", STRETCHES: "stretches",