# HG changeset patch # User Thomas Junk # Date 1542977554 -3600 # Node ID d5eda9f79610ba4f3ceec6e2c983f039e2ea81e4 # Parent d675e6439aa514d168b2267e7f1ab0a0ab976e04 staging: display visual feedback for now due missing backendcall diff -r d675e6439aa5 -r d5eda9f79610 client/src/components/map/contextbox/Staging.vue --- a/client/src/components/map/contextbox/Staging.vue Fri Nov 23 13:20:10 2018 +0100 +++ b/client/src/components/map/contextbox/Staging.vue Fri Nov 23 13:52:34 2018 +0100 @@ -47,7 +47,7 @@
- +
@@ -68,7 +68,7 @@ */ import { mapState } from "vuex"; -import { displayError } from "../../../lib/errors.js"; +import { displayError, displayInfo } from "../../../lib/errors.js"; export default { STATES: { @@ -165,6 +165,20 @@ } }, methods: { + confirmReview() { + const message = this.demodata + .map(x => { + return x.name + ": " + x.status; + }) + .join("\n"); + displayInfo({ + title: "Staging Area", + message: message + }); + if (false) { + //CODE + } + }, needsApproval(item) { return item.status === this.$options.STATES.NEEDSAPPROVAL; }, diff -r d675e6439aa5 -r d5eda9f79610 client/src/store/imports.js --- a/client/src/store/imports.js Fri Nov 23 13:20:10 2018 +0100 +++ b/client/src/store/imports.js Fri Nov 23 13:52:34 2018 +0100 @@ -15,6 +15,14 @@ import { HTTP } from "../lib/http"; +/* eslint-disable no-unused-vars */ +/* eslint-disable no-unreachable */ +const STATES = { + NEEDSAPPROVAL: "NEEDSAPPROVAL", + APPROVED: "APPROVED", + REJECTED: "REJECTED" +}; + // initial state const init = () => { return { @@ -33,6 +41,19 @@ }, setStaging: (state, staging) => { state.staging = staging; + }, + + toggleApproval: (state, change) => { + throw "Not implemented!"; + const { id, newState } = change; + const stagedResult = this.state.staging.find(e => { + return e.id === id; + }); + if (stagedResult.status === newState) { + stagedResult.status = this.$options.STATES.NEEDSAPPROVAL; + } else { + stagedResult.status = newState; + } } }, actions: { @@ -63,6 +84,21 @@ reject(error); }); }); + }, + setStaging({ commit }, results) { + return new Promise((resolve, reject) => { + throw "Not implemented!"; + HTTP.get("/imports?states=pending", { + headers: { "X-Gemma-Auth": localStorage.getItem("token") } + }) + .then(response => { + commit("setStaging", response.data.imports); + resolve(response); + }) + .catch(error => { + reject(error); + }); + }); } } };