Mercurial > gemma
annotate client/src/store/imports.js @ 2447:522024fa06eb
staging: filter logs on server
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 01 Mar 2019 13:00:42 +0100 |
parents | df56bc53e86d |
children | 3ad81357a57c |
rev | line source |
---|---|
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1311
diff
changeset
|
1 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 * without warranty, see README.md and license for details. |
1173 | 3 * |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 * SPDX-License-Identifier: AGPL-3.0-or-later |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 * License-Filename: LICENSES/AGPL-3.0.txt |
1173 | 6 * |
7 * Copyright (C) 2018 by via donau | |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 * – Österreichische Wasserstraßen-Gesellschaft mbH |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 * Software engineering by Intevation GmbH |
1173 | 10 * |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 * Author(s): |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 * Thomas Junk <thomas.junk@intevation.de> |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 */ |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 |
1725
b24a54c684bd
importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents:
1724
diff
changeset
|
15 import { HTTP } from "@/lib/http"; |
1942
d1b7b1c70410
import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents:
1930
diff
changeset
|
16 import { WFS } from "ol/format.js"; |
1980
c8e2f6838eaf
define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents:
1946
diff
changeset
|
17 import { equalTo as equalToFilter } from "ol/format/filter.js"; |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
19 /* eslint-disable no-unused-vars */ |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
20 /* eslint-disable no-unreachable */ |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
21 const STATES = { |
1468 | 22 NEEDSAPPROVAL: "pending", |
23 APPROVED: "accepted", | |
1475
2365acde39dc
Staging area: Dealing with backend response.
Thomas Junk <thomas.junk@intevation.de>
parents:
1470
diff
changeset
|
24 REJECTED: "declined" |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
25 }; |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
26 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
27 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
28 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
29 return { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
30 stretches: [], |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
31 imports: [], |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
32 staging: [], |
2402 | 33 importToReview: null, |
34 stagingVisible: true, | |
35 logsVisible: true | |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
36 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
37 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
38 |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
39 const getStretchFromWFS = filter => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
40 return new Promise((resolve, reject) => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
41 var stretchesFeatureCollectionRequest = new WFS().writeGetFeature({ |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
42 srsName: "EPSG:4326", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
43 featureNS: "gemma", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
44 featurePrefix: "gemma", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
45 featureTypes: ["stretches_geoserver"], |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
46 outputFormat: "application/json", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
47 filter: filter |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
48 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
49 HTTP.post( |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
50 "/internal/wfs", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
51 new XMLSerializer().serializeToString(stretchesFeatureCollectionRequest), |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
52 { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
53 headers: { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
54 "X-Gemma-Auth": localStorage.getItem("token"), |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
55 "Content-type": "text/xml; charset=UTF-8" |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
56 } |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
57 } |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
58 ) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
59 .then(response => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
60 resolve(response); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
61 }) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
62 .catch(error => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
63 reject(error); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
64 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
65 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
66 }; |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
67 |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
68 const imports = { |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
69 init, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 namespaced: true, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
71 state: init(), |
2402 | 72 getters: { |
73 processedReviews: state => { | |
74 return state.staging | |
75 .filter(x => x.status !== STATES.NEEDSAPPROVAL) | |
76 .map(r => { | |
77 return { | |
78 id: r.id, | |
79 state: r.status | |
80 }; | |
81 }); | |
82 } | |
83 }, | |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
84 mutations: { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
85 setStretches: (state, stretches) => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
86 state.stretches = stretches; |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
87 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 setImports: (state, imports) => { |
1173 | 89 state.imports = imports; |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
90 }, |
2402 | 91 setStagingVisibility: (state, visibility) => { |
92 state.stagingVisible = visibility; | |
93 }, | |
94 setLogsVisibility: (state, visibility) => { | |
95 state.logsVisible = visibility; | |
96 }, | |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
97 setStaging: (state, staging) => { |
1350
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
98 const enriched = staging.map(x => { |
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
99 return { ...x, status: STATES.NEEDSAPPROVAL }; |
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
100 }); |
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
101 state.staging = enriched; |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
102 }, |
1650
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
103 setImportToReview: (state, id) => { |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
104 if (!isNaN(parseFloat(id)) && isFinite(id)) { |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
105 state.importToReview = id; |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
106 } |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
107 }, |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
108 toggleApproval: (state, change) => { |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
109 const { id, newStatus } = change; |
1350
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
110 const stagedResult = state.staging.find(e => { |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
111 return e.id === id; |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
112 }); |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
113 if (stagedResult.status === newStatus) { |
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
114 stagedResult.status = STATES.NEEDSAPPROVAL; |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
115 } else { |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
116 stagedResult.status = newStatus; |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
117 } |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 }, |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 actions: { |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
121 loadStretch({ commit }, name) { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
122 return new Promise((resolve, reject) => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
123 getStretchFromWFS(equalToFilter("name", name)) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
124 .then(response => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
125 resolve(response); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
126 }) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
127 .catch(error => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
128 reject(error); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
129 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
130 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
131 }, |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
132 loadStretches({ commit }) { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
133 return new Promise((resolve, reject) => { |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
134 getStretchFromWFS(equalToFilter("staging_done", true)) |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
135 .then(response => { |
1945
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
136 if (response.data.features) { |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
137 commit("setStretches", response.data.features); |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
138 } else { |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
139 commit("setStretches", []); |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
140 } |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
141 resolve(response); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
142 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
143 .catch(error => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
144 reject(error); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
145 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
146 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
147 }, |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
148 saveStretch({ commit }, stretch) { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
149 return new Promise((resolve, reject) => { |
2095
98f0c7956128
Fixed api url used in front end for stretches.
Sascha Wilde <wilde@intevation.de>
parents:
2033
diff
changeset
|
150 HTTP.post("/imports/st", stretch, { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
151 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
152 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
153 .then(response => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
154 resolve(response); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
155 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
156 .catch(error => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
157 reject(error); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
158 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
159 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
160 }, |
2415 | 161 getImports({ commit }, filter) { |
162 let queryParams = ""; | |
2447
522024fa06eb
staging: filter logs on server
Thomas Junk <thomas.junk@intevation.de>
parents:
2415
diff
changeset
|
163 if (filter && filter.length > 0) |
522024fa06eb
staging: filter logs on server
Thomas Junk <thomas.junk@intevation.de>
parents:
2415
diff
changeset
|
164 queryParams = "?states=" + filter.join(","); |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
165 return new Promise((resolve, reject) => { |
2415 | 166 HTTP.get("/imports" + queryParams, { |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
167 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
168 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
169 .then(response => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
170 commit("setImports", response.data.imports); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
171 resolve(response); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
172 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
173 .catch(error => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
174 reject(error); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
175 }); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
176 }); |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
177 }, |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
178 getStaging({ commit }) { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
179 return new Promise((resolve, reject) => { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
180 HTTP.get("/imports?states=pending", { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
181 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
182 }) |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
183 .then(response => { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
184 commit("setStaging", response.data.imports); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
185 resolve(response); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
186 }) |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
187 .catch(error => { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
188 reject(error); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
189 }); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
190 }); |
2399 | 191 }, |
2402 | 192 confirmReview({ state }, reviewResults) { |
2399 | 193 return new Promise((resolve, reject) => { |
194 HTTP.patch("/imports", reviewResults, { | |
195 headers: { | |
196 "X-Gemma-Auth": localStorage.getItem("token"), | |
197 "Content-type": "application/json" | |
198 } | |
199 }) | |
200 .then(response => { | |
201 resolve(response); | |
202 }) | |
203 .catch(error => { | |
204 reject(error); | |
205 }); | |
206 }); | |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
207 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
208 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
209 }; |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
210 |
2033
431f97fd873b
importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents:
1996
diff
changeset
|
211 export { imports, STATES }; |