annotate client/src/components/importschedule/Importschedule.vue @ 2581:5466800da970

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