annotate client/src/store/importschedule.js @ 5467:df1b2c5ae541

Removed another stray debugger statement.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 19 Jul 2021 16:17:08 +0200
parents 064ac1014713
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 * without warranty, see README.md and license for details.
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 *
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 *
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 * Copyright (C) 2018 by via donau
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 * Software engineering by Intevation GmbH
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 *
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 * Author(s):
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 * Thomas Junk <thomas.junk@intevation.de>
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 */
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14
4870
b55120fa8913 add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents: 3777
diff changeset
15 import { HTTP } from "@/lib/http";
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 import Vue from "vue";
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 /* eslint-disable no-unused-vars */
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 /* eslint-disable no-unreachable */
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 const IMPORTTYPES = {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 BOTTLENECK: "bottleneck",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 WATERWAYAXIS: "waterwayaxis",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 GAUGEMEASUREMENT: "gaugemeasurement",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 FAIRWAYAVAILABILITY: "fairwayavailability",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 WATERWAYAREA: "waterwayarea",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 FAIRWAYDIMENSION: "fairwaydimension",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 WATERWAYGAUGES: "waterwaygauges",
2068
5a898da60b87 dma added
Thomas Junk <thomas.junk@intevation.de>
parents: 2061
diff changeset
29 DISTANCEMARKSVIRTUAL: "distancemarksvirtual",
2972
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2563
diff changeset
30 DISTANCEMARKSASHORE: "distancemarksashore",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2563
diff changeset
31 SOUNDINGRESULTS: "soundingresults",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2563
diff changeset
32 APPROVEDGAUGEMEASUREMENTS: "approvedgaugemeasurements",
4870
b55120fa8913 add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents: 3777
diff changeset
33 WATERWAYPROFILES: "waterwayprofiles",
5367
1695e17c5a83 Adds schedualbility for reports as an import.
Thomas Junk <thomas.junk@intevation.de>
parents: 5278
diff changeset
34 FAIRWAYMARKS: "fairwaymarks",
5388
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
35 REPORT: "report",
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
36 STATSUPDATE: "statsupdate"
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
39 const KINDIMPORTTYPE = {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
40 bn: "bottleneck",
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
41 fa: "fairwayavailability",
4870
b55120fa8913 add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents: 3777
diff changeset
42 fm: "fairwaymarks",
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
43 gm: "gaugemeasurement",
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
44 wx: "waterwayaxis",
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
45 wa: "waterwayarea",
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
46 fd: "fairwaydimension",
2311
716c0eba89a2 import_schedule: fixed typo. edit waterway gauges should preselect waterway gauges
Thomas Junk <thomas.junk@intevation.de>
parents: 2295
diff changeset
47 wg: "waterwaygauges",
2068
5a898da60b87 dma added
Thomas Junk <thomas.junk@intevation.de>
parents: 2061
diff changeset
48 dmv: "distancemarksvirtual",
5367
1695e17c5a83 Adds schedualbility for reports as an import.
Thomas Junk <thomas.junk@intevation.de>
parents: 5278
diff changeset
49 dma: "distancemarksashore",
5388
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
50 report: "report",
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
51 statsupdate: "statsupdate"
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
52 };
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
53
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 const IMPORTTYPEKIND = {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 bottleneck: "bn",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 fairwayavailability: "fa",
4870
b55120fa8913 add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents: 3777
diff changeset
57 fairwaymarks: "fm",
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 gaugemeasurement: "gm",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 waterwayaxis: "wx",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 waterwayarea: "wa",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 fairwaydimension: "fd",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 waterwaygauges: "wg",
2068
5a898da60b87 dma added
Thomas Junk <thomas.junk@intevation.de>
parents: 2061
diff changeset
63 distancemarksvirtual: "dmv",
5367
1695e17c5a83 Adds schedualbility for reports as an import.
Thomas Junk <thomas.junk@intevation.de>
parents: 5278
diff changeset
64 distancemarksashore: "dma",
5388
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
65 report: "report",
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
66 statsupdate: "statsupdate"
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68
4910
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
69 const FAIRWAYMARKKINDS = {
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
70 fm_bcnisd: "BCNISD",
4962
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4916
diff changeset
71 fm_bcnlat_hydro: "BCNLAT_hydro",
1b309a8e7673 Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents: 4916
diff changeset
72 fm_bcnlat_ienc: "bcnlat_ienc",
4910
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
73 fm_boycar: "BOYCAR",
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
74 fm_boyisd: "BOYISD",
4964
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
75 fm_boylat_hydro: "BOYLAT_hydro",
58dc06e91c39 Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents: 4962
diff changeset
76 fm_boylat_ienc: "boylat_ienc",
4910
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
77 fm_boysaw: "BOYSAW",
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
78 fm_boyspp: "BOYSPP",
4967
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
79 fm_daymar_hydro: "DAYMAR_hydro",
3f704ebad0c5 Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents: 4964
diff changeset
80 fm_daymar_ienc: "daymar_ienc",
4910
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
81 fm_lights: "LIGHTS",
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
82 fm_rtpbcn: "RTPBCN",
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
83 fm_topmar: "TOPMAR",
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
84 fm_notmrk: "notmrk"
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
85 };
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
86
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 const initializeCurrentSchedule = () => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 return {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 id: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 importType: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 schedule: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 importSource: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 eMailNotification: false,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 scheduled: false,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 easyCron: true,
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
96 cronString: "0 */15 * * * *",
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
97 cronMode: "15minutes",
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
98 minutes: 0,
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
99 month: 1,
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
100 hour: 0,
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
101 day: 0,
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
102 dayOfMonth: 1,
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 simple: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 url: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 insecure: false,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 triggerActive: true,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 featureType: null,
5278
8d19d4701f0c Fixed saving and use of SortBy in manually running saved imports.
wilde@azure1.rgb.intevation.de
parents: 4967
diff changeset
108 sortBy: "",
2563
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2377
diff changeset
109 tolerance: 5,
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 username: "",
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 password: "",
2099
1baae9d31b3d importschedule: LOS fixed, default level=3
Thomas Junk <thomas.junk@intevation.de>
parents: 2068
diff changeset
112 LOS: 3,
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 minWidth: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 maxWidth: null,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 depth: null,
2998
adc8e9ccf706 imports: add tries and wait-retry to client
Thomas Junk <thomas.junk@intevation.de>
parents: 2979
diff changeset
116 sourceOrganization: null,
adc8e9ccf706 imports: add tries and wait-retry to client
Thomas Junk <thomas.junk@intevation.de>
parents: 2979
diff changeset
117 trys: null,
4901
1f2d90312ac6 added dropdown to FM import to further specify the kind of fairwaymark to be imported
Thomas Junk <thomas.junk@intevation.de>
parents: 4870
diff changeset
118 waitRetry: null,
5388
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
119 selectedMark: null,
5396
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
120 statsUpdate: null,
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
121 reportName: null
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124
2974
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
125 const MODES = {
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
126 LIST: "list",
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
127 EDIT: "edit"
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
128 };
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
129
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
130 // initial state
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
131 const init = () => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 return {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 schedules: [],
5396
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
134 availableReports: null,
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 importScheduleDetailVisible: false,
2974
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
136 currentSchedule: initializeCurrentSchedule(),
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
137 mode: MODES.LIST
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
139 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
140
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 const importschedule = {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 init,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
143 namespaced: true,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
144 state: init(),
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
145 mutations: {
5396
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
146 setAvailableReports: (state, value) => {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
147 state.availableReports = value;
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
148 },
2974
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
149 setEditMode: state => {
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
150 state.mode = MODES.EDIT;
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
151 },
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
152 setListMode: state => {
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
153 state.currentSchedule = initializeCurrentSchedule();
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
154 state.mode = MODES.LIST;
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
155 },
2972
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2563
diff changeset
156 setImportType: (state, type) => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2563
diff changeset
157 Vue.set(state.currentSchedule, "importType", type);
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2563
diff changeset
158 },
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
159 clearCurrentSchedule: state => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
160 state.currentSchedule = initializeCurrentSchedule();
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
161 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
162 setImportScheduleDetailInvisible: state => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
163 state.importScheduleDetailVisible = false;
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
164 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
165 setImportScheduleDetailVisible: state => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
166 state.importScheduleDetailVisible = true;
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
167 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
168 setSchedules: (state, schedules) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
169 state.schedules = schedules;
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
170 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
171 unmarshallCurrentSchedule: (state, payload) => {
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
172 const { kind, config, id } = payload;
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
173 const eMailNotification = config["send-email"];
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
174 const { cron, url } = config;
4910
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
175 if (FAIRWAYMARKKINDS[kind]) {
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
176 Vue.set(state.currentSchedule, "importType", "fairwaymarks");
4916
d456621404c2 Make fairwaymark imports editable again.
Thomas Junk <thomas.junk@intevation.de>
parents: 4910
diff changeset
177 Vue.set(state.currentSchedule, "selectedMark", FAIRWAYMARKKINDS[kind]);
4910
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
178 } else {
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
179 Vue.set(state.currentSchedule, "importType", KINDIMPORTTYPE[kind]);
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
180 }
ab184888d58b wiring of import endpoints for fairwaymarks
Thomas Junk <thomas.junk@intevation.de>
parents: 4901
diff changeset
181
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
182 Vue.set(state.currentSchedule, "id", id);
3777
c373758ca2df client: Improved import retry ui.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2998
diff changeset
183 Vue.set(state.currentSchedule, "trys", config["trys"]);
c373758ca2df client: Improved import retry ui.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2998
diff changeset
184 Vue.set(state.currentSchedule, "waitRetry", config["wait-retry"]);
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
185 if (cron) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
186 Vue.set(state.currentSchedule, "scheduled", true);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
187 Vue.set(state.currentSchedule, "cronString", cron);
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
188 // simple weekly or monthly?
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
189 if (cron === "0 0 0 * * 0") {
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
190 Vue.set(state.currentSchedule, "simple", "weekly");
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
191 Vue.set(state.currentSchedule, "easyCron", true);
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
192 } else if (cron === "0 0 0 1 * *") {
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
193 Vue.set(state.currentSchedule, "simple", "monthly");
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
194 Vue.set(state.currentSchedule, "easyCron", true);
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
195 } else {
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
196 Vue.set(state.currentSchedule, "easyCron", false);
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
197 }
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
198
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
199 // set cronMode from cronString
2377
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
200 Vue.set(state.currentSchedule, "cronMode", null);
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
201 if (cron === "0 */15 * * * *")
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
202 Vue.set(state.currentSchedule, "cronMode", "15minutes");
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
203 else if (/^0 \d{1,2} \* \* \* \*$/.test(cron))
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
204 Vue.set(state.currentSchedule, "cronMode", "hour");
2377
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
205 else if (/^0 \d{1,2} \d{1,2} \* \* \*$/.test(cron))
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
206 Vue.set(state.currentSchedule, "cronMode", "day");
2377
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
207 else if (/^0 \d{1,2} \d{1,2} \* \* \d{1}$/.test(cron))
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
208 Vue.set(state.currentSchedule, "cronMode", "week");
2377
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
209 else if (/^0 \d{1,2} \d{1,2} \d{1,2} \* \*$/.test(cron))
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
210 Vue.set(state.currentSchedule, "cronMode", "month");
2377
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
211 else if (/^0 \d{1,2} \d{1,2} \d{1,2} \d{1,2} \*$/.test(cron))
2344
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
212 Vue.set(state.currentSchedule, "cronMode", "year");
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
213
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
214 // set minute, hour, etc from cronString
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
215 let cronConf = cron.match(
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
216 /0 (\d{1,2}|\*) (\d{1,2}|\*) (\d{1,2}|\*) (\d{1,2}|\*) (\d{1}|\*)/
a5b87a695469 client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents: 2312
diff changeset
217 );
2377
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
218
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
219 // if cronString could not be parsed/matched (cronConf is null),
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
220 // skip prefilling those values
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
221 if (cronConf) {
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
222 // remove first element which is the whole matched string
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
223 cronConf.shift();
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
224 cronConf = cronConf.map(field =>
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
225 field === "*" ? null : Number(field)
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
226 );
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
227 Vue.set(state.currentSchedule, "minutes", cronConf[0]);
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
228 Vue.set(state.currentSchedule, "hour", cronConf[1]);
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
229 Vue.set(state.currentSchedule, "dayOfMonth", cronConf[2]);
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
230 Vue.set(state.currentSchedule, "month", cronConf[3]);
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
231 Vue.set(state.currentSchedule, "day", cronConf[4]);
fdec7a652f34 client: imports: avoid error when cron string cannot be parsed when trying to edit imports
Markus Kottlaender <markus@intevation.de>
parents: 2344
diff changeset
232 }
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
233 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
234 if (eMailNotification) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
235 Vue.set(state.currentSchedule, "eMailNotification", eMailNotification);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
236 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
237 if (url) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
238 Vue.set(state.currentSchedule, "url", url);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
239 }
2312
b87211f595ae import-schedule: fix edit waterway gauge import. transmitting cedentials correctly
Thomas Junk <thomas.junk@intevation.de>
parents: 2311
diff changeset
240 let { insecure, user, password, los, depth } = config;
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
241 let sortBy = config["sort-by"];
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
242 let minWidth = config["min-width"];
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
243 let maxWidth = config["max-width"];
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
244 let sourceOrganization = config["source-organization"];
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
245 const featureType = config["feature-type"];
2563
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2377
diff changeset
246 const tolerance = config["tolerance"];
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
247 insecure = insecure == "true";
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
248 if (insecure) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
249 Vue.set(state.currentSchedule, "insecure", insecure);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
250 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
251 if (featureType) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
252 Vue.set(state.currentSchedule, "featureType", featureType);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
253 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
254 if (sortBy) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
255 Vue.set(state.currentSchedule, "sortBy", sortBy);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
256 }
2563
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2377
diff changeset
257 if (tolerance) {
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2377
diff changeset
258 Vue.set(state.currentSchedule, "tolerance", tolerance);
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2377
diff changeset
259 }
2312
b87211f595ae import-schedule: fix edit waterway gauge import. transmitting cedentials correctly
Thomas Junk <thomas.junk@intevation.de>
parents: 2311
diff changeset
260 if (user) {
b87211f595ae import-schedule: fix edit waterway gauge import. transmitting cedentials correctly
Thomas Junk <thomas.junk@intevation.de>
parents: 2311
diff changeset
261 Vue.set(state.currentSchedule, "username", user);
2061
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
262 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
263 if (password) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
264 Vue.set(state.currentSchedule, "password", password);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
265 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
266 if (los) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
267 Vue.set(state.currentSchedule, "LOS", los);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
268 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
269 if (minWidth) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
270 Vue.set(state.currentSchedule, "minWidth", minWidth);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
271 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
272 if (maxWidth) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
273 Vue.set(state.currentSchedule, "maxWidth", maxWidth);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
274 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
275 if (depth) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
276 Vue.set(state.currentSchedule, "depth", depth);
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
277 }
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
278 if (sourceOrganization) {
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
279 Vue.set(
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
280 state.currentSchedule,
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
281 "sourceOrganization",
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
282 sourceOrganization
4a0d4e50768d frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents: 2034
diff changeset
283 );
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
284 }
5388
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
285 if (kind === IMPORTTYPES.STATSUPDATE) {
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
286 const { name } = config;
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
287 Vue.set(state.currentSchedule, "statsUpdate", name);
60bba8e6322b Add import for updating stats.
Thomas Junk <thomas.junk@intevation.de>
parents: 5367
diff changeset
288 }
5396
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
289 if (kind === IMPORTTYPES.REPORT) {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
290 const { name } = config;
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
291 Vue.set(state.currentSchedule, "reportName", name);
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
292 }
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
293 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
294 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
295 actions: {
5396
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
296 loadAvailableReports({ commit }) {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
297 return new Promise((resolve, reject) => {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
298 HTTP.get("/data/reports", {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
299 headers: {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
300 "X-Gemma-Auth": localStorage.getItem("token")
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
301 }
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
302 })
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
303 .then(response => {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
304 commit("setAvailableReports", response.data.reports);
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
305 resolve(response);
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
306 })
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
307 .catch(error => {
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
308 reject(error);
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
309 });
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
310 });
064ac1014713 Make DQL-Downloads a bit more dynamic
Thomas Junk <thomas.junk@intevation.de>
parents: 5388
diff changeset
311 },
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
312 loadSchedule({ commit }, id) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
313 return new Promise((resolve, reject) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
314 HTTP.get("/imports/config/" + id, {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
315 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
316 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
317 .then(response => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
318 commit("unmarshallCurrentSchedule", response.data);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
319 resolve(response);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
320 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
321 .catch(error => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
322 reject(error);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
323 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
324 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
325 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
326 updateCurrentSchedule({ commit }, payload) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
327 const { data, id } = payload;
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
328 return new Promise((resolve, reject) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
329 HTTP.patch("imports/config/" + id, data, {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
330 headers: {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
331 "X-Gemma-Auth": localStorage.getItem("token")
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
332 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
333 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
334 .then(response => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
335 resolve(response);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
336 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
337 .catch(error => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
338 reject(error);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
339 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
340 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
341 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
342 saveCurrentSchedule({ commit }, data) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
343 return new Promise((resolve, reject) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
344 HTTP.post("imports/config", data, {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
345 headers: {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
346 "X-Gemma-Auth": localStorage.getItem("token")
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
347 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
348 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
349 .then(response => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
350 resolve(response);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
351 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
352 .catch(error => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
353 reject(error);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
354 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
355 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
356 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
357 loadSchedules({ commit }) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
358 return new Promise((resolve, reject) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
359 HTTP.get("/imports/config", {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
360 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
361 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
362 .then(response => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
363 commit("setSchedules", response.data);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
364 resolve(response);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
365 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
366 .catch(error => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
367 reject(error);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
368 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
369 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
370 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
371 deleteSchedule({ commit }, id) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
372 return new Promise((resolve, reject) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
373 HTTP.delete("imports/config/" + id, {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
374 headers: {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
375 "X-Gemma-Auth": localStorage.getItem("token")
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
376 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
377 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
378 .then(response => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
379 resolve(response);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
380 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
381 .catch(error => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
382 reject(error);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
383 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
384 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
385 },
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
386 triggerImport({ commit }, { type, data }) {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
387 return new Promise((resolve, reject) => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
388 HTTP.post("imports/" + type, data, {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
389 headers: {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
390 "X-Gemma-Auth": localStorage.getItem("token")
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
391 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
392 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
393 .then(response => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
394 resolve(response);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
395 })
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
396 .catch(error => {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
397 reject(error);
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
398 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
399 });
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
400 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
401 }
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
402 };
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
403
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
404 export {
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
405 importschedule,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
406 initializeCurrentSchedule,
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
407 IMPORTTYPES,
2974
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
408 IMPORTTYPEKIND,
e161e1ffb6b5 unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents: 2972
diff changeset
409 MODES
2034
cc3ad4aa9b2f importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
410 };