Mercurial > gemma
diff client/src/components/fairway/BottleneckDialogue.vue @ 5572:3b842e951317 surveysperbottleneckid
change use from name of bottleneck to its id.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 20 Jul 2021 17:07:51 +0200 |
parents | 776e34886471 |
children | 271888ef85bc |
line wrap: on
line diff
--- a/client/src/components/fairway/BottleneckDialogue.vue Tue Jul 20 11:50:17 2021 +0200 +++ b/client/src/components/fairway/BottleneckDialogue.vue Tue Jul 20 17:07:51 2021 +0200 @@ -29,7 +29,7 @@ <option v-for="bn in bottlenecksForCountry" :key="bn.properties.id" - :value="bn.properties.name" + :value="bn.properties.bottleneck_id" > {{ bn.properties.name }} </option> @@ -373,7 +373,7 @@ isAllowedToDelete() { const userCountryCode = this.userCountries[this.user]; const bottleneck = this.bottlenecksList.find( - bn => bn.properties.name === this.selectedBottleneck + bn => bn.properties.bottleneck_id === this.selectedBottleneck ); if (!bottleneck) return; if (this.isWaterwayAdmin || this.isSysAdmin) { @@ -421,8 +421,11 @@ get() { return this.$store.state.bottlenecks.selectedBottleneck; }, - set(name) { - this.$store.dispatch("bottlenecks/setSelectedBottleneck", name); + set(bottleneck_id) { + this.$store.dispatch( + "bottlenecks/setSelectedBottleneck", + bottleneck_id + ); } }, selectedWaterLevel: { @@ -517,7 +520,7 @@ .getLayer("BOTTLENECKS") .getSource() .getFeatures() - .find(f => f.get("objnam") === this.selectedBottleneck) + .find(f => f.get("bottleneck_id") === this.selectedBottleneck) : null; } }, @@ -525,7 +528,7 @@ selectedBottleneck() { this.$store.dispatch("fairwayprofile/previousCuts"); this.cutLabel = - this.selectedBottleneck + " (" + new Date().toISOString() + ")"; + this.bottleneck.get("objnam") + " (" + new Date().toISOString() + ")"; }, selectedSurvey(survey) { this.loadProfile(survey); @@ -726,7 +729,8 @@ JSON.parse(localStorage.getItem("previousCuts")) || []; const newEntry = { label: this.cutLabel, - bottleneckName: this.selectedBottleneck, + bottleneckName: this.bottleneck.get("objnam"), + bottleneckId: this.bottleneck.get("bottleneck_id"), coordinates: [...this.startPoint, ...this.endPoint], timestamp: new Date().getTime(), depth: this.depth, @@ -739,7 +743,6 @@ if (previousCuts.length > 100) previousCuts.shift(); localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); this.$store.dispatch("fairwayprofile/previousCuts"); - this.showLabelInput = false; displayInfo({ title: this.$gettext("Profile saved!"), @@ -811,12 +814,12 @@ }, takeMeThere() { const bottleneck = this.bottlenecksList.find( - bn => bn.properties.name === this.selectedBottleneck + bn => bn.properties.bottleneck_id === this.selectedBottleneck ); if (!bottleneck) return; this.$store.commit( "bottlenecks/setBottleneckForPrint", - this.selectedBottleneck + bottleneck.properties.name ); this.$store.dispatch("map/moveToFeauture", { feature: bottleneck,