Mercurial > gemma
annotate client/src/store/importschedule.js @ 4905:8cb201b551b3 fairway-marks-import
Replace bogus usage of pointer for type intrusion
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 07 Feb 2020 12:23:46 +0100 |
parents | 1f2d90312ac6 |
children | ab184888d58b |
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 | 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", |
b55120fa8913
add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents:
3777
diff
changeset
|
34 FAIRWAYMARKS: "fairwaymarks" |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
37 const KINDIMPORTTYPE = { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
38 bn: "bottleneck", |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
39 fa: "fairwayavailability", |
4870
b55120fa8913
add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents:
3777
diff
changeset
|
40 fm: "fairwaymarks", |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
41 gm: "gaugemeasurement", |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
42 wx: "waterwayaxis", |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
43 wa: "waterwayarea", |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
44 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
|
45 wg: "waterwaygauges", |
2068 | 46 dmv: "distancemarksvirtual", |
47 dma: "distancemarksashore" | |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
48 }; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
49 |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 const IMPORTTYPEKIND = { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 bottleneck: "bn", |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 fairwayavailability: "fa", |
4870
b55120fa8913
add fairway marks import as schedulable import
Thomas Junk <thomas.junk@intevation.de>
parents:
3777
diff
changeset
|
53 fairwaymarks: "fm", |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 gaugemeasurement: "gm", |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
55 waterwayaxis: "wx", |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
56 waterwayarea: "wa", |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 fairwaydimension: "fd", |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 waterwaygauges: "wg", |
2068 | 59 distancemarksvirtual: "dmv", |
60 distancemarksashore: "dma" | |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
63 const initializeCurrentSchedule = () => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
64 return { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 id: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 importType: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 schedule: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 importSource: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 eMailNotification: false, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 scheduled: false, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
71 easyCron: true, |
2344
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
72 cronString: "0 */15 * * * *", |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
73 cronMode: "15minutes", |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
74 minutes: 0, |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
75 month: 1, |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
76 hour: 0, |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
77 day: 0, |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
78 dayOfMonth: 1, |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
79 simple: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
80 url: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
81 insecure: false, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
82 triggerActive: true, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
83 featureType: null, |
2295
b6cd295bf75d
import_schedule: default for sort-by: 'hydro_scamin'
Thomas Junk <thomas.junk@intevation.de>
parents:
2099
diff
changeset
|
84 sortBy: "hydro_scamin", |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2377
diff
changeset
|
85 tolerance: 5, |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 username: "", |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
87 password: "", |
2099
1baae9d31b3d
importschedule: LOS fixed, default level=3
Thomas Junk <thomas.junk@intevation.de>
parents:
2068
diff
changeset
|
88 LOS: 3, |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
89 minWidth: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 maxWidth: null, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 depth: null, |
2998
adc8e9ccf706
imports: add tries and wait-retry to client
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
92 sourceOrganization: null, |
adc8e9ccf706
imports: add tries and wait-retry to client
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
93 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
|
94 waitRetry: null, |
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
|
95 selectedMark: null |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
99 const MODES = { |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
100 LIST: "list", |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
101 EDIT: "edit" |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
102 }; |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
103 |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 // initial state |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 const init = () => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 return { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 schedules: [], |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 importScheduleDetailVisible: false, |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
109 currentSchedule: initializeCurrentSchedule(), |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
110 mode: MODES.LIST |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 const importschedule = { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 init, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 namespaced: true, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 state: init(), |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 mutations: { |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
119 setEditMode: state => { |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
120 state.mode = MODES.EDIT; |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
121 }, |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
122 setListMode: state => { |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
123 state.currentSchedule = initializeCurrentSchedule(); |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
124 state.mode = MODES.LIST; |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
125 }, |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2563
diff
changeset
|
126 setImportType: (state, type) => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2563
diff
changeset
|
127 Vue.set(state.currentSchedule, "importType", type); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2563
diff
changeset
|
128 }, |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 clearCurrentSchedule: state => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
130 state.currentSchedule = initializeCurrentSchedule(); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
132 setImportScheduleDetailInvisible: state => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
133 state.importScheduleDetailVisible = false; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
135 setImportScheduleDetailVisible: state => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
136 state.importScheduleDetailVisible = true; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
138 setSchedules: (state, schedules) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
139 state.schedules = schedules; |
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 unmarshallCurrentSchedule: (state, payload) => { |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
142 const { kind, config, id } = payload; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
143 const eMailNotification = config["send-email"]; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
144 const { cron, url } = config; |
2979
8f266dc8b4e3
unified_imports: moved imports partially to new UI
Thomas Junk <thomas.junk@intevation.de>
parents:
2974
diff
changeset
|
145 Vue.set(state.currentSchedule, "importType", KINDIMPORTTYPE[kind]); |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
146 Vue.set(state.currentSchedule, "id", id); |
3777
c373758ca2df
client: Improved import retry ui.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2998
diff
changeset
|
147 Vue.set(state.currentSchedule, "trys", config["trys"]); |
c373758ca2df
client: Improved import retry ui.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2998
diff
changeset
|
148 Vue.set(state.currentSchedule, "waitRetry", config["wait-retry"]); |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
149 if (cron) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
150 Vue.set(state.currentSchedule, "scheduled", true); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
151 Vue.set(state.currentSchedule, "cronString", cron); |
2344
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
152 // simple weekly or monthly? |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
153 if (cron === "0 0 0 * * 0") { |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
154 Vue.set(state.currentSchedule, "simple", "weekly"); |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
155 Vue.set(state.currentSchedule, "easyCron", true); |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
156 } else if (cron === "0 0 0 1 * *") { |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
157 Vue.set(state.currentSchedule, "simple", "monthly"); |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
158 Vue.set(state.currentSchedule, "easyCron", true); |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
159 } else { |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
160 Vue.set(state.currentSchedule, "easyCron", false); |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
161 } |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
162 |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
163 // 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
|
164 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
|
165 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
|
166 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
|
167 else if (/^0 \d{1,2} \* \* \* \*$/.test(cron)) |
2344
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 Vue.set(state.currentSchedule, "cronMode", "year"); |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
177 |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
178 // set minute, hour, etc from cronString |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
179 let cronConf = cron.match( |
a5b87a695469
client: imports: fixed cron string
Markus Kottlaender <markus@intevation.de>
parents:
2312
diff
changeset
|
180 /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
|
181 ); |
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
|
182 |
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
|
183 // 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
|
184 // 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
|
185 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
|
186 // 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
|
187 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
|
188 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
|
189 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
|
190 ); |
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
|
191 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
|
192 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
|
193 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
|
194 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
|
195 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
|
196 } |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
197 } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
198 if (eMailNotification) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
199 Vue.set(state.currentSchedule, "eMailNotification", eMailNotification); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
200 } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
201 if (url) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
202 Vue.set(state.currentSchedule, "url", url); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
203 } |
2312
b87211f595ae
import-schedule: fix edit waterway gauge import. transmitting cedentials correctly
Thomas Junk <thomas.junk@intevation.de>
parents:
2311
diff
changeset
|
204 let { insecure, user, password, los, depth } = config; |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
205 let sortBy = config["sort-by"]; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
206 let minWidth = config["min-width"]; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
207 let maxWidth = config["max-width"]; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
208 let sourceOrganization = config["source-organization"]; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
209 const featureType = config["feature-type"]; |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2377
diff
changeset
|
210 const tolerance = config["tolerance"]; |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
211 insecure = insecure == "true"; |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
212 if (insecure) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
213 Vue.set(state.currentSchedule, "insecure", insecure); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
214 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
215 if (featureType) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
216 Vue.set(state.currentSchedule, "featureType", featureType); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
217 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
218 if (sortBy) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
219 Vue.set(state.currentSchedule, "sortBy", sortBy); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
220 } |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2377
diff
changeset
|
221 if (tolerance) { |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2377
diff
changeset
|
222 Vue.set(state.currentSchedule, "tolerance", tolerance); |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2377
diff
changeset
|
223 } |
2312
b87211f595ae
import-schedule: fix edit waterway gauge import. transmitting cedentials correctly
Thomas Junk <thomas.junk@intevation.de>
parents:
2311
diff
changeset
|
224 if (user) { |
b87211f595ae
import-schedule: fix edit waterway gauge import. transmitting cedentials correctly
Thomas Junk <thomas.junk@intevation.de>
parents:
2311
diff
changeset
|
225 Vue.set(state.currentSchedule, "username", user); |
2061
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
226 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
227 if (password) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
228 Vue.set(state.currentSchedule, "password", password); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
229 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
230 if (los) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
231 Vue.set(state.currentSchedule, "LOS", los); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
232 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
233 if (minWidth) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
234 Vue.set(state.currentSchedule, "minWidth", minWidth); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
235 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
236 if (maxWidth) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
237 Vue.set(state.currentSchedule, "maxWidth", maxWidth); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
238 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
239 if (depth) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
240 Vue.set(state.currentSchedule, "depth", depth); |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
241 } |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
242 if (sourceOrganization) { |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
243 Vue.set( |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
244 state.currentSchedule, |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
245 "sourceOrganization", |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
246 sourceOrganization |
4a0d4e50768d
frontend adapted to new backend
Thomas Junk <thomas.junk@intevation.de>
parents:
2034
diff
changeset
|
247 ); |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
248 } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
249 } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
250 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
251 actions: { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
252 loadSchedule({ commit }, id) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
253 return new Promise((resolve, reject) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
254 HTTP.get("/imports/config/" + id, { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
255 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
256 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
257 .then(response => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
258 commit("unmarshallCurrentSchedule", response.data); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
259 resolve(response); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
260 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
261 .catch(error => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
262 reject(error); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
263 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
264 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
265 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
266 updateCurrentSchedule({ commit }, payload) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
267 const { data, id } = payload; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
268 return new Promise((resolve, reject) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
269 HTTP.patch("imports/config/" + id, data, { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
270 headers: { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
271 "X-Gemma-Auth": localStorage.getItem("token") |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
272 } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
273 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
274 .then(response => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
275 resolve(response); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
276 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
277 .catch(error => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
278 reject(error); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
279 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
280 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
281 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
282 saveCurrentSchedule({ commit }, data) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
283 return new Promise((resolve, reject) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
284 HTTP.post("imports/config", data, { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
285 headers: { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
286 "X-Gemma-Auth": localStorage.getItem("token") |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
287 } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
288 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
289 .then(response => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
290 resolve(response); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
291 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
292 .catch(error => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
293 reject(error); |
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 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
296 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
297 loadSchedules({ commit }) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
298 return new Promise((resolve, reject) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
299 HTTP.get("/imports/config", { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
300 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
301 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
302 .then(response => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
303 commit("setSchedules", response.data); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
304 resolve(response); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
305 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
306 .catch(error => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
307 reject(error); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
308 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
309 }); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
310 }, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
311 deleteSchedule({ commit }, id) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
312 return new Promise((resolve, reject) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
313 HTTP.delete("imports/config/" + id, { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
314 headers: { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
315 "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 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
318 .then(response => { |
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 triggerImport({ commit }, { type, data }) { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
327 return new Promise((resolve, reject) => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
328 HTTP.post("imports/" + type, data, { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
329 headers: { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
330 "X-Gemma-Auth": localStorage.getItem("token") |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
331 } |
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 .then(response => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
334 resolve(response); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
335 }) |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
336 .catch(error => { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
337 reject(error); |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
338 }); |
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 }; |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
343 |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
344 export { |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
345 importschedule, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
346 initializeCurrentSchedule, |
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
347 IMPORTTYPES, |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
348 IMPORTTYPEKIND, |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
349 MODES |
2034
cc3ad4aa9b2f
importschedule: add store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
350 }; |