annotate client/src/store/imports.js @ 1770:ad9622a3f751

gauge measurement
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 11 Jan 2019 11:23:05 +0100
parents 435612f42adb
children 4a7aa3f57efe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1311
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 * without warranty, see README.md and license for details.
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
3 *
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
6 *
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
7 * Copyright (C) 2018 by via donau
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 * Software engineering by Intevation GmbH
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
10 *
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 * Author(s):
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 * Thomas Junk <thomas.junk@intevation.de>
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 */
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
15 import { HTTP } from "@/lib/http";
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
5e1218b5a123 proof of concept
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
21 NEEDSAPPROVAL: "pending",
5e1218b5a123 proof of concept
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
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 = {
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
27 BOTTLENECK: "bottleneck",
1749
0a6b2ace7b7e Gauge measurement, Fairway availability implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 1747
diff changeset
28 WATERWAYAXIS: "waterwayaxis",
0a6b2ace7b7e Gauge measurement, Fairway availability implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 1747
diff changeset
29 GAUGEMEASUREMENT: "gaugemeasurement",
1765
f73fc7e5b51a fix: typo »fairwayawailability« m(
Thomas Junk <thomas.junk@intevation.de>
parents: 1762
diff changeset
30 FAIRWAYAVAILABILITY: "fairwayavailability"
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
31 };
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
32
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
33 const SCHEDULES = {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
34 DAILY: "daily",
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
35 MONTHLY: "monthly"
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
36 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
37
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
38 const IMPORTTYPEKIND = {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
39 bottleneck: "bn",
1765
f73fc7e5b51a fix: typo »fairwayawailability« m(
Thomas Junk <thomas.junk@intevation.de>
parents: 1762
diff changeset
40 fairwayavailability: "fa",
1762
f567ede52fa6 Fixed kind key for gaugemeasurement in client.
Sascha Wilde <wilde@intevation.de>
parents: 1749
diff changeset
41 gaugemeasurement: "gm",
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
42 waterwayaxis: "wx"
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
43 };
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
44
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
45 const KINDIMPORTTYPE = {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
46 bn: "bottleneck",
1765
f73fc7e5b51a fix: typo »fairwayawailability« m(
Thomas Junk <thomas.junk@intevation.de>
parents: 1762
diff changeset
47 fa: "fairwayavailability",
1770
ad9622a3f751 gauge measurement
Thomas Junk <thomas.junk@intevation.de>
parents: 1769
diff changeset
48 gm: "gaugemeasurement",
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
49 wx: "waterwayaxis"
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
50 };
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
51
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
52 const initializeCurrentSchedule = () => {
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
53 return {
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
54 id: null,
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
55 importType: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
56 schedule: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
57 import_: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
58 importSource: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
59 eMailNotification: false,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
60 scheduled: false,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
61 easyCron: true,
1734
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
62 cronString: null,
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
63 cronMode: "",
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
64 minutes: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
65 month: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
66 hour: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
67 day: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
68 dayOfMonth: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
69 simple: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
70 url: null,
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
71 insecure: false,
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
72 featureType: null,
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
73 sortBy: null
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
74 };
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
75 };
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
76
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
77 // initial state
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
78 const init = () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
79 return {
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
80 imports: [],
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
81 staging: [],
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
82 schedules: [],
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
83 importScheduleDetailVisible: false,
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
84 currentSchedule: initializeCurrentSchedule(),
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
85 importToReview: null
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
86 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
87 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
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(),
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 mutations: {
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
94 clearCurrentSchedule: state => {
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
95 state.currentSchedule = initializeCurrentSchedule();
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
96 },
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
97 setImportScheduleDetailInvisible: state => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
98 state.importScheduleDetailVisible = false;
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
99 },
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
100 setImportScheduleDetailVisible: state => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
101 state.importScheduleDetailVisible = true;
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
102 },
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
103 setSchedules: (state, schedules) => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
104 state.schedules = schedules;
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
105 },
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 setImports: (state, imports) => {
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
107 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
108 },
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
109 setStaging: (state, staging) => {
1350
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
110 const enriched = staging.map(x => {
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
111 return { ...x, status: STATES.NEEDSAPPROVAL };
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
112 });
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
113 state.staging = enriched;
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
114 },
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
115 setImportToReview: (state, id) => {
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
116 if (!isNaN(parseFloat(id)) && isFinite(id)) {
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
117 state.importToReview = id;
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
118 }
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
119 },
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
120 toggleApproval: (state, change) => {
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
121 const { id, newStatus } = change;
1350
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
122 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
123 return e.id === id;
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
124 });
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
125 if (stagedResult.status === newStatus) {
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
126 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
127 } else {
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
128 stagedResult.status = newStatus;
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
129 }
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
130 },
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
131 unmarshallCurrentSchedule: (state, payload) => {
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
132 const { kind, id, cron, url, attributes } = payload;
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
133 const eMailNotification = payload["send-email"];
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
134 Vue.set(state.currentSchedule, "import_", KINDIMPORTTYPE[kind]);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
135 Vue.set(state.currentSchedule, "id", id);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
136 if (cron) {
1734
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
137 Vue.set(state.currentSchedule, "scheduled", true);
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
138 Vue.set(state.currentSchedule, "easyCron", false);
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
139 Vue.set(state.currentSchedule, "cronString", cron);
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
140 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
141 if (eMailNotification) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
142 Vue.set(state.currentSchedule, "eMailNotification", eMailNotification);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
143 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
144 if (url) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
145 Vue.set(state.currentSchedule, "url", url);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
146 }
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
147 if (attributes) {
1769
435612f42adb sort-by problem fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 1765
diff changeset
148 let { insecure } = attributes;
435612f42adb sort-by problem fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 1765
diff changeset
149 let sortBy = attributes["sort-by"];
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
150 const featureType = attributes["feature-type"];
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
151 insecure = insecure == "true";
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
152 if (insecure) {
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
153 Vue.set(state.currentSchedule, "insecure", insecure);
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
154 }
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
155 if (featureType) {
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
156 Vue.set(state.currentSchedule, "featureType", featureType);
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
157 }
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
158 if (sortBy) {
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
159 Vue.set(state.currentSchedule, "sortBy", sortBy);
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
160 }
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
161 }
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
162 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
163 },
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
164 actions: {
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
165 loadSchedule({ commit }, id) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
166 return new Promise((resolve, reject) => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
167 HTTP.get("/imports/config/" + id, {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
168 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
169 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
170 .then(response => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
171 commit("unmarshallCurrentSchedule", response.data);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
172 resolve(response);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
173 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
174 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
175 reject(error);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
176 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
177 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
178 },
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
179 deleteSchedule({ commit }, id) {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
180 return new Promise((resolve, reject) => {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
181 HTTP.delete("imports/config/" + id, {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
182 headers: {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
183 "X-Gemma-Auth": localStorage.getItem("token")
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
184 }
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
185 })
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
186 .then(response => {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
187 resolve(response);
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
188 })
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
189 .catch(error => {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
190 reject(error);
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
191 });
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
192 });
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
193 },
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
194 updateCurrentSchedule({ commit }, payload) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
195 const { data, id } = payload;
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
196 return new Promise((resolve, reject) => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
197 HTTP.patch("imports/config/" + id, data, {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
198 headers: {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
199 "X-Gemma-Auth": localStorage.getItem("token")
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
200 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
201 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
202 .then(response => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
203 resolve(response);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
204 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
205 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
206 reject(error);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
207 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
208 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
209 },
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
210 saveCurrentSchedule({ commit }, data) {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
211 return new Promise((resolve, reject) => {
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
212 HTTP.post("imports/config", data, {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
213 headers: {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
214 "X-Gemma-Auth": localStorage.getItem("token")
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
215 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
216 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
217 .then(response => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
218 resolve(response);
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
219 })
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
220 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
221 reject(error);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
222 });
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
223 });
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
224 },
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
225 loadSchedules({ commit }) {
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
226 return new Promise((resolve, reject) => {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
227 HTTP.get("/imports/config", {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
228 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
229 })
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
230 .then(response => {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
231 commit("setSchedules", response.data);
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
232 resolve(response);
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
233 })
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
234 .catch(error => {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
235 reject(error);
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
236 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
237 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
238 },
1709
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
239 triggerImport({ commit }, { type, data }) {
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
240 return new Promise((resolve, reject) => {
1709
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
241 HTTP.post("imports/" + type, data, {
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
242 headers: {
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
243 "X-Gemma-Auth": localStorage.getItem("token")
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
244 }
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
245 })
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
246 .then(response => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
247 resolve(response);
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
248 })
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
249 .catch(error => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
250 reject(error);
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
251 });
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
252 });
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
253 },
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
254 getImports({ commit }) {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
255 return new Promise((resolve, reject) => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
256 HTTP.get("/imports", {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
257 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
258 })
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
259 .then(response => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
260 commit("setImports", response.data.imports);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
261 resolve(response);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
262 })
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
263 .catch(error => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
264 reject(error);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
265 });
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
266 });
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
267 },
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
268 getStaging({ commit }) {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
269 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
270 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
271 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
272 })
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
273 .then(response => {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
274 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
275 resolve(response);
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
276 })
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
277 .catch(error => {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
278 reject(error);
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
279 });
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
280 });
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
281 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
282 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
283 };
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
284
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
285 export { imports, STATES, SCHEDULES, IMPORTTYPES, IMPORTTYPEKIND };