Mercurial > gemma
annotate client/src/store/imports.js @ 1731:8dd7452929ca
WIP: edit scheduled imports
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 09 Jan 2019 13:57:36 +0100 |
parents | b24a54c684bd |
children | 549337e6facd |
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"; |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
16 import Vue from "vue"; |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
18 /* eslint-disable no-unused-vars */ |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
19 /* eslint-disable no-unreachable */ |
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 |
1711
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
26 const IMPORTTYPES = { |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
27 BOTTLENECK: "bottleneck" |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
28 }; |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
29 |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
30 const SCHEDULES = { |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
31 DAILY: "daily", |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
32 MONTHLY: "monthly" |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
33 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
34 |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
35 const IMPORTTYPEKIND = { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
36 bottleneck: "bn", |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
37 fairwayawailability: "fa", |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
38 gaugemeasurement: "ga", |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
39 waterwayaxis: "wx" |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
40 }; |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
41 |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
42 const KINDIMPORTTYPE = { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
43 bn: "bottleneck", |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
44 fa: "fairwayawailability", |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
45 ga: "gaugemeasurement", |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
46 wx: "waterwayaxis" |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
47 }; |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
48 |
1714
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
49 const initializeCurrentSchedule = () => { |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
50 return { |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
51 id: null, |
1714
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
52 importType: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
53 schedule: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
54 import_: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
55 importSource: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
56 eMailNotification: false, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
57 scheduled: false, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
58 easyCron: true, |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
59 cronstring: null, |
1714
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
60 cronMode: "", |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
61 minutes: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
62 month: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
63 hour: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
64 day: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
65 dayOfMonth: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
66 simple: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
67 url: null, |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
68 insecure: false |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
69 }; |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
70 }; |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
71 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
72 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
73 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
74 return { |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
75 imports: [], |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
76 staging: [], |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
77 schedules: [], |
1650
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
78 importScheduleDetailVisible: false, |
1714
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
79 currentSchedule: initializeCurrentSchedule(), |
1650
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
80 importToReview: null |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
81 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
82 }; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
83 |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
84 const imports = { |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
85 init, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 namespaced: true, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
87 state: init(), |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 mutations: { |
1714
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
89 clearCurrentSchedule: state => { |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
90 state.currentSchedule = initializeCurrentSchedule(); |
1b25e7a3a92e
importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1711
diff
changeset
|
91 }, |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
92 setImportScheduleDetailInvisible: state => { |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
93 state.importScheduleDetailVisible = false; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
94 }, |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
95 setImportScheduleDetailVisible: state => { |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
96 state.importScheduleDetailVisible = true; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
97 }, |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
98 setSchedules: (state, schedules) => { |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
99 state.schedules = schedules; |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
100 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 setImports: (state, imports) => { |
1173 | 102 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
|
103 }, |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
104 setStaging: (state, staging) => { |
1350
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
105 const enriched = staging.map(x => { |
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
106 return { ...x, status: STATES.NEEDSAPPROVAL }; |
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
107 }); |
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
108 state.staging = enriched; |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
109 }, |
1650
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
110 setImportToReview: (state, id) => { |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
111 if (!isNaN(parseFloat(id)) && isFinite(id)) { |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
112 state.importToReview = id; |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
113 } |
90211725e4a9
highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents:
1593
diff
changeset
|
114 }, |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
115 toggleApproval: (state, change) => { |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
116 const { id, newStatus } = change; |
1350
58d41573e530
staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1344
diff
changeset
|
117 const stagedResult = state.staging.find(e => { |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
118 return e.id === id; |
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
119 }); |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
120 if (stagedResult.status === newStatus) { |
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
121 stagedResult.status = STATES.NEEDSAPPROVAL; |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
122 } else { |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
123 stagedResult.status = newStatus; |
1311
d5eda9f79610
staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents:
1310
diff
changeset
|
124 } |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
125 }, |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
126 unmarshallCurrentSchedule: (state, payload) => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
127 const { kind, id, cron, url } = payload; |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
128 const eMailNotification = payload["send-email"]; |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
129 Vue.set(state.currentSchedule, "import_", KINDIMPORTTYPE[kind]); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
130 Vue.set(state.currentSchedule, "id", id); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
131 if (cron) { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
132 Vue.set(state.currentSchedule, "cronstring", cron); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
133 } |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
134 if (eMailNotification) { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
135 Vue.set(state.currentSchedule, "eMailNotification", eMailNotification); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
136 } |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
137 if (url) { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
138 Vue.set(state.currentSchedule, "url", url); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
139 } |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
140 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
141 }, |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
142 actions: { |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
143 loadSchedule({ commit }, id) { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
144 return new Promise((resolve, reject) => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
145 HTTP.get("/imports/config/" + id, { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
146 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
147 }) |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
148 .then(response => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
149 commit("unmarshallCurrentSchedule", response.data); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
150 resolve(response); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
151 }) |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
152 .catch(error => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
153 reject(error); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
154 }); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
155 }); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
156 }, |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
157 deleteSchedule({ commit }, id) { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
158 return new Promise((resolve, reject) => { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
159 HTTP.delete("imports/config/" + id, { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
160 headers: { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
161 "X-Gemma-Auth": localStorage.getItem("token") |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
162 } |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
163 }) |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
164 .then(response => { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
165 resolve(response); |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
166 }) |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
167 .catch(error => { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
168 reject(error); |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
169 }); |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
170 }); |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
171 }, |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
172 updateCurrentSchedule({ commit }, payload) { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
173 const { data, id } = payload; |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
174 return new Promise((resolve, reject) => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
175 HTTP.patch("imports/config/" + id, data, { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
176 headers: { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
177 "X-Gemma-Auth": localStorage.getItem("token") |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
178 } |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
179 }) |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
180 .then(response => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
181 resolve(response); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
182 }) |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
183 .catch(error => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
184 reject(error); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
185 }); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
186 }); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
187 }, |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
188 saveCurrentSchedule({ commit }, data) { |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
189 return new Promise((resolve, reject) => { |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
190 HTTP.post("imports/config", data, { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
191 headers: { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
192 "X-Gemma-Auth": localStorage.getItem("token") |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
193 } |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
194 }) |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
195 .then(response => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
196 resolve(response); |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
197 }) |
1731
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
198 .catch(error => { |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
199 reject(error); |
8dd7452929ca
WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents:
1725
diff
changeset
|
200 }); |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
201 }); |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
202 }, |
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
203 loadSchedules({ commit }) { |
1711
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
204 return new Promise((resolve, reject) => { |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
205 HTTP.get("/imports/config", { |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
206 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
207 }) |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
208 .then(response => { |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
209 commit("setSchedules", response.data); |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
210 resolve(response); |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
211 }) |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
212 .catch(error => { |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
213 reject(error); |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
214 }); |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
215 }); |
aec17976528e
feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents:
1709
diff
changeset
|
216 }, |
1709
8ff8d873ef6b
refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1650
diff
changeset
|
217 triggerImport({ commit }, { type, data }) { |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
218 return new Promise((resolve, reject) => { |
1709
8ff8d873ef6b
refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1650
diff
changeset
|
219 HTTP.post("imports/" + type, data, { |
8ff8d873ef6b
refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1650
diff
changeset
|
220 headers: { |
8ff8d873ef6b
refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1650
diff
changeset
|
221 "X-Gemma-Auth": localStorage.getItem("token") |
8ff8d873ef6b
refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents:
1650
diff
changeset
|
222 } |
1429
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
223 }) |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
224 .then(response => { |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
225 resolve(response); |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
226 }) |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
227 .catch(error => { |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
228 reject(error); |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
229 }); |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
230 }); |
f4b3fb43b311
automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents:
1365
diff
changeset
|
231 }, |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
232 getImports({ commit }) { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
233 return new Promise((resolve, reject) => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
234 HTTP.get("/imports", { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
235 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
236 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
237 .then(response => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
238 commit("setImports", response.data.imports); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
239 resolve(response); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
240 }) |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
241 .catch(error => { |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
242 reject(error); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
243 }); |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
244 }); |
1310
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
245 }, |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
246 getStaging({ commit }) { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
247 return new Promise((resolve, reject) => { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
248 HTTP.get("/imports?states=pending", { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
249 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
250 }) |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
251 .then(response => { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
252 commit("setStaging", response.data.imports); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
253 resolve(response); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
254 }) |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
255 .catch(error => { |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
256 reject(error); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
257 }); |
d675e6439aa5
staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents:
1296
diff
changeset
|
258 }); |
1142
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
259 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
260 } |
dc3f0277628a
feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
261 }; |
1344
eda98694e678
staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents:
1311
diff
changeset
|
262 |
1724
79a18eb1672b
import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents:
1714
diff
changeset
|
263 export { imports, STATES, SCHEDULES, IMPORTTYPES, IMPORTTYPEKIND }; |