Mercurial > gemma
changeset 1310:d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 23 Nov 2018 13:20:10 +0100 |
parents | 3c91930367ee |
children | d5eda9f79610 |
files | client/src/components/map/contextbox/Staging.vue client/src/store/imports.js |
diffstat | 2 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/map/contextbox/Staging.vue Fri Nov 23 12:44:42 2018 +0100 +++ b/client/src/components/map/contextbox/Staging.vue Fri Nov 23 13:20:10 2018 +0100 @@ -1,8 +1,7 @@ <template> <div class="w-90"> <h6 class="mb-0 py-2 px-3 border-bottom d-flex align-items-center"> - <font-awesome-icon icon="clipboard-check" class="mr-2"></font-awesome-icon> - Staging Area + <font-awesome-icon icon="clipboard-check" class="mr-2"></font-awesome-icon>Staging Area </h6> <table class="table mb-0"> <thead> @@ -69,6 +68,8 @@ */ import { mapState } from "vuex"; +import { displayError } from "../../../lib/errors.js"; + export default { STATES: { NEEDSAPPROVAL: "NEEDSAPPROVAL", @@ -117,6 +118,15 @@ ] }; }, + mounted() { + this.$store.dispatch("imports/getStaging").catch(error => { + const { status, data } = error.response; + displayError({ + title: "Backend Error", + message: `${status}: ${data.message || data}` + }); + }); + }, computed: { ...mapState("application", ["searchQuery"]), filteredData() {
--- a/client/src/store/imports.js Fri Nov 23 12:44:42 2018 +0100 +++ b/client/src/store/imports.js Fri Nov 23 13:20:10 2018 +0100 @@ -18,7 +18,8 @@ // initial state const init = () => { return { - imports: {} + imports: [], + staging: [] }; }; @@ -29,6 +30,9 @@ mutations: { setImports: (state, imports) => { state.imports = imports; + }, + setStaging: (state, staging) => { + state.staging = staging; } }, actions: { @@ -45,6 +49,20 @@ reject(error); }); }); + }, + getStaging({ commit }) { + return new Promise((resolve, reject) => { + 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); + }); + }); } } };