Mercurial > gemma
annotate client/src/components/importconfiguration/Import.vue @ 2980:a9b61290fcc2 unified_import
unified_imports: edit capabilities added
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 09 Apr 2019 16:23:26 +0200 |
parents | 8f266dc8b4e3 |
children | 1b8bb4f89227 |
rev | line source |
---|---|
2968 | 1 <template> |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
2 <div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
3 <UIBoxHeader icon="clock" :title="title" /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
4 <div v-if="mode === $options.MODES.LIST" class="mb-3"> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
5 <UISpinnerOverlay v-if="loading" /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
6 <UITableHeader |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
7 :columns="[ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
8 { id: 'id', title: `${idLabel}`, class: 'col-1' }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
9 { id: 'kind', title: `${typeLabel}`, class: 'col-2' }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
10 { id: 'user', title: `${authorLabel}`, class: 'col-2' }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
11 { id: 'config.cron', title: `${scheduleLabel}`, class: 'col-2' }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
12 { id: 'config.send-email', title: `${emailLabel}`, class: 'col-2' } |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
13 ]" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
14 /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
15 <UITableBody |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
16 :data="filteredSchedules | sortTable(sortColumn, sortDirection)" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
17 :isActive="item => currentSchedule && item.id === currentSchedule.id" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
18 > |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
19 <template v-slot:row="{ item: schedule }"> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
20 <div class="table-cell col-1">{{ schedule.id }}</div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
21 <div class="table-cell col-2"> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
22 {{ schedule.kind.toUpperCase() }} |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
23 </div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
24 <div class="table-cell col-2">{{ schedule.user }}</div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
25 <div class="table-cell col-2">{{ schedule.config.cron }}</div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
26 <div class="table-cell col-2"> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
27 <font-awesome-icon |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
28 v-if="schedule.config['send-email']" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
29 class="fa-fw mr-2" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
30 fixed-width |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
31 icon="check" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
32 /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
33 </div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
34 <div class="table-cell col justify-content-end"> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
35 <button |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
36 @click="triggerManualImport(schedule.id)" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
37 class="btn btn-xs btn-dark mr-1" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
38 :disabled="importScheduleDetailVisible" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
39 > |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
40 <font-awesome-icon icon="play" fixed-width /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
41 </button> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
42 <button |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
43 @click="editSchedule(schedule.id)" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
44 class="btn btn-xs btn-dark mr-1" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
45 :disabled="importScheduleDetailVisible" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
46 > |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
47 <font-awesome-icon icon="pencil-alt" fixed-width /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
48 </button> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
49 <button |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
50 @click="deleteSchedule(schedule)" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
51 class="btn btn-xs btn-dark" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
52 :disabled="importScheduleDetailVisible" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
53 > |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
54 <font-awesome-icon icon="trash" fixed-width /> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
55 </button> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
56 </div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
57 </template> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
58 </UITableBody> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
59 </div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
60 <ImportDetails v-if="mode === $options.MODES.EDIT"></ImportDetails> |
2979
8f266dc8b4e3
unified_imports: moved imports partially to new UI
Thomas Junk <thomas.junk@intevation.de>
parents:
2975
diff
changeset
|
61 <div class="d-flex flex-row w-100 mb-3"> |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
62 <button |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
63 :key="3" |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
64 v-if="mode === $options.MODES.LIST && !isOnetime" |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
65 @click="newConfiguration()" |
2979
8f266dc8b4e3
unified_imports: moved imports partially to new UI
Thomas Junk <thomas.junk@intevation.de>
parents:
2975
diff
changeset
|
66 class="ml-auto btn btn-info mr-3" |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
67 > |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
68 <translate>New import</translate> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
69 </button> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
70 </div> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
71 </div> |
2968 | 72 </template> |
73 | |
74 <style></style> | |
75 | |
76 <script> | |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
77 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
78 * without warranty, see README.md and license for details. |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
79 * |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
80 * SPDX-License-Identifier: AGPL-3.0-or-later |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
81 * License-Filename: LICENSES/AGPL-3.0.txt |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
82 * |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
83 * Copyright (C) 2018 by via donau |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
84 * – Österreichische Wasserstraßen-Gesellschaft mbH |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
85 * Software engineering by Intevation GmbH |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
86 * |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
87 * Author(s): |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
88 * Thomas Junk <thomas.junk@intevation.de> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
89 * Markus Kottländer <markus.kottlaender@intevation.de> |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
90 */ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
91 import { mapState } from "vuex"; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
92 import { displayInfo, displayError } from "@/lib/errors"; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
93 import { HTTP } from "@/lib/http"; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
94 import { |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
95 IMPORTTYPES, |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
96 MODES |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
97 // IMPORTTYPEKIND, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
98 // initializeCurrentSchedule |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
99 } from "@/store/importschedule"; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
100 |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
101 export default { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
102 components: { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
103 ImportDetails: () => import("./ImportDetails.vue") |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
104 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
105 data() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
106 return { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
107 loading: false, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
108 sortColumn: "", |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
109 sortDirection: "" |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
110 }; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
111 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
112 methods: { |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
113 back() { |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
114 this.$store.commit("importschedule/setListMode"); |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
115 }, |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
116 newConfiguration() { |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
117 this.$store.commit("importschedule/setEditMode"); |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
118 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
119 getSchedules() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
120 this.loading = true; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
121 this.$store |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
122 .dispatch("importschedule/loadSchedules") |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
123 .catch(error => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
124 const { status, data } = error.response; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
125 displayError({ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
126 title: this.$gettext("Backend Error"), |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
127 message: `${status}: ${data.message || data}` |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
128 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
129 }) |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
130 .finally(() => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
131 this.loading = false; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
132 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
133 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
134 editSchedule(id) { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
135 this.$store |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
136 .dispatch("importschedule/loadSchedule", id) |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
137 .then(() => { |
2980
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
138 this.$store.commit("importschedule/setEditMode"); |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
139 }) |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
140 .catch(error => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
141 const { status, data } = error.response; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
142 displayError({ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
143 title: this.$gettext("Backend Error"), |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
144 message: `${status}: ${data.message || data}` |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
145 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
146 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
147 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
148 triggerManualImport(id) { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
149 HTTP.get("/imports/config/" + id + "/run", { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
150 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
151 }) |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
152 .then(response => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
153 const { id } = response.data; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
154 displayInfo({ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
155 title: this.$gettext("Imports"), |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
156 message: this.$gettext("Manually triggered import: #") + id |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
157 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
158 }) |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
159 .catch(error => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
160 const { status, data } = error.response; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
161 displayError({ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
162 title: this.$gettext("Backend Error"), |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
163 message: `${status}: ${data.message || data}` |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
164 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
165 }); |
2980
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
166 }, |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
167 deleteSchedule(schedule) { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
168 console.log(schedule); |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
169 this.$store.commit("application/popup", { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
170 icon: "trash", |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
171 title: this.$gettext("Delete Import"), |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
172 content: |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
173 this.$gettext("Do you really want to delete the import with ID") + |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
174 `<b>${schedule.id}</b>` + |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
175 this.$gettext("of type") + |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
176 `<b>${schedule.kind.toUpperCase()}</b>?`, |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
177 confirm: { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
178 label: this.$gettext("Delete"), |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
179 icon: "trash", |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
180 callback: () => { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
181 this.$store |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
182 .dispatch("importschedule/deleteSchedule", schedule.id) |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
183 .then(() => { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
184 this.getSchedules(); |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
185 displayInfo({ |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
186 title: this.$gettext("Imports"), |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
187 message: this.$gettext("Deleted import: #") + schedule.id |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
188 }); |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
189 }) |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
190 .catch(error => { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
191 const { status, data } = error.response; |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
192 displayError({ |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
193 title: this.$gettext("Backend Error"), |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
194 message: `${status}: ${data.message || data}` |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
195 }); |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
196 }); |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
197 } |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
198 }, |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
199 cancel: { |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
200 label: this.$gettext("Cancel"), |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
201 icon: "times" |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
202 } |
a9b61290fcc2
unified_imports: edit capabilities added
Thomas Junk <thomas.junk@intevation.de>
parents:
2979
diff
changeset
|
203 }); |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
204 } |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
205 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
206 computed: { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
207 ...mapState("application", ["searchQuery"]), |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
208 ...mapState("importschedule", [ |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
209 "mode", |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
210 "schedules", |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
211 "currentSchedule", |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
212 "importScheduleDetailVisible" |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
213 ]), |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
214 isOnetime() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
215 for (let kind of [ |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
216 this.$options.IMPORTTYPES.SOUNDINGRESULTS, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
217 this.$options.IMPORTTYPES.APPROVEDGAUGEMEASUREMENTS, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
218 this.$options.IMPORTTYPES.WATERWAYPROFILES |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
219 ]) { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
220 if (kind === this.currentSchedule.importType) return true; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
221 } |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
222 return false; |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
223 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
224 title() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
225 return this.$gettext("Imports"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
226 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
227 filteredSchedules() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
228 return this.schedules.filter(s => { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
229 return (s.id + s.kind) |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
230 .toLowerCase() |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
231 .includes(this.searchQuery.toLowerCase()); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
232 }); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
233 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
234 importScheduleLabel() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
235 return this.$gettext("Import Schedule"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
236 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
237 idLabel() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
238 return this.$gettext("ID"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
239 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
240 typeLabel() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
241 return this.$gettext("Type"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
242 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
243 authorLabel() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
244 return this.$gettext("Author"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
245 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
246 scheduleLabel() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
247 return this.$gettext("Schedule"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
248 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
249 emailLabel() { |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
250 return this.$gettext("Email"); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
251 } |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
252 }, |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
253 mounted() { |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
254 this.$store.commit("importschedule/setListMode"); |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
255 this.$store.commit("importschedule/clearCurrentSchedule"); |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
256 this.getSchedules(); |
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
257 }, |
2974
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
258 IMPORTTYPES: IMPORTTYPES, |
e161e1ffb6b5
unified_imports: AGM moved to new interface
Thomas Junk <thomas.junk@intevation.de>
parents:
2972
diff
changeset
|
259 MODES: MODES |
2972
6f351e00e579
unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2968
diff
changeset
|
260 }; |
2968 | 261 </script> |