Mercurial > gemma
comparison client/src/store/imports.js @ 1142:dc3f0277628a
feat: Importqueue listing (Proof of concept)
This is only a prototypical overview of importqueue data from backend.
Uses GET to retrieve an overview of imports.
Shows in separate tables. Further concept needs to be developed to progress..
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 12 Nov 2018 15:00:04 +0100 |
parents | |
children | 3035ddd3d1a8 |
comparison
equal
deleted
inserted
replaced
1138:443fc80a315f | 1142:dc3f0277628a |
---|---|
1 /* | |
2 * This is Free Software under GNU Affero General Public License v >= 3.0 | |
3 * without warranty, see README.md and license for details. | |
4 * | |
5 * SPDX-License-Identifier: AGPL-3.0-or-later | |
6 * License-Filename: LICENSES/AGPL-3.0.txt | |
7 * | |
8 * Copyright (C) 2018 by via donau | |
9 * – Österreichische Wasserstraßen-Gesellschaft mbH | |
10 * Software engineering by Intevation GmbH | |
11 * | |
12 * Author(s): | |
13 * Thomas Junk <thomas.junk@intevation.de> | |
14 */ | |
15 | |
16 import { HTTP } from "../application/lib/http"; | |
17 | |
18 const Imports = { | |
19 namespaced: true, | |
20 state: { | |
21 imports: {} | |
22 }, | |
23 mutations: { | |
24 setImports: (state, imports) => { | |
25 const groupedImports = imports.reduce((o, n) => { | |
26 if (!o[n.state]) o[n.state] = []; | |
27 o[n.state].push(n); | |
28 return o; | |
29 }, {}); | |
30 state.imports = groupedImports; | |
31 } | |
32 }, | |
33 actions: { | |
34 getImports({ commit }) { | |
35 return new Promise((resolve, reject) => { | |
36 HTTP.get("/imports", { | |
37 headers: { "X-Gemma-Auth": localStorage.getItem("token") } | |
38 }) | |
39 .then(response => { | |
40 commit("setImports", response.data.imports); | |
41 resolve(response); | |
42 }) | |
43 .catch(error => { | |
44 reject(error); | |
45 }); | |
46 }); | |
47 } | |
48 } | |
49 }; | |
50 | |
51 export default Imports; |