# HG changeset patch # User Markus Kottlaender # Date 1551968356 -3600 # Node ID 3c17d401fbd486a8ccf68e5179db5100417645dc # Parent ad2a1d02ad1cc31e0f96aa0463771748ee5f343a client: cross profiles: moved waterlevel select to Profiles dialog aaaand also switched to the popup component as confirmation mechanism for deleting saved profiles diff -r ad2a1d02ad1c -r 3c17d401fbd4 client/src/assets/application.scss --- a/client/src/assets/application.scss Thu Mar 07 14:59:03 2019 +0100 +++ b/client/src/assets/application.scss Thu Mar 07 15:19:16 2019 +0100 @@ -170,3 +170,8 @@ font-size: 1.2rem; } } + +.form-control-sm.small { + padding: 0.25rem 0.1rem; + font-size: 80%; +} diff -r ad2a1d02ad1c -r 3c17d401fbd4 client/src/components/fairway/Fairwayprofile.vue --- a/client/src/components/fairway/Fairwayprofile.vue Thu Mar 07 14:59:03 2019 +0100 +++ b/client/src/components/fairway/Fairwayprofile.vue Thu Mar 07 15:19:16 2019 +0100 @@ -4,29 +4,6 @@
-
- - Available Waterlevels: - Waterlevel: - - - {{ formatSurveyDate(currentLevel) }} -
+ + + +
+
+ Survey: +
Enter coordinates manually: @@ -249,8 +253,7 @@ return { coordinatesInput: "", cutLabel: "", - showLabelInput: false, - confirmDeleteSelectedCut: false + showLabelInput: false }; }, computed: { @@ -266,7 +269,8 @@ "previousCuts", "startPoint", "endPoint", - "profileLoading" + "profileLoading", + "waterLevels" ]), selectedBottleneck: { get() { @@ -280,6 +284,14 @@ }); } }, + selectedWaterLevel: { + get() { + return this.$store.state.fairwayprofile.selectedWaterLevel.date || ""; + }, + set(value) { + this.$store.commit("fairwayprofile/setSelectedWaterLevel", value); + } + }, selectedSurvey: { get() { return this.$store.state.bottlenecks.selectedSurvey; @@ -346,7 +358,6 @@ }, selectedCut(cut) { if (cut) { - this.confirmDeleteSelectedCut = false; this.applyCoordinates(cut.coordinates); } } @@ -376,7 +387,6 @@ }, onCopyCoordinates() { displayInfo({ - title: this.$gettext("Success"), message: this.$gettext("Coordinates copied to clipboard!") }); }, @@ -443,15 +453,34 @@ ) }); }, - deleteSelectedCut() { - let previousCuts = JSON.parse(localStorage.getItem("previousCuts")) || []; - previousCuts = previousCuts.filter(cut => { - return JSON.stringify(cut) !== JSON.stringify(this.selectedCut); + deleteSelectedCut(cut) { + this.$store.commit("application/popup", { + icon: "trash", + title: this.$gettext("Delete cross profile"), + content: + this.$gettext("Do you really want to delete the cross profile:") + + `
+ ${cut.label}`, + confirm: { + label: this.$gettext("Delete"), + icon: "trash", + callback: () => { + let previousCuts = + JSON.parse(localStorage.getItem("previousCuts")) || []; + previousCuts = previousCuts.filter(cut => { + return JSON.stringify(cut) !== JSON.stringify(this.selectedCut); + }); + localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); + this.$store.commit("fairwayprofile/selectedCut", null); + this.$store.dispatch("fairwayprofile/previousCuts"); + displayInfo({ title: this.$gettext("Profile deleted!") }); + } + }, + cancel: { + label: this.$gettext("Cancel"), + icon: "times" + } }); - localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); - this.$store.commit("fairwayprofile/selectedCut", null); - this.$store.dispatch("fairwayprofile/previousCuts"); - displayInfo({ title: this.$gettext("Profile deleted!") }); }, moveToBottleneck() { const bottleneck = this.bottlenecksList.find( diff -r ad2a1d02ad1c -r 3c17d401fbd4 client/src/store/fairway.js --- a/client/src/store/fairway.js Thu Mar 07 14:59:03 2019 +0100 +++ b/client/src/store/fairway.js Thu Mar 07 15:19:16 2019 +0100 @@ -78,10 +78,10 @@ // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats const entry = { date: when, - vaule: value + value: value }; - Vue.set(state.waterLevels, when, entry); - if (state.selectedWaterLevel === "") state.selectedWaterLevel = entry; + state.waterLevels = { [when]: entry }; + state.selectedWaterLevel = entry; Vue.set(state.currentProfile, surveyDate, { points: result.points, length: result.lengthPolyLine