# HG changeset patch # User Thomas Junk # Date 1568645941 -7200 # Node ID 5e894e680e0d2d3c2ebecd2d09cec306821db02f # Parent 9842812b92e08f811c36e0ed974feca8cad06e29 dsr implemented in frontend diff -r 9842812b92e0 -r 5e894e680e0d client/src/components/fairway/BottleneckDialogue.vue --- 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: - `` + - this.$gettext("Do you really want to delete the survey:") + - `
- ${surveyText}
`, - 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", {