annotate client/src/components/importschedule/Importschedule.vue @ 2406:b72d3da6409c

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