annotate client/src/store/imports.js @ 2578:3ad81357a57c

overview2 WIP
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 11 Mar 2019 15:35:13 +0100
parents 522024fa06eb
children 5472a5be09c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
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
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
6 *
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
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
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
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
5e1218b5a123 proof of concept
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
22 NEEDSAPPROVAL: "pending",
5e1218b5a123 proof of concept
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
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
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
27 const NODETAILS = -1;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
28 const NODIFF = -1;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
29
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
30 // initial state
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
31 const init = () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
32 return {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
33 filters: [],
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
34 stretches: [],
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
35 imports: [],
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
36 staging: [],
2402
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
37 importToReview: null,
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
38 stagingVisible: true,
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
39 logsVisible: true,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
40 show: NODETAILS,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
41 showAdditional: NODETAILS,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
42 showLogs: NODETAILS,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
43 showDiff: NODIFF
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
44 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
45 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
46
2107
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
47 const getStretchFromWFS = filter => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
48 return new Promise((resolve, reject) => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
49 var stretchesFeatureCollectionRequest = new WFS().writeGetFeature({
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
50 srsName: "EPSG:4326",
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
51 featureNS: "gemma",
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
52 featurePrefix: "gemma",
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
53 featureTypes: ["stretches_geoserver"],
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
54 outputFormat: "application/json",
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
55 filter: filter
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 HTTP.post(
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
58 "/internal/wfs",
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
59 new XMLSerializer().serializeToString(stretchesFeatureCollectionRequest),
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
60 {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
61 headers: {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
62 "X-Gemma-Auth": localStorage.getItem("token"),
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
63 "Content-type": "text/xml; charset=UTF-8"
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 .then(response => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
68 resolve(response);
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
69 })
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
70 .catch(error => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
71 reject(error);
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
72 });
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
73 });
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
74 };
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
75
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
76 const imports = {
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
77 init,
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 namespaced: true,
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
79 state: init(),
2402
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
80 getters: {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
81 toCommit: state => {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
82 return state.imports.filter(x => {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
83 return x.status && x.status !== STATES.NEEDSAPPROVAL;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
84 });
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
85 },
2402
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
86 processedReviews: state => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
87 return state.staging
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
88 .filter(x => x.status !== STATES.NEEDSAPPROVAL)
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
89 .map(r => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
90 return {
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
91 id: r.id,
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
92 state: r.status
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
93 };
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
94 });
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
95 }
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
96 },
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 mutations: {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
98 setFilters: (state, filters) => {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
99 state.filters = filters;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
100 },
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
101 clearFilters: state => {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
102 state.filters = [];
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
103 },
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
104 setStretches: (state, stretches) => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
105 state.stretches = stretches;
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
106 },
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 setImports: (state, imports) => {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
108 imports = imports.map(x => {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
109 if (x.state === "pending") x["status"] = STATES.NEEDSAPPROVAL;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
110 return x;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
111 });
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
112 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
113 },
2402
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
114 setStagingVisibility: (state, visibility) => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
115 state.stagingVisible = visibility;
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
116 },
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
117 setLogsVisibility: (state, visibility) => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
118 state.logsVisible = visibility;
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
119 },
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
120 setStaging: (state, staging) => {
1350
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
121 const enriched = staging.map(x => {
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
122 return { ...x, status: STATES.NEEDSAPPROVAL };
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
123 });
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
124 state.staging = enriched;
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
125 },
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
126 setImportToReview: (state, id) => {
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
127 if (!isNaN(parseFloat(id)) && isFinite(id)) {
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
128 state.importToReview = id;
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
129 }
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
130 },
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
131 toggleApproval: (state, change) => {
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
132 const { id, newStatus } = change;
1350
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
133 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
134 return e.id === id;
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
135 });
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
136 if (stagedResult.status === newStatus) {
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
137 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
138 } else {
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
139 stagedResult.status = newStatus;
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
140 }
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 },
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
143 actions: {
2107
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
144 loadStretch({ commit }, name) {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
145 return new Promise((resolve, reject) => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
146 getStretchFromWFS(equalToFilter("name", name))
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
147 .then(response => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
148 resolve(response);
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
149 })
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
150 .catch(error => {
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
151 reject(error);
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
152 });
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
153 });
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
154 },
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
155 loadStretches({ commit }) {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
156 return new Promise((resolve, reject) => {
2107
6747a4cf3639 staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2095
diff changeset
157 getStretchFromWFS(equalToFilter("staging_done", true))
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
158 .then(response => {
1945
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
159 if (response.data.features) {
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
160 commit("setStretches", response.data.features);
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
161 } else {
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
162 commit("setStretches", []);
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
163 }
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
164 resolve(response);
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
165 })
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
166 .catch(error => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
167 reject(error);
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
168 });
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
169 });
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
170 },
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
171 saveStretch({ commit }, stretch) {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
172 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
173 HTTP.post("/imports/st", stretch, {
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
174 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
175 })
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
176 .then(response => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
177 resolve(response);
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
178 })
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
179 .catch(error => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
180 reject(error);
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
181 });
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
182 });
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
183 },
2415
Thomas Junk <thomas.junk@intevation.de>
parents: 2402
diff changeset
184 getImports({ commit }, filter) {
Thomas Junk <thomas.junk@intevation.de>
parents: 2402
diff changeset
185 let queryParams = "";
2447
522024fa06eb staging: filter logs on server
Thomas Junk <thomas.junk@intevation.de>
parents: 2415
diff changeset
186 if (filter && filter.length > 0)
522024fa06eb staging: filter logs on server
Thomas Junk <thomas.junk@intevation.de>
parents: 2415
diff changeset
187 queryParams = "?states=" + filter.join(",");
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
188 return new Promise((resolve, reject) => {
2415
Thomas Junk <thomas.junk@intevation.de>
parents: 2402
diff changeset
189 HTTP.get("/imports" + queryParams, {
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
190 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
191 })
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
192 .then(response => {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
193 const { imports } = response.data;
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2447
diff changeset
194 commit("setImports", imports);
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
195 resolve(response);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
196 })
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
197 .catch(error => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
198 reject(error);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
199 });
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
200 });
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
201 },
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
202 getStaging({ commit }) {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
203 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
204 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
205 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
206 })
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
207 .then(response => {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
208 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
209 resolve(response);
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
210 })
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
211 .catch(error => {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
212 reject(error);
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
213 });
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
214 });
2399
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
215 },
2402
Thomas Junk <thomas.junk@intevation.de>
parents: 2399
diff changeset
216 confirmReview({ state }, reviewResults) {
2399
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
217 return new Promise((resolve, reject) => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
218 HTTP.patch("/imports", reviewResults, {
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
219 headers: {
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
220 "X-Gemma-Auth": localStorage.getItem("token"),
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
221 "Content-type": "application/json"
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
222 }
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
223 })
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
224 .then(response => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
225 resolve(response);
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
226 })
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
227 .catch(error => {
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
228 reject(error);
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
229 });
Thomas Junk <thomas.junk@intevation.de>
parents: 2107
diff changeset
230 });
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
231 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
232 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
233 };
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
234
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1996
diff changeset
235 export { imports, STATES };