annotate client/src/components/importconfiguration/Import.vue @ 2972:6f351e00e579 unified_import

unified_imports: initial layout etd
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 08 Apr 2019 15:50:23 +0200
parents 8b32574bed09
children e161e1ffb6b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2968
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
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>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
61 <div class="d-flex flex-row-reverse w-100 mb-3">
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="1"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
64 v-if="mode === $options.MODES.EDIT"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
65 @click="mode = $options.MODES.LIST"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
66 class="btn btn-warning mr-3"
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 Back
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 <button
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
71 :key="2"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
72 v-if="mode === $options.MODES.EDIT"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
73 type="submit"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
74 class="shadow-sm btn btn-info submit-button mr-3"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
75 >
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
76 <translate>Submit</translate>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
77 </button>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
78 <button
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
79 :key="3"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
80 v-if="mode === $options.MODES.LIST"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
81 @click="newConfiguration()"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
82 class="btn btn-info mr-3"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
83 >
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
84 <translate>New import</translate>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
85 </button>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
86 <button
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
87 v-if="mode === $options.MODES.EDIT && !isOnetime"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
88 @click="triggerManualImport"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
89 type="button"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
90 class="shadow-sm btn btn-outline-info trigger mr-auto ml-3"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
91 >
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
92 <font-awesome-icon class="fa-fw mr-2" fixed-width icon="play" />
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
93 <translate>Trigger import</translate>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
94 </button>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
95 </div>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
96 </div>
2968
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 </template>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 <style></style>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 <script>
2972
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
102 /* 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
103 * 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
104 *
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
105 * SPDX-License-Identifier: AGPL-3.0-or-later
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
106 * License-Filename: LICENSES/AGPL-3.0.txt
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
107 *
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
108 * Copyright (C) 2018 by via donau
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
109 * – Österreichische Wasserstraßen-Gesellschaft mbH
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
110 * Software engineering by Intevation GmbH
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 * Author(s):
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
113 * Thomas Junk <thomas.junk@intevation.de>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
114 * Markus Kottländer <markus.kottlaender@intevation.de>
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
115 */
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
116 import { mapState } from "vuex";
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
117 import { displayInfo, displayError } from "@/lib/errors";
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
118 import { HTTP } from "@/lib/http";
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
119 import {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
120 IMPORTTYPES
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
121 // IMPORTTYPEKIND,
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
122 // initializeCurrentSchedule
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
123 } from "@/store/importschedule";
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
124
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
125 export default {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
126 components: {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
127 ImportDetails: () => import("./ImportDetails.vue")
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 data() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
130 return {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
131 loading: false,
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
132 sortColumn: "",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
133 sortDirection: "",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
134 mode: this.$options.MODES.LIST
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
135 };
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
136 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
137 methods: {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
138 newConfiguration() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
139 this.mode = this.$options.MODES.EDIT;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
140 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
141 getSchedules() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
142 this.loading = true;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
143 this.$store
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
144 .dispatch("importschedule/loadSchedules")
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
145 .catch(error => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
146 const { status, data } = error.response;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
147 displayError({
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
148 title: this.$gettext("Backend Error"),
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
149 message: `${status}: ${data.message || data}`
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
150 });
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 .finally(() => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
153 this.loading = false;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
154 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
155 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
156 editSchedule(id) {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
157 this.$store
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
158 .dispatch("importschedule/loadSchedule", id)
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
159 .then(() => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
160 this.$store.commit("importschedule/setImportScheduleDetailVisible");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
161 })
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
162 .catch(error => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
163 const { status, data } = error.response;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
164 displayError({
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
165 title: this.$gettext("Backend Error"),
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
166 message: `${status}: ${data.message || data}`
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
167 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
168 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
169 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
170 triggerManualImport(id) {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
171 HTTP.get("/imports/config/" + id + "/run", {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
172 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
173 })
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
174 .then(response => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
175 const { id } = response.data;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
176 displayInfo({
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
177 title: this.$gettext("Imports"),
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
178 message: this.$gettext("Manually triggered import: #") + id
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
179 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
180 })
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
181 .catch(error => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
182 const { status, data } = error.response;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
183 displayError({
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
184 title: this.$gettext("Backend Error"),
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
185 message: `${status}: ${data.message || data}`
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
186 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
187 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
188 }
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
189 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
190 computed: {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
191 ...mapState("application", ["searchQuery"]),
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
192 ...mapState("importschedule", [
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
193 "schedules",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
194 "currentSchedule",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
195 "importScheduleDetailVisible"
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
196 ]),
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
197 isOnetime() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
198 for (let kind of [
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
199 this.$options.IMPORTTYPES.SOUNDINGRESULTS,
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
200 this.$options.IMPORTTYPES.APPROVEDGAUGEMEASUREMENTS,
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
201 this.$options.IMPORTTYPES.WATERWAYPROFILES
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
202 ]) {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
203 if (kind === this.currentSchedule.importType) return true;
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 return false;
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
206 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
207 title() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
208 return this.$gettext("Imports");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
209 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
210 filteredSchedules() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
211 return this.schedules.filter(s => {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
212 return (s.id + s.kind)
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
213 .toLowerCase()
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
214 .includes(this.searchQuery.toLowerCase());
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
215 });
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
216 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
217 importScheduleLabel() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
218 return this.$gettext("Import Schedule");
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 idLabel() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
221 return this.$gettext("ID");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
222 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
223 typeLabel() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
224 return this.$gettext("Type");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
225 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
226 authorLabel() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
227 return this.$gettext("Author");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
228 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
229 scheduleLabel() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
230 return this.$gettext("Schedule");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
231 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
232 emailLabel() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
233 return this.$gettext("Email");
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
234 }
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
235 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
236 mounted() {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
237 this.getSchedules();
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
238 },
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
239 MODES: {
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
240 LIST: "list",
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
241 EDIT: "edit"
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 IMPORTTYPES: IMPORTTYPES
6f351e00e579 unified_imports: initial layout etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2968
diff changeset
244 };
2968
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
245 </script>