Mercurial > gemma
changeset 1475:2365acde39dc bulkreview
Staging area: Dealing with backend response.
The messages are now concatenated in the info toast.
Because the information is a bit dense for digestion, I
bought an okay-button and made the dialog stay.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 30 Nov 2018 12:50:18 +0100 |
parents | e94f3074f14c |
children | ccf9fd7ff0bd |
files | client/src/components/map/contextbox/Staging.vue client/src/lib/errors.js client/src/store/imports.js |
diffstat | 3 files changed, 32 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/map/contextbox/Staging.vue Fri Nov 30 09:45:53 2018 +0100 +++ b/client/src/components/map/contextbox/Staging.vue Fri Nov 30 12:50:18 2018 +0100 @@ -120,27 +120,35 @@ }); }, confirmReview() { - const reviewResults = this.staging.map(r => { - return { - id: r.id, - state: r.status - }; - }); + const reviewResults = this.staging + .filter(x => x.status !== STATES.NEEDSAPPROVAL) + .map(r => { + return { + id: r.id, + state: r.status + }; + }); + if (!reviewResults.length) return; HTTP.patch("/imports", reviewResults, { headers: { "X-Gemma-Auth": localStorage.getItem("token"), "Content-type": "application/json" } }) - .then(() => { - const message = this.staging + .then(response => { + const messages = response.data .map(x => { - return x.id + ": " + x.status; + if (x.message) return x.message; + if (x.error) return x.error; }) - .join("\n"); + .join("\n\n"); displayInfo({ title: "Staging Area", - message: message + message: messages, + options: { + timeout: 0, + buttons: [{ text: "Ok", action: null, bold: true }] + } }); this.loadData(); })
--- a/client/src/lib/errors.js Fri Nov 30 09:45:53 2018 +0100 +++ b/client/src/lib/errors.js Fri Nov 30 12:50:18 2018 +0100 @@ -14,21 +14,26 @@ import app from "../main"; -const displayOptions = { - timeout: 2000, +let displayOptions = { + timeout: 2500, showProgressBar: false, - closeOnClick: false, + closeOnClick: true, pauseOnHover: true, oneAtTime: true, - bodyMaxLength: 250 + bodyMaxLength: 1024 }; -const displayError = ({ title, message }) => { +const displayError = ({ title, message, options }) => { + if (!options) options = {}; + const mergedOptions = { ...displayOptions, ...options }; + app.$snotify.info(message, title, mergedOptions); app.$snotify.error(message, title, displayOptions); }; -const displayInfo = ({ title, message }) => { - app.$snotify.info(message, title, displayOptions); +const displayInfo = ({ title, message, options }) => { + if (!options) options = {}; + const mergedOptions = { ...displayOptions, ...options }; + app.$snotify.info(message, title, mergedOptions); }; export { displayError, displayInfo };