# HG changeset patch # User Sascha L. Teichmann # Date 1552490829 -3600 # Node ID 53807c3a2de71a8e5faf0f645351c21348ea12f2 # Parent 3a242e6aa56dc89101012f6d4db9d6fcded1ba65# Parent 50cc5bffd7874a72c723428370bbfd0a9565a90a Merged. diff -r 3a242e6aa56d -r 53807c3a2de7 client/src/components/Popup.vue --- a/client/src/components/Popup.vue Wed Mar 13 16:26:51 2019 +0100 +++ b/client/src/components/Popup.vue Wed Mar 13 16:27:09 2019 +0100 @@ -10,7 +10,10 @@ :title="popup.title" :closeCallback="close" /> - +
@@ -41,8 +45,9 @@ * Thomas Junk */ -import { displayError } from "@/lib/errors.js"; import { mapState } from "vuex"; +import { displayError, displayInfo } from "@/lib/errors.js"; +import { STATES } from "@/store/imports.js"; export default { name: "importoverviewalt", @@ -73,6 +78,71 @@ message: `${status}: ${data.message || data}` }); }); + }, + save() { + if (!this.reviewed.length) return; + + let popupContent = ``; + this.reviewed.forEach(r => { + let imp = this.imports.find(i => i.id === r.id); + let approved = STATES.APPROVED === r.status; + popupContent += ` + + + + + `; + }); + popupContent += "
${imp.id}${imp.kind.toUpperCase()}${this.$options.filters.dateTime(imp.enqueued)} + ${this.$gettext(approved ? "approved" : "declined")} +
"; + + this.$store.commit("application/popup", { + icon: "clipboard-check", + title: this.$gettext("Finish Review"), + padding: false, + big: true, + content: popupContent, + confirm: { + icon: "check", + callback: () => { + let data = this.reviewed.map(r => ({ + id: r.id, + state: r.status + })); + this.$store + .dispatch("imports/confirmReview", data) + .then(response => { + this.loadLogs(); + const messages = response.data + .map(x => { + if (x.message) return x.message; + if (x.error) return x.error; + }) + .join("\n\n"); + displayInfo({ + title: "Staging Area", + message: messages, + options: { + timeout: 0, + buttons: [{ text: "Ok", action: null, bold: true }] + } + }); + }) + .catch(error => { + const { status, data } = error.response; + displayError({ + title: "Backend Error", + message: `${status}: ${data.message || data}` + }); + }); + } + }, + cancel: { + label: this.$gettext("Cancel"), + icon: "times" + } + }); } }, watch: {