annotate client/src/components/importschedule/Importschedule.vue @ 2384:c06b001dc26b

client: improved popup implementation For deleting users and templates there was a more or less quick n' dirty implementation of a confirmation dialog/popup. Since we need this kind of dialog in several more places I generalized the implementation a bit and made it more robust.
author Markus Kottlaender <markus@intevation.de>
date Mon, 25 Feb 2019 13:11:30 +0100
parents f04d33fec01e
children f185503ef35a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div class="d-flex flex-row">
1606
a4d8f284db93 spacer in admin interface added
Thomas Junk <thomas.junk@intevation.de>
parents: 1575
diff changeset
3 <Spacer></Spacer>
1532
44e094330272 automatic imports: fields added
Thomas Junk <thomas.junk@intevation.de>
parents: 1529
diff changeset
4 <div class="mt-3 w-100">
44e094330272 automatic imports: fields added
Thomas Junk <thomas.junk@intevation.de>
parents: 1529
diff changeset
5 <div class="card flex-grow-1 schedulecard shadow-xs">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1455
diff changeset
6 <h6
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1455
diff changeset
7 class="mb-0 py-2 px-3 border-bottom d-flex text-info align-items-center"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1455
diff changeset
8 >
1455
33dda08d67be unified layout for adminsection
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
9 <font-awesome-icon icon="clock" class="mr-2"></font-awesome-icon>
1607
38f91897ca69 import sounding result in new section
Thomas Junk <thomas.junk@intevation.de>
parents: 1606
diff changeset
10 <translate class="headline">Imports</translate>
1455
33dda08d67be unified layout for adminsection
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
11 </h6>
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 <div class="card-body schedulecardbody">
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 <div class="card-body schedulecardbody">
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
14 <div class="searchandfilter mb-3 w-50 d-flex flex-row">
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 <div class="searchgroup input-group">
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 <div class="input-group-prepend">
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 <span class="input-group-text" id="search">
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 <font-awesome-icon icon="search"></font-awesome-icon>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 </span>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 <input
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 v-model="searchQuery"
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 type="text"
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 class="form-control"
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 placeholder
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 aria-label="Search"
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 aria-describedby="search"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1455
diff changeset
28 />
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 </div>
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
31 <transition name="fade">
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
32 <table v-if="schedules.length" class="table table-hover">
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
33 <thead>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
34 <tr>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
35 <th><translate>ID</translate></th>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
36 <th><translate>Type</translate></th>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
37 <th><translate>Author</translate></th>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
38 <th><translate>Schedule</translate></th>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
39 <th><translate>Email</translate></th>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
40 <th style="width: 140px"></th>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
41 </tr>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
42 </thead>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
43 <transition-group name="fade" tag="tbody">
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
44 <tr v-for="schedule in schedules" :key="schedule.id">
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
45 <td>{{ schedule.id }}</td>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
46 <td>{{ schedule.kind.toUpperCase() }}</td>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
47 <td>{{ schedule.user }}</td>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
48 <td>{{ schedule.config.cron }}</td>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
49 <td>
2330
7b79d4966a87 client: unified buttons styles in tables
Markus Kottlaender <markus@intevation.de>
parents: 2299
diff changeset
50 <font-awesome-icon
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
51 v-if="schedule.config['send-email']"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
52 class="fa-fw mr-2"
2330
7b79d4966a87 client: unified buttons styles in tables
Markus Kottlaender <markus@intevation.de>
parents: 2299
diff changeset
53 fixed-width
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
54 icon="check"
2330
7b79d4966a87 client: unified buttons styles in tables
Markus Kottlaender <markus@intevation.de>
parents: 2299
diff changeset
55 ></font-awesome-icon>
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
56 </td>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
57 <td class="text-right">
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
58 <button
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
59 @click="editSchedule(schedule.id)"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
60 class="btn btn-sm btn-dark mr-1"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
61 :disabled="importScheduleDetailVisible"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
62 >
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
63 <font-awesome-icon
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
64 icon="pencil-alt"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
65 fixed-width
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
66 ></font-awesome-icon>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
67 </button>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
68 <button
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
69 @click="deleteSchedule(schedule)"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
70 class="btn btn-sm btn-dark mr-1"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
71 :disabled="importScheduleDetailVisible"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
72 >
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
73 <font-awesome-icon
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
74 icon="trash"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
75 fixed-width
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
76 ></font-awesome-icon>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
77 </button>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
78 <button
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
79 @click="triggerManualImport(schedule.id)"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
80 class="btn btn-sm btn-dark"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
81 :disabled="importScheduleDetailVisible"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
82 >
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
83 <font-awesome-icon
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
84 icon="play"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
85 fixed-width
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
86 ></font-awesome-icon>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
87 </button>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
88 </td>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
89 </tr>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
90 </transition-group>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
91 </table>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
92 <div v-else class="mt-4 small text-center py-3">
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
93 <translate>No scheduled imports</translate>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
94 </div>
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
95 </transition>
1774
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
96 <div class="text-right">
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
97 <button
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
98 :disabled="importScheduleDetailVisible"
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
99 @click="newImport"
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
100 class="btn btn-info newbutton"
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
101 >
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
102 <translate>New Import</translate>
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
103 </button>
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
104 </div>
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 <Importscheduledetail></Importscheduledetail>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 </template>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 <script>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 /* This is Free Software under GNU Affero General Public License v >= 3.0
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 * without warranty, see README.md and license for details.
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 *
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 * SPDX-License-Identifier: AGPL-3.0-or-later
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 * License-Filename: LICENSES/AGPL-3.0.txt
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
119 *
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 * Copyright (C) 2018 by via donau
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 * – Österreichische Wasserstraßen-Gesellschaft mbH
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 * Software engineering by Intevation GmbH
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 *
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 * Author(s):
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 * Thomas Junk <thomas.junk@intevation.de>
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
126 * Markus Kottländer <markus.kottlaender@intevation.de>
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 */
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
128
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
129 import { mapState } from "vuex";
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
130 import { HTTP } from "@/lib/http";
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
131 import { displayInfo, displayError } from "@/lib/errors.js";
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 export default {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
134 name: "importschedule",
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 components: {
1669
16fb9667ddf8 refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents: 1613
diff changeset
136 Importscheduledetail: () => import("./Importscheduledetail"),
16fb9667ddf8 refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents: 1613
diff changeset
137 Spacer: () => import("@/components/Spacer")
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138 },
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
139 data() {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
140 return {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 searchQuery: ""
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 };
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
143 },
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
144 mounted() {
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
145 this.getSchedules();
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
146 },
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 methods: {
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
148 editSchedule(id) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
149 this.$store
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
150 .dispatch("importschedule/loadSchedule", id)
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
151 .then(() => {
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
152 this.$store.commit("importschedule/setImportScheduleDetailVisible");
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
153 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
154 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
155 const { status, data } = error.response;
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
156 displayError({
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
157 title: this.$gettext("Backend Error"),
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
158 message: `${status}: ${data.message || data}`
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
159 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
160 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
161 },
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
162 triggerManualImport(id) {
1745
6eb099690279 importschedule: play button active
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
163 HTTP.get("/imports/config/" + id + "/run", {
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
164 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
165 })
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
166 .then(response => {
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
167 const { id } = response.data;
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
168 displayInfo({
1745
6eb099690279 importschedule: play button active
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
169 title: this.$gettext("Imports"),
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
170 message: this.$gettext("Manually triggered import: #") + id
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
171 });
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
172 })
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
173 .catch(error => {
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
174 const { status, data } = error.response;
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
175 displayError({
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
176 title: this.$gettext("Backend Error"),
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
177 message: `${status}: ${data.message || data}`
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
178 });
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
179 });
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
180 },
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
181 getSchedules() {
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
182 this.$store.dispatch("importschedule/loadSchedules").catch(error => {
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
183 const { status, data } = error.response;
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
184 displayError({
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
185 title: this.$gettext("Backend Error"),
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
186 message: `${status}: ${data.message || data}`
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
187 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
188 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
189 },
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
190 newImport() {
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
191 this.$store.commit("importschedule/setImportScheduleDetailVisible");
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
192 },
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
193 deleteSchedule(schedule) {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
194 console.log(schedule);
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
195 this.$store.commit("application/popup", {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
196 icon: "trash",
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
197 title: this.$gettext("Delete Import"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
198 content: this.$gettext(
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
199 `Do you really want to delete the import with ID <b>${
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
200 schedule.id
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
201 }</b> of type <b>${schedule.kind.toUpperCase()}</b>?`
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
202 ),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
203 confirm: {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
204 label: this.$gettext("Delete"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
205 icon: "trash",
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
206 callback: () => {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
207 this.$store
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
208 .dispatch("importschedule/deleteSchedule", schedule.id)
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
209 .then(() => {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
210 this.getSchedules();
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
211 displayInfo({
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
212 title: this.$gettext("Imports"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
213 message: this.$gettext("Deleted import: #") + schedule.id
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
214 });
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
215 })
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
216 .catch(error => {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
217 const { status, data } = error.response;
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
218 displayError({
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
219 title: this.$gettext("Backend Error"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
220 message: `${status}: ${data.message || data}`
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
221 });
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
222 });
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
223 }
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
224 },
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
225 cancel: {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
226 label: this.$gettext("Cancel"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
227 icon: "times"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
228 }
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
229 });
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
230 }
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
231 },
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
232 computed: {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
233 ...mapState("application", ["showSidebar"]),
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
234 ...mapState("importschedule", ["schedules", "importScheduleDetailVisible"]),
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
235 spacerStyle() {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
236 return [
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
237 "spacer ml-3",
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
238 {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
239 "spacer-expanded": this.showSidebar,
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
240 "spacer-collapsed": !this.showSidebar
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
241 }
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
242 ];
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
243 }
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
244 }
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
245 };
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
246 </script>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
247
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
248 <style lang="scss" scoped>
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
249 th {
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
250 border-top: 0px;
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
251 }
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
252
1774
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
253 .card-body {
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
254 padding-bottom: $small-offset;
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
255 }
f9ac2d4d2069 new button relayouted
Thomas Junk <thomas.junk@intevation.de>
parents: 1771
diff changeset
256
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
257 .schedulecard {
1529
Thomas Junk <thomas.junk@intevation.de>
parents: 1480
diff changeset
258 margin-right: $offset;
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
259 min-height: 20rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
260 }
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
261
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
262 .schedulecard-body {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
263 width: 100%;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
264 margin-left: auto;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
265 margin-right: auto;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1430
diff changeset
266 }
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
267 </style>