Mercurial > gemma
changeset 4402:5e894e680e0d
dsr implemented in frontend
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 16 Sep 2019 16:59:01 +0200 |
parents | 9842812b92e0 |
children | 9c6c65a628a3 |
files | client/src/components/fairway/BottleneckDialogue.vue |
diffstat | 1 files changed, 23 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/BottleneckDialogue.vue Mon Sep 16 16:46:29 2019 +0200 +++ b/client/src/components/fairway/BottleneckDialogue.vue Mon Sep 16 16:59:01 2019 +0200 @@ -634,29 +634,31 @@ }); }, deleteSelectedSurvey() { - const surveyText = `${this.selectedBottleneck}: ${lib.surveyDate( - this.selectedSurvey.date_info - )}`; - this.$store.commit("application/popup", { - icon: "trash", - title: this.$gettext("Delete survey"), - content: - `<small><b>` + - this.$gettext("Do you really want to delete the survey:") + - `</b><br> - ${surveyText}</small>`, - confirm: { - label: this.$gettext("Delete"), - icon: "trash", - callback: () => { - displayInfo({ title: this.$gettext("Not implemented") }); - } + HTTP.post( + "/imports/dsr", + { + "bottleneck-id": this.selectedBottleneck, + "date-info": this.selectedSurvey.date_info }, - cancel: { - label: this.$gettext("Cancel"), - icon: "times" + { + headers: { "X-Gemma-Auth": localStorage.getItem("token") } } - }); + ) + .then(() => { + displayInfo({ + title: this.$gettext("Survey"), + message: + this.$gettext("Deleting ") + + `${this.selectedBottleneck}: ${this.selectedSurvey.date_info}` + }); + }) + .catch(error => { + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); }, deleteSelectedCut(cut) { this.$store.commit("application/popup", {