# HG changeset patch # User Markus Kottlaender # Date 1552406887 -3600 # Node ID 85f9bf4a6ebab4ab5b81ac97231f71a8a6f72b8c # Parent 8d767359fddb33c9a297ab1934be047a99f50799 client: gauge waterlevel diagram: draw reference waterlevels diff -r 8d767359fddb -r 85f9bf4a6eba client/src/components/gauge/Gauges.vue --- a/client/src/components/gauge/Gauges.vue Tue Mar 12 16:16:43 2019 +0100 +++ b/client/src/components/gauge/Gauges.vue Tue Mar 12 17:08:07 2019 +0100 @@ -20,7 +20,7 @@ -
+

Time period: @@ -90,7 +90,7 @@ * Author(s): * Markus Kottländer */ -import { mapState } from "vuex"; +import { mapState, mapGetters } from "vuex"; export default { data() { @@ -101,13 +101,14 @@ }, computed: { ...mapState("application", ["showGauges"]), - ...mapState("gauges", ["gauges", "selectedGauge"]), - selectedGauge: { + ...mapState("gauges", ["gauges"]), + ...mapGetters("gauges", ["selectedGauge"]), + selectedGaugeName: { get() { - return this.$store.state.gauges.selectedGauge; + return this.$store.state.gauges.selectedGaugeName; }, set(name) { - this.$store.dispatch("gauges/selectedGauge", name); + this.$store.dispatch("gauges/selectedGaugeName", name); } } }, @@ -116,34 +117,27 @@ this.$store.commit("application/showGauges", false); }, moveToGauge() { - let gauge = this.gauges.find( - g => g.properties.objname === this.selectedGauge - ); - if (!gauge) return; + if (!this.selectedGauge) return; this.$store.commit("map/moveToExtent", { - feature: gauge, + feature: this.selectedGauge, zoom: 17, preventZoomOut: true }); }, showWaterlevelDiagram() { - let gauge = this.gauges.find( - g => g.properties.objname === this.selectedGauge - ); - // configure splitscreen let splitscreenConf = { id: "gauge-waterlevel", component: "waterlevel", - title: this.selectedGauge, + title: this.selectedGaugeName, icon: "ruler-vertical", closeCallback: () => { - this.$store.commit("gauges/selectedGauge", null); + this.$store.commit("gauges/selectedGaugeName", null); this.$store.commit("gauges/waterlevels", []); }, expandCallback: () => { this.$store.commit("map/moveMap", { - coordinates: gauge.geometry.coordinates, + coordinates: this.selectedGauge.geometry.coordinates, zoom: 17, preventZoomOut: true }); diff -r 8d767359fddb -r 85f9bf4a6eba client/src/components/gauge/Waterlevel.vue --- a/client/src/components/gauge/Waterlevel.vue Tue Mar 12 16:16:43 2019 +0100 +++ b/client/src/components/gauge/Waterlevel.vue Tue Mar 12 17:08:07 2019 +0100 @@ -4,16 +4,30 @@