annotate client/src/store/imports.js @ 1980:c8e2f6838eaf

define stretches: mark stretches in review
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 23 Jan 2019 14:17:14 +0100
parents f88773a2c0a0
children fda5c78fb7d3
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";
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
17 import { WFS } from "ol/format.js";
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1946
diff changeset
18 import { equalTo as equalToFilter } from "ol/format/filter.js";
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
20 /* 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
21 /* eslint-disable no-unreachable */
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
22 const STATES = {
1468
5e1218b5a123 proof of concept
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
23 NEEDSAPPROVAL: "pending",
5e1218b5a123 proof of concept
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
24 APPROVED: "accepted",
1475
2365acde39dc Staging area: Dealing with backend response.
Thomas Junk <thomas.junk@intevation.de>
parents: 1470
diff changeset
25 REJECTED: "declined"
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
26 };
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
27
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
28 const IMPORTTYPES = {
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
29 BOTTLENECK: "bottleneck",
1749
0a6b2ace7b7e Gauge measurement, Fairway availability implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 1747
diff changeset
30 WATERWAYAXIS: "waterwayaxis",
0a6b2ace7b7e Gauge measurement, Fairway availability implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 1747
diff changeset
31 GAUGEMEASUREMENT: "gaugemeasurement",
1789
4a7aa3f57efe importschedule: frontend for WW_Area and Fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1770
diff changeset
32 FAIRWAYAVAILABILITY: "fairwayavailability",
4a7aa3f57efe importschedule: frontend for WW_Area and Fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1770
diff changeset
33 WATERWAYAREA: "waterwayarea",
1858
108a049c8394 importqueue: fairwaydimensions removed typos. should work now
Thomas Junk <thomas.junk@intevation.de>
parents: 1857
diff changeset
34 FAIRWAYDIMENSION: "fairwaydimension",
1863
3bf2e5a91e50 import: distance marks virtual added
Thomas Junk <thomas.junk@intevation.de>
parents: 1858
diff changeset
35 WATERWAYGAUGES: "waterwaygauges",
3bf2e5a91e50 import: distance marks virtual added
Thomas Junk <thomas.junk@intevation.de>
parents: 1858
diff changeset
36 DISTANCEMARKSVIRTUAL: "distancemarksvirtual"
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
37 };
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
38
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
39 const SCHEDULES = {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
40 DAILY: "daily",
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
41 MONTHLY: "monthly"
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
42 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
43
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
44 const IMPORTTYPEKIND = {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
45 bottleneck: "bn",
1765
f73fc7e5b51a fix: typo »fairwayawailability« m(
Thomas Junk <thomas.junk@intevation.de>
parents: 1762
diff changeset
46 fairwayavailability: "fa",
1762
f567ede52fa6 Fixed kind key for gaugemeasurement in client.
Sascha Wilde <wilde@intevation.de>
parents: 1749
diff changeset
47 gaugemeasurement: "gm",
1789
4a7aa3f57efe importschedule: frontend for WW_Area and Fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1770
diff changeset
48 waterwayaxis: "wx",
4a7aa3f57efe importschedule: frontend for WW_Area and Fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1770
diff changeset
49 waterwayarea: "wa",
1858
108a049c8394 importqueue: fairwaydimensions removed typos. should work now
Thomas Junk <thomas.junk@intevation.de>
parents: 1857
diff changeset
50 fairwaydimension: "fd",
1863
3bf2e5a91e50 import: distance marks virtual added
Thomas Junk <thomas.junk@intevation.de>
parents: 1858
diff changeset
51 waterwaygauges: "wg",
3bf2e5a91e50 import: distance marks virtual added
Thomas Junk <thomas.junk@intevation.de>
parents: 1858
diff changeset
52 distancemarksvirtual: "dmv"
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
53 };
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
54
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
55 const KINDIMPORTTYPE = {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
56 bn: "bottleneck",
1765
f73fc7e5b51a fix: typo »fairwayawailability« m(
Thomas Junk <thomas.junk@intevation.de>
parents: 1762
diff changeset
57 fa: "fairwayavailability",
1770
ad9622a3f751 gauge measurement
Thomas Junk <thomas.junk@intevation.de>
parents: 1769
diff changeset
58 gm: "gaugemeasurement",
1789
4a7aa3f57efe importschedule: frontend for WW_Area and Fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1770
diff changeset
59 wx: "waterwayaxis",
4a7aa3f57efe importschedule: frontend for WW_Area and Fairwaydimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1770
diff changeset
60 wa: "waterwayarea",
1858
108a049c8394 importqueue: fairwaydimensions removed typos. should work now
Thomas Junk <thomas.junk@intevation.de>
parents: 1857
diff changeset
61 fd: "fairwaydimension",
1863
3bf2e5a91e50 import: distance marks virtual added
Thomas Junk <thomas.junk@intevation.de>
parents: 1858
diff changeset
62 wg: "waterwaygauge",
3bf2e5a91e50 import: distance marks virtual added
Thomas Junk <thomas.junk@intevation.de>
parents: 1858
diff changeset
63 dmv: "distancemarksvirtual"
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
64 };
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
65
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
66 const initializeCurrentSchedule = () => {
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
67 return {
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
68 id: null,
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
69 importType: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
70 schedule: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
71 import_: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
72 importSource: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
73 eMailNotification: false,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
74 scheduled: false,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
75 easyCron: true,
1791
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
76 cronString: "* * * * ",
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
77 cronMode: "",
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
78 minutes: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
79 month: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
80 hour: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
81 day: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
82 dayOfMonth: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
83 simple: null,
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
84 url: null,
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
85 insecure: false,
1791
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
86 triggerActive: true,
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
87 featureType: null,
1791
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
88 sortBy: null,
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
89 username: "",
1830
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
90 password: "",
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
91 LOS: null,
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
92 minWidth: null,
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
93 maxWidth: null,
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
94 depth: null,
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
95 sourceOrganization: null
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
96 };
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
97 };
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
98
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
99 // initial state
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
100 const init = () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
101 return {
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
102 stretches: [],
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
103 imports: [],
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
104 staging: [],
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
105 schedules: [],
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
106 importScheduleDetailVisible: false,
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
107 currentSchedule: initializeCurrentSchedule(),
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
108 importToReview: null
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
109 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
110 };
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
111
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
112 const imports = {
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
113 init,
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 namespaced: true,
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
115 state: init(),
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 mutations: {
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
117 setStretches: (state, stretches) => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
118 state.stretches = stretches;
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
119 },
1714
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
120 clearCurrentSchedule: state => {
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
121 state.currentSchedule = initializeCurrentSchedule();
1b25e7a3a92e importschedule: manage initial data from detailsview via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1711
diff changeset
122 },
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
123 setImportScheduleDetailInvisible: state => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
124 state.importScheduleDetailVisible = false;
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
125 },
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
126 setImportScheduleDetailVisible: state => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
127 state.importScheduleDetailVisible = true;
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
128 },
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
129 setSchedules: (state, schedules) => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
130 state.schedules = schedules;
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
131 },
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 setImports: (state, imports) => {
1173
3035ddd3d1a8 feat: importqueue
Thomas Junk <thomas.junk@intevation.de>
parents: 1142
diff changeset
133 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
134 },
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
135 setStaging: (state, staging) => {
1350
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
136 const enriched = staging.map(x => {
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
137 return { ...x, status: STATES.NEEDSAPPROVAL };
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
138 });
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
139 state.staging = enriched;
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
140 },
1650
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
141 setImportToReview: (state, id) => {
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
142 if (!isNaN(parseFloat(id)) && isFinite(id)) {
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
143 state.importToReview = id;
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
144 }
90211725e4a9 highlighing feature for staging area
Thomas Junk <thomas.junk@intevation.de>
parents: 1593
diff changeset
145 },
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
146 toggleApproval: (state, change) => {
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
147 const { id, newStatus } = change;
1350
58d41573e530 staging: now with real data from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1344
diff changeset
148 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
149 return e.id === id;
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
150 });
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
151 if (stagedResult.status === newStatus) {
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
152 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
153 } else {
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
154 stagedResult.status = newStatus;
1311
d5eda9f79610 staging: display visual feedback for now due missing backendcall
Thomas Junk <thomas.junk@intevation.de>
parents: 1310
diff changeset
155 }
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
156 },
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
157 unmarshallCurrentSchedule: (state, payload) => {
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
158 const { kind, id, cron, url, attributes } = payload;
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
159 const eMailNotification = payload["send-email"];
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
160 Vue.set(state.currentSchedule, "import_", KINDIMPORTTYPE[kind]);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
161 Vue.set(state.currentSchedule, "id", id);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
162 if (cron) {
1734
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
163 Vue.set(state.currentSchedule, "scheduled", true);
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
164 Vue.set(state.currentSchedule, "easyCron", false);
549337e6facd importschedule: POC edit functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
165 Vue.set(state.currentSchedule, "cronString", cron);
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
166 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
167 if (eMailNotification) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
168 Vue.set(state.currentSchedule, "eMailNotification", eMailNotification);
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 if (url) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
171 Vue.set(state.currentSchedule, "url", url);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
172 }
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
173 if (attributes) {
1867
954a099425df import: fairwaydimensions correct attribute names
Thomas Junk <thomas.junk@intevation.de>
parents: 1863
diff changeset
174 let { insecure, username, password, los, depth } = attributes;
1769
435612f42adb sort-by problem fixed
Thomas Junk <thomas.junk@intevation.de>
parents: 1765
diff changeset
175 let sortBy = attributes["sort-by"];
1867
954a099425df import: fairwaydimensions correct attribute names
Thomas Junk <thomas.junk@intevation.de>
parents: 1863
diff changeset
176 let minWidth = attributes["min-width"];
954a099425df import: fairwaydimensions correct attribute names
Thomas Junk <thomas.junk@intevation.de>
parents: 1863
diff changeset
177 let maxWidth = attributes["max-width"];
954a099425df import: fairwaydimensions correct attribute names
Thomas Junk <thomas.junk@intevation.de>
parents: 1863
diff changeset
178 let sourceOrganization = attributes["source-organization"];
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
179 const featureType = attributes["feature-type"];
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
180 insecure = insecure == "true";
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
181 if (insecure) {
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
182 Vue.set(state.currentSchedule, "insecure", insecure);
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
183 }
1747
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
184 if (featureType) {
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
185 Vue.set(state.currentSchedule, "featureType", featureType);
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
186 }
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
187 if (sortBy) {
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
188 Vue.set(state.currentSchedule, "sortBy", sortBy);
90178f4ce255 import waterway axis
Thomas Junk <thomas.junk@intevation.de>
parents: 1744
diff changeset
189 }
1791
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
190 if (username) {
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
191 Vue.set(state.currentSchedule, "username", username);
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
192 }
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
193 if (password) {
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
194 Vue.set(state.currentSchedule, "password", password);
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
195 }
1867
954a099425df import: fairwaydimensions correct attribute names
Thomas Junk <thomas.junk@intevation.de>
parents: 1863
diff changeset
196 if (los) {
954a099425df import: fairwaydimensions correct attribute names
Thomas Junk <thomas.junk@intevation.de>
parents: 1863
diff changeset
197 Vue.set(state.currentSchedule, "LOS", los);
1830
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
198 }
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
199 if (minWidth) {
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
200 Vue.set(state.currentSchedule, "minWidth", minWidth);
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
201 }
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
202 if (maxWidth) {
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
203 Vue.set(state.currentSchedule, "maxWidth", maxWidth);
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
204 }
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
205 if (depth) {
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
206 Vue.set(state.currentSchedule, "depth", depth);
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
207 }
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
208 if (sourceOrganization) {
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
209 Vue.set(
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
210 state.currentSchedule,
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
211 "sourceOrganization",
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
212 sourceOrganization
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
213 );
f1ac917ec4a0 import fairwaydimensions: added fields. PLUS TRANSLATIONS
Thomas Junk <thomas.junk@intevation.de>
parents: 1791
diff changeset
214 }
1744
ecd4ceccfd02 importschedule: insecure flag is now unmarshalled
Thomas Junk <thomas.junk@intevation.de>
parents: 1734
diff changeset
215 }
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
216 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
217 },
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
218 actions: {
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
219 loadStretches({ commit }) {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
220 return new Promise((resolve, reject) => {
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
221 var stretchesFeatureCollectionRequest = new WFS().writeGetFeature({
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
222 srsName: "EPSG:4326",
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
223 featureNS: "gemma",
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
224 featurePrefix: "gemma",
1946
f88773a2c0a0 import stretches: Take 'stretches_geoserver' not 'stretches'
Thomas Junk <thomas.junk@intevation.de>
parents: 1945
diff changeset
225 featureTypes: ["stretches_geoserver"],
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1946
diff changeset
226 outputFormat: "application/json",
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1946
diff changeset
227 filter: equalToFilter("staging_done", true)
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
228 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
229 HTTP.post(
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
230 "/internal/wfs",
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
231 new XMLSerializer().serializeToString(
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
232 stretchesFeatureCollectionRequest
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
233 ),
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
234 {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
235 headers: {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
236 "X-Gemma-Auth": localStorage.getItem("token"),
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
237 "Content-type": "text/xml; charset=UTF-8"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
238 }
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
239 }
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
240 )
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
241 .then(response => {
1945
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
242 if (response.data.features) {
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
243 commit("setStretches", response.data.features);
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
244 } else {
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
245 commit("setStretches", []);
f64bc12c1719 import stretches: minor fix
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
246 }
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
247 resolve(response);
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
248 })
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
249 .catch(error => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
250 reject(error);
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 });
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
253 },
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
254 saveStretch({ commit }, stretch) {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
255 return new Promise((resolve, reject) => {
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1889
diff changeset
256 HTTP.post("/imports/stretch", stretch, {
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
257 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
258 })
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
259 .then(response => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
260 resolve(response);
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
261 })
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
262 .catch(error => {
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
263 reject(error);
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 });
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1867
diff changeset
266 },
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
267 loadSchedule({ commit }, id) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
268 return new Promise((resolve, reject) => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
269 HTTP.get("/imports/config/" + id, {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
270 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
271 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
272 .then(response => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
273 commit("unmarshallCurrentSchedule", response.data);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
274 resolve(response);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
275 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
276 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
277 reject(error);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
278 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
279 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
280 },
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
281 deleteSchedule({ commit }, id) {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
282 return new Promise((resolve, reject) => {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
283 HTTP.delete("imports/config/" + id, {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
284 headers: {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
285 "X-Gemma-Auth": localStorage.getItem("token")
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
286 }
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
287 })
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
288 .then(response => {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
289 resolve(response);
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
290 })
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
291 .catch(error => {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
292 reject(error);
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
293 });
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
294 });
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
295 },
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
296 updateCurrentSchedule({ commit }, payload) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
297 const { data, id } = payload;
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
298 return new Promise((resolve, reject) => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
299 HTTP.patch("imports/config/" + id, data, {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
300 headers: {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
301 "X-Gemma-Auth": localStorage.getItem("token")
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
302 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
303 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
304 .then(response => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
305 resolve(response);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
306 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
307 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
308 reject(error);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
309 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
310 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
311 },
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
312 saveCurrentSchedule({ commit }, data) {
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
313 return new Promise((resolve, reject) => {
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
314 HTTP.post("imports/config", data, {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
315 headers: {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
316 "X-Gemma-Auth": localStorage.getItem("token")
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
317 }
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
318 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
319 .then(response => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
320 resolve(response);
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
321 })
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
322 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
323 reject(error);
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1725
diff changeset
324 });
1724
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
325 });
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
326 },
79a18eb1672b import: POC import saveable
Thomas Junk <thomas.junk@intevation.de>
parents: 1714
diff changeset
327 loadSchedules({ commit }) {
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
328 return new Promise((resolve, reject) => {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
329 HTTP.get("/imports/config", {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
330 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
331 })
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
332 .then(response => {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
333 commit("setSchedules", response.data);
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
334 resolve(response);
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
335 })
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
336 .catch(error => {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
337 reject(error);
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
338 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
339 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1709
diff changeset
340 },
1709
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
341 triggerImport({ commit }, { type, data }) {
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
342 return new Promise((resolve, reject) => {
1709
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
343 HTTP.post("imports/" + type, data, {
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
344 headers: {
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
345 "X-Gemma-Auth": localStorage.getItem("token")
8ff8d873ef6b refac: trigger manual import via store
Thomas Junk <thomas.junk@intevation.de>
parents: 1650
diff changeset
346 }
1429
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
347 })
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
348 .then(response => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
349 resolve(response);
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
350 })
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
351 .catch(error => {
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
352 reject(error);
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
353 });
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
354 });
f4b3fb43b311 automatic imports WIP added
Thomas Junk <thomas.junk@intevation.de>
parents: 1365
diff changeset
355 },
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
356 getImports({ commit }) {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
357 return new Promise((resolve, reject) => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
358 HTTP.get("/imports", {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
359 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
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 .then(response => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
362 commit("setImports", response.data.imports);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
363 resolve(response);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
364 })
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
365 .catch(error => {
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
366 reject(error);
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
367 });
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
368 });
1310
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
369 },
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
370 getStaging({ commit }) {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
371 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
372 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
373 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
374 })
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
375 .then(response => {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
376 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
377 resolve(response);
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
378 })
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
379 .catch(error => {
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
380 reject(error);
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
381 });
d675e6439aa5 staging view: prepare retrieving list of pending imports for staging
Thomas Junk <thomas.junk@intevation.de>
parents: 1296
diff changeset
382 });
1142
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
383 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
384 }
dc3f0277628a feat: Importqueue listing (Proof of concept)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
385 };
1344
eda98694e678 staging: retrieve real data instead of displaying demodata
Thomas Junk <thomas.junk@intevation.de>
parents: 1311
diff changeset
386
1791
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
387 export {
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
388 imports,
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
389 STATES,
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
390 SCHEDULES,
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
391 IMPORTTYPES,
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
392 IMPORTTYPEKIND,
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
393 initializeCurrentSchedule
0f98ef2531a5 importschedule: frontend for waterway gauges etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1789
diff changeset
394 };