Mercurial > gemma
annotate client/src/store/imports.js @ 3515:c64c47ff2ab1 password
import: fix for passwordleakage. No passwords are received/sent if configuration is edited.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 29 May 2019 09:56:42 +0200 |
parents | 3ada3d0347bd |
children | d02d4e31491b |
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"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2910
diff
changeset
|
16 import { WFS } from "ol/format"; |
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2910
diff
changeset
|
17 import { equalTo as equalToFilter } from "ol/format/filter"; |
2789
c1e832f77726
import_overview: setting a sane default window in case of reload
Thomas Junk <thomas.junk@intevation.de>
parents:
2759
diff
changeset
|
18 import { startOfHour, endOfHour } from "date-fns"; |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
20 const STATES = { |
1468 | 21 NEEDSAPPROVAL: "pending", |
22 APPROVED: "accepted", | |
1475
2365acde39dc
Staging area: Dealing with backend response.
Thomas Junk <thomas.junk@intevation.de>
parents:
1470
diff
changeset
|
23 REJECTED: "declined" |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
24 }; |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
25 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
26 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
27 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
28 return { |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
29 failed: false, |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
30 pending: false, |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
31 accepted: false, |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
32 declined: false, |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
33 warning: false, |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
34 stretches: [], |
2910
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
35 selectedStretchId: null, |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
36 sections: [], |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
37 selectedSectionId: null, |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
38 imports: [], |
2600 | 39 reviewed: [], |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
40 show: null, |
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
41 showAdditional: null, |
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
42 showLogs: null, |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
43 details: [], |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
44 startDate: startOfHour(new Date()), |
2789
c1e832f77726
import_overview: setting a sane default window in case of reload
Thomas Junk <thomas.junk@intevation.de>
parents:
2759
diff
changeset
|
45 endDate: endOfHour(new Date()), |
2759
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
46 prev: null, |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
47 next: null |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
48 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
49 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
50 |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
51 const getFromWFS = (type, filter) => { |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
52 return new Promise((resolve, reject) => { |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
53 var featureCollectionRequest = new WFS().writeGetFeature({ |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
54 srsName: "EPSG:4326", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
55 featureNS: "gemma", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
56 featurePrefix: "gemma", |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
57 featureTypes: [type], |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
58 outputFormat: "application/json", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
59 filter: filter |
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 HTTP.post( |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
62 "/internal/wfs", |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
63 new XMLSerializer().serializeToString(featureCollectionRequest), |
2107
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 headers: { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
66 "X-Gemma-Auth": localStorage.getItem("token"), |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
67 "Content-type": "text/xml; charset=UTF-8" |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
68 } |
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 ) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
71 .then(response => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
72 resolve(response); |
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 .catch(error => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
75 reject(error); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
76 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
77 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
78 }; |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
79 |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
80 const clearFilterCriteria = state => { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
81 state.warning = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
82 state.successful = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
83 state.failed = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
84 state.pending = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
85 state.accepted = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
86 state.declined = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
87 }; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
88 |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
89 const imports = { |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
90 init, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 namespaced: true, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
92 state: init(), |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
93 getters: { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
94 filters: state => { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
95 return ["failed", "pending", "accepted", "declined", "warning"].filter( |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
96 x => state[x] |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
97 ); |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
98 } |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
99 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
100 mutations: { |
2759
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
101 setPrev: (state, prev) => { |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
102 state.prev = prev; |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
103 }, |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
104 setNext: (state, next) => { |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
105 state.next = next; |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
106 }, |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
107 setStartDate: (state, start) => { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
108 state.startDate = start; |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
109 }, |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
110 setEndDate: (state, end) => { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
111 state.endDate = end; |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2749
diff
changeset
|
112 }, |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2655
diff
changeset
|
113 setCurrentDetails: (state, details) => { |
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2655
diff
changeset
|
114 state.details = details; |
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2655
diff
changeset
|
115 }, |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
116 toggleFilter: (state, name) => { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
117 state[name] = !state[name]; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
118 const allSet = |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
119 state.failed && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
120 state.pending && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
121 state.accepted && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
122 state.declined && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
123 state.warning; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
124 if (allSet) { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
125 clearFilterCriteria(state); |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
126 } |
2578 | 127 }, |
128 clearFilters: state => { | |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
129 clearFilterCriteria(state); |
2578 | 130 }, |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
131 setStretches: (state, stretches) => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
132 state.stretches = stretches; |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
133 }, |
2910
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
134 selectedStretchId: (state, id) => { |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
135 state.selectedStretchId = id; |
2909
5105f6ad0176
client: stretches: fixed highlighting of selected stretch
Markus Kottlaender <markus@intevation.de>
parents:
2880
diff
changeset
|
136 }, |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
137 setSections: (state, sections) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
138 state.sections = sections; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
139 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
140 selectedSectionId: (state, id) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
141 state.selectedSectionId = id; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
142 }, |
2638
6c1730fc3dc1
client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents:
2615
diff
changeset
|
143 setReviewed: (state, reviewed) => { |
6c1730fc3dc1
client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents:
2615
diff
changeset
|
144 state.reviewed = reviewed; |
6c1730fc3dc1
client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents:
2615
diff
changeset
|
145 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
146 setImports: (state, imports) => { |
2600 | 147 const lookUp = state.reviewed.reduce((o, n) => { |
148 const { id, status } = n; | |
149 o[id] = status; | |
150 return o; | |
151 }, {}); | |
2578 | 152 imports = imports.map(x => { |
2600 | 153 if (x.state === "pending") { |
154 const reviewState = lookUp[x.id]; | |
155 if (reviewState) { | |
156 x.status = reviewState; | |
157 } else { | |
158 x.status = STATES.NEEDSAPPROVAL; | |
159 } | |
160 } | |
2578 | 161 return x; |
162 }); | |
1173 | 163 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
|
164 }, |
2592 | 165 showDetailsFor: (state, id) => { |
166 state.show = id; | |
167 }, | |
168 hideDetails: state => { | |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
169 state.show = null; |
2592 | 170 }, |
2594 | 171 showAdditionalInfoFor: (state, id) => { |
172 state.showAdditional = id; | |
173 }, | |
174 hideAdditionalInfo: state => { | |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
175 state.showAdditional = false; |
2594 | 176 }, |
177 showAdditionalLogsFor: (state, id) => { | |
178 state.showLogs = id; | |
179 }, | |
180 hideAdditionalLogs: state => { | |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
181 state.showLogs = false; |
2594 | 182 }, |
2592 | 183 toggleApprove: (state, change) => { |
184 const { id, newStatus } = change; | |
185 const stagedResult = state.imports.find(e => { | |
186 return e.id === id; | |
187 }); | |
188 if (stagedResult.status === newStatus) { | |
189 stagedResult.status = STATES.NEEDSAPPROVAL; | |
2600 | 190 state.reviewed = state.reviewed.filter(x => x.id !== stagedResult.id); |
2592 | 191 } else { |
192 stagedResult.status = newStatus; | |
2615
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
193 let index = state.reviewed.findIndex(r => r.id === id); |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
194 if (index !== -1) { |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
195 state.reviewed[index].status = newStatus; |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
196 } else { |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
197 state.reviewed.push({ id: stagedResult.id, status: newStatus }); |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
198 } |
2592 | 199 } |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
200 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
201 }, |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
202 actions: { |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
203 loadStretch(context, name) { |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
204 return new Promise((resolve, reject) => { |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
205 getFromWFS("stretches_geoserver", equalToFilter("name", name)) |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
206 .then(response => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
207 resolve(response); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
208 }) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
209 .catch(error => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
210 reject(error); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
211 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
212 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
213 }, |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
214 loadStretches({ commit }) { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
215 return new Promise((resolve, reject) => { |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
216 getFromWFS("stretches_geoserver", equalToFilter("staging_done", true)) |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
217 .then(response => { |
1945
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
218 if (response.data.features) { |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
219 commit("setStretches", response.data.features); |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
220 } else { |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
221 commit("setStretches", []); |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
222 } |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
223 resolve(response); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
224 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
225 .catch(error => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
226 reject(error); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
227 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
228 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
229 }, |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
230 saveStretch(context, stretch) { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
231 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
|
232 HTTP.post("/imports/st", stretch, { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
233 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
234 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
235 .then(response => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
236 resolve(response); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
237 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
238 .catch(error => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
239 reject(error); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
240 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
241 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
242 }, |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
243 loadSection(context, name) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
244 return new Promise((resolve, reject) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
245 getFromWFS("sections_geoserver", equalToFilter("name", name)) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
246 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
247 resolve(response); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
248 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
249 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
250 reject(error); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
251 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
252 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
253 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
254 loadSections({ commit }) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
255 return new Promise((resolve, reject) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
256 getFromWFS("sections_geoserver", equalToFilter("staging_done", true)) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
257 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
258 if (response.data.features) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
259 commit("setSections", response.data.features); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
260 } else { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
261 commit("setSections", []); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
262 } |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
263 resolve(response); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
264 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
265 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
266 reject(error); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
267 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
268 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
269 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
270 saveSection(context, section) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
271 return new Promise((resolve, reject) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
272 HTTP.post("/imports/sec", section, { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
273 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
274 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
275 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
276 resolve(response); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
277 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
278 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
279 reject(error); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
280 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
281 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
282 }, |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
283 getImports({ commit }, options) { |
2749
cd789302b3e2
import_overview: start is initially always beginning of current hour
Thomas Junk <thomas.junk@intevation.de>
parents:
2748
diff
changeset
|
284 let { filter, from, to, query } = options; |
2415 | 285 let queryParams = ""; |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
286 const hasWarning = filter.includes("warning"); |
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
287 filter = filter.filter(x => x != "warning"); |
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
288 if (filter && filter.length > 0) { |
2447
522024fa06eb
staging: filter logs on server
Thomas Junk <thomas.junk@intevation.de>
parents:
2415
diff
changeset
|
289 queryParams = "?states=" + filter.join(","); |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
290 if (hasWarning) queryParams += "&warnings=true"; |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
291 queryParams += "&from=" + from; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
292 queryParams += "&to=" + to; |
2749
cd789302b3e2
import_overview: start is initially always beginning of current hour
Thomas Junk <thomas.junk@intevation.de>
parents:
2748
diff
changeset
|
293 queryParams += "&query=" + query; |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
294 } else { |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
295 if (hasWarning) { |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
296 queryParams += "?warnings=true"; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
297 queryParams += "&from=" + from; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
298 queryParams += "&to=" + to; |
2749
cd789302b3e2
import_overview: start is initially always beginning of current hour
Thomas Junk <thomas.junk@intevation.de>
parents:
2748
diff
changeset
|
299 queryParams += "&query=" + query; |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
300 } else { |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
301 queryParams += "?from=" + from; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
302 queryParams += "&to=" + to; |
2749
cd789302b3e2
import_overview: start is initially always beginning of current hour
Thomas Junk <thomas.junk@intevation.de>
parents:
2748
diff
changeset
|
303 queryParams += "&query=" + query; |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
304 } |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
305 } |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
306 return new Promise((resolve, reject) => { |
2415 | 307 HTTP.get("/imports" + queryParams, { |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
308 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
309 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
310 .then(response => { |
2759
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
311 const { imports, prev, next } = response.data; |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
312 commit("setPrev", prev); |
7badd99c9315
import_overview: sprinkled fairydust into the app to make magical timewarp possible for log_overview
Thomas Junk <thomas.junk@intevation.de>
parents:
2753
diff
changeset
|
313 commit("setNext", next); |
2578 | 314 commit("setImports", imports); |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
315 resolve(response); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
316 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
317 .catch(error => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
318 reject(error); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
319 }); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
320 }); |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
321 }, |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
322 confirmReview(context, reviewResults) { |
2399 | 323 return new Promise((resolve, reject) => { |
324 HTTP.patch("/imports", reviewResults, { | |
325 headers: { | |
326 "X-Gemma-Auth": localStorage.getItem("token"), | |
327 "Content-type": "application/json" | |
328 } | |
329 }) | |
330 .then(response => { | |
331 resolve(response); | |
332 }) | |
333 .catch(error => { | |
334 reject(error); | |
335 }); | |
336 }); | |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
337 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
338 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
339 }; |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
340 |
2033
431f97fd873b
importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents:
1996
diff
changeset
|
341 export { imports, STATES }; |