Mercurial > gemma
changeset 3183:f64cc98746a1
statistics: put selected feature in fairwaystore
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 07 May 2019 16:30:20 +0200 |
parents | 77fc44ad05e3 |
children | 1ba2a7d22fbb |
files | client/src/components/Statistics.vue client/src/store/fairway.js |
diffstat | 2 files changed, 25 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/Statistics.vue Tue May 07 16:20:15 2019 +0200 +++ b/client/src/components/Statistics.vue Tue May 07 16:30:20 2019 +0200 @@ -81,7 +81,6 @@ data() { return { type: this.$options.BOTTLENECKS, - selectedEntry: null, loading: false }; }, @@ -100,7 +99,7 @@ if (this.showProfiles) { this.$store.dispatch( "bottlenecks/setSelectedBottleneck", - this.selectedEntry.properties.name + this.selectedFairwayAvailabilityFeature.properties.name ); } } @@ -109,9 +108,9 @@ .getLayer("STRETCHES") .setVisible(true); } - if (this.selectedEntry) { + if (this.selectedFairwayAvailabilityFeature) { this.$store.dispatch("map/moveToFeauture", { - feature: this.selectedEntry, + feature: this.selectedFairwayAvailabilityFeature, zoom: 17, preventZoomOut: true }); @@ -121,14 +120,26 @@ const bn = this.bottlenecksList.filter( x => x.properties.name === this.selectedBottleneck )[0]; - this.selectedEntry = bn; + this.$store.commit("fairwayprofile/setSelectedFairwayAvailability", bn); } }, computed: { ...mapState("application", ["showStatistics", "paneSetup", "showProfiles"]), + ...mapState("fairwayprofile", ["selectedFairwayAvailabilityFeature"]), ...mapState("imports", ["stretches"]), ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]), ...mapGetters("map", ["openLayersMap"]), + selectedEntry: { + get() { + return this.selectedFairwayAvailabilityFeature; + }, + set(feature) { + this.$store.commit( + "fairwayprofile/setSelectedFairwayAvailability", + feature + ); + } + }, entries() { if (this.type === this.$options.BOTTLENECKS) return this.bottlenecksList; if (this.type === this.$options.STRETCHES) return this.stretches; @@ -154,7 +165,10 @@ if (this.type === this.$options.BOTTLENECKS && this.selectedBottleneck) { this.setSelectedBottleneck(); } else { - this.selectedEntry = null; + this.$store.commit( + "fairwayprofile/setSelectedFairwayAvailability", + null + ); } this.openLayersMap() .getLayer("STRETCHES")
--- a/client/src/store/fairway.js Tue May 07 16:20:15 2019 +0200 +++ b/client/src/store/fairway.js Tue May 07 16:30:20 2019 +0200 @@ -37,7 +37,8 @@ previousCuts: [], profileLoading: false, selectedCut: null, - differencesLoading: false + differencesLoading: false, + selectedFairwayAvailabilityFeature: null }; }; @@ -57,6 +58,9 @@ } }, mutations: { + setSelectedFairwayAvailability: (state, feature) => { + state.selectedFairwayAvailabilityFeature = feature; + }, additionalSurvey: (state, additionalSurvey) => { state.additionalSurvey = additionalSurvey; },