Mercurial > gemma
annotate client/src/store/imports.js @ 4837:3b0ec9b56d7c
Merged
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 08 Nov 2019 13:10:56 +0100 |
parents | a130b5e55ffc |
children |
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()), |
3605
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
46 stagingNotifications: null, |
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
|
47 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
|
48 next: null |
1429
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 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
51 |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
52 const getFromWFS = (type, filter) => { |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
53 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
|
54 var featureCollectionRequest = new WFS().writeGetFeature({ |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
55 srsName: "EPSG:4326", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
56 featureNS: "gemma", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
57 featurePrefix: "gemma", |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
58 featureTypes: [type], |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
59 outputFormat: "application/json", |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
60 filter: filter |
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 HTTP.post( |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
63 "/internal/wfs", |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
64 new XMLSerializer().serializeToString(featureCollectionRequest), |
2107
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 headers: { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
67 "X-Gemma-Auth": localStorage.getItem("token"), |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
68 "Content-type": "text/xml; charset=UTF-8" |
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 ) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
72 .then(response => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
73 resolve(response); |
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 .catch(error => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
76 reject(error); |
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 }; |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
80 |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
81 const clearFilterCriteria = state => { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
82 state.warning = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
83 state.successful = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
84 state.failed = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
85 state.pending = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
86 state.accepted = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
87 state.declined = false; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
88 }; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
89 |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
90 const imports = { |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
91 init, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 namespaced: true, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
93 state: init(), |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
94 getters: { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
95 filters: state => { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
96 return ["failed", "pending", "accepted", "declined", "warning"].filter( |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
97 x => state[x] |
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 } |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
100 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 mutations: { |
3605
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
102 setStagingNotifications: (state, stagingNotifications) => { |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
103 state.stagingNotifications = stagingNotifications; |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
104 }, |
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
|
105 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
|
106 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
|
107 }, |
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
|
108 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
|
109 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
|
110 }, |
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
|
111 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
|
112 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
|
113 }, |
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
|
114 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
|
115 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
|
116 }, |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2655
diff
changeset
|
117 setCurrentDetails: (state, details) => { |
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2655
diff
changeset
|
118 state.details = details; |
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2655
diff
changeset
|
119 }, |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
120 toggleFilter: (state, name) => { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
121 state[name] = !state[name]; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
122 const allSet = |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
123 state.failed && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
124 state.pending && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
125 state.accepted && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
126 state.declined && |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
127 state.warning; |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
128 if (allSet) { |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
129 clearFilterCriteria(state); |
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
130 } |
2578 | 131 }, |
132 clearFilters: state => { | |
2654
3c04c8e46bd4
importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents:
2651
diff
changeset
|
133 clearFilterCriteria(state); |
2578 | 134 }, |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
135 setStretches: (state, stretches) => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
136 state.stretches = stretches; |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
137 }, |
2910
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
138 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
|
139 state.selectedStretchId = id; |
2909
5105f6ad0176
client: stretches: fixed highlighting of selected stretch
Markus Kottlaender <markus@intevation.de>
parents:
2880
diff
changeset
|
140 }, |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
141 setSections: (state, sections) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
142 state.sections = sections; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
143 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
144 selectedSectionId: (state, id) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
145 state.selectedSectionId = id; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
146 }, |
2638
6c1730fc3dc1
client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents:
2615
diff
changeset
|
147 setReviewed: (state, reviewed) => { |
6c1730fc3dc1
client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents:
2615
diff
changeset
|
148 state.reviewed = reviewed; |
6c1730fc3dc1
client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents:
2615
diff
changeset
|
149 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
150 setImports: (state, imports) => { |
2600 | 151 const lookUp = state.reviewed.reduce((o, n) => { |
152 const { id, status } = n; | |
153 o[id] = status; | |
154 return o; | |
155 }, {}); | |
2578 | 156 imports = imports.map(x => { |
2600 | 157 if (x.state === "pending") { |
158 const reviewState = lookUp[x.id]; | |
159 if (reviewState) { | |
160 x.status = reviewState; | |
161 } else { | |
162 x.status = STATES.NEEDSAPPROVAL; | |
163 } | |
164 } | |
2578 | 165 return x; |
166 }); | |
1173 | 167 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
|
168 }, |
2592 | 169 showDetailsFor: (state, id) => { |
170 state.show = id; | |
171 }, | |
172 hideDetails: state => { | |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
173 state.show = null; |
2592 | 174 }, |
2594 | 175 showAdditionalInfoFor: (state, id) => { |
176 state.showAdditional = id; | |
177 }, | |
178 hideAdditionalInfo: state => { | |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
179 state.showAdditional = false; |
2594 | 180 }, |
181 showAdditionalLogsFor: (state, id) => { | |
182 state.showLogs = id; | |
183 }, | |
184 hideAdditionalLogs: state => { | |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
185 state.showLogs = false; |
2594 | 186 }, |
2592 | 187 toggleApprove: (state, change) => { |
188 const { id, newStatus } = change; | |
189 const stagedResult = state.imports.find(e => { | |
190 return e.id === id; | |
191 }); | |
192 if (stagedResult.status === newStatus) { | |
193 stagedResult.status = STATES.NEEDSAPPROVAL; | |
2600 | 194 state.reviewed = state.reviewed.filter(x => x.id !== stagedResult.id); |
2592 | 195 } else { |
196 stagedResult.status = newStatus; | |
2615
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
197 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
|
198 if (index !== -1) { |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
199 state.reviewed[index].status = newStatus; |
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
200 } else { |
4698
a130b5e55ffc
import_overview: save additional information for approval dialogue in the store
Thomas Junk <thomas.junk@intevation.de>
parents:
3605
diff
changeset
|
201 state.reviewed.push({ |
a130b5e55ffc
import_overview: save additional information for approval dialogue in the store
Thomas Junk <thomas.junk@intevation.de>
parents:
3605
diff
changeset
|
202 id: stagedResult.id, |
a130b5e55ffc
import_overview: save additional information for approval dialogue in the store
Thomas Junk <thomas.junk@intevation.de>
parents:
3605
diff
changeset
|
203 status: newStatus, |
a130b5e55ffc
import_overview: save additional information for approval dialogue in the store
Thomas Junk <thomas.junk@intevation.de>
parents:
3605
diff
changeset
|
204 kind: stagedResult.kind, |
a130b5e55ffc
import_overview: save additional information for approval dialogue in the store
Thomas Junk <thomas.junk@intevation.de>
parents:
3605
diff
changeset
|
205 enqueued: stagedResult.enqueued |
a130b5e55ffc
import_overview: save additional information for approval dialogue in the store
Thomas Junk <thomas.junk@intevation.de>
parents:
3605
diff
changeset
|
206 }); |
2615
7025d082c115
client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents:
2608
diff
changeset
|
207 } |
2592 | 208 } |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
209 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
210 }, |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
211 actions: { |
3605
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
212 loadStagingNotifications({ commit }) { |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
213 return new Promise((resolve, reject) => { |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
214 HTTP.get("/imports?states=pending&count=true", { |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
215 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
216 }) |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
217 .then(response => { |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
218 commit("setStagingNotifications", response.data); |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
219 resolve(response); |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
220 }) |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
221 .catch(error => { |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
222 reject(error); |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
223 }); |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
224 }); |
d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
Thomas Junk <thomas.junk@intevation.de>
parents:
3290
diff
changeset
|
225 }, |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
226 loadStretch(context, name) { |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
227 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
|
228 getFromWFS("stretches_geoserver", equalToFilter("name", name)) |
2107
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
229 .then(response => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
230 resolve(response); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
231 }) |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
232 .catch(error => { |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
233 reject(error); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
234 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
235 }); |
6747a4cf3639
staging: zoom to Stretch implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2095
diff
changeset
|
236 }, |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
237 loadStretches({ commit }) { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
238 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
|
239 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
|
240 .then(response => { |
1945
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
241 if (response.data.features) { |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
242 commit("setStretches", response.data.features); |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
243 } else { |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
244 commit("setStretches", []); |
f64bc12c1719
import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents:
1942
diff
changeset
|
245 } |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
246 resolve(response); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
247 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
248 .catch(error => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
249 reject(error); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
250 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
251 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
252 }, |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
253 saveStretch(context, stretch) { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
254 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
|
255 HTTP.post("/imports/st", stretch, { |
1889
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
256 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
257 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
258 .then(response => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
259 resolve(response); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
260 }) |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
261 .catch(error => { |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
262 reject(error); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
263 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
264 }); |
b6d0460b069d
define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1867
diff
changeset
|
265 }, |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
266 loadSection(context, name) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
267 return new Promise((resolve, reject) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
268 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
|
269 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
270 resolve(response); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
271 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
272 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
273 reject(error); |
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 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
276 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
277 loadSections({ commit }) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
278 return new Promise((resolve, reject) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
279 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
|
280 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
281 if (response.data.features) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
282 commit("setSections", response.data.features); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
283 } else { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
284 commit("setSections", []); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
285 } |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
286 resolve(response); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
287 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
288 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
289 reject(error); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
290 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
291 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
292 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
293 saveSection(context, section) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
294 return new Promise((resolve, reject) => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
295 HTTP.post("/imports/sec", section, { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
296 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
|
297 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
298 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
299 resolve(response); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
300 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
301 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
302 reject(error); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
303 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
304 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
305 }, |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
306 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
|
307 let { filter, from, to, query } = options; |
2415 | 308 let queryParams = ""; |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
309 const hasWarning = filter.includes("warning"); |
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
310 filter = filter.filter(x => x != "warning"); |
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
311 if (filter && filter.length > 0) { |
2447
522024fa06eb
staging: filter logs on server
Thomas Junk <thomas.junk@intevation.de>
parents:
2415
diff
changeset
|
312 queryParams = "?states=" + filter.join(","); |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
313 if (hasWarning) queryParams += "&warnings=true"; |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
314 queryParams += "&from=" + from; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
315 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
|
316 queryParams += "&query=" + query; |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
317 } else { |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
318 if (hasWarning) { |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
319 queryParams += "?warnings=true"; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
320 queryParams += "&from=" + from; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
321 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
|
322 queryParams += "&query=" + query; |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
323 } else { |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
324 queryParams += "?from=" + from; |
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
325 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
|
326 queryParams += "&query=" + query; |
2748
c6695d6e9334
import_overview: filtering date interval via backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2733
diff
changeset
|
327 } |
2655
501967471981
overview: warning filter implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2654
diff
changeset
|
328 } |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
329 return new Promise((resolve, reject) => { |
2415 | 330 HTTP.get("/imports" + queryParams, { |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
331 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
332 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
333 .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
|
334 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
|
335 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
|
336 commit("setNext", next); |
2578 | 337 commit("setImports", imports); |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
338 resolve(response); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
339 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
340 .catch(error => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
341 reject(error); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
342 }); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
343 }); |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
344 }, |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2789
diff
changeset
|
345 confirmReview(context, reviewResults) { |
2399 | 346 return new Promise((resolve, reject) => { |
347 HTTP.patch("/imports", reviewResults, { | |
348 headers: { | |
349 "X-Gemma-Auth": localStorage.getItem("token"), | |
350 "Content-type": "application/json" | |
351 } | |
352 }) | |
353 .then(response => { | |
354 resolve(response); | |
355 }) | |
356 .catch(error => { | |
357 reject(error); | |
358 }); | |
359 }); | |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
360 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
361 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
362 }; |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
363 |
2033
431f97fd873b
importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents:
1996
diff
changeset
|
364 export { imports, STATES }; |