annotate client/src/components/importschedule/Importschedule.vue @ 2874:b9a6abef9f1c

client: more unified table layout Expandable/collapsible rows are now also handled by the component
author Markus Kottlaender <markus@intevation.de>
date Mon, 01 Apr 2019 11:51:03 +0200
parents 615b0a9b8098
children c40540889b53
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">
2760
c6fba10926cc client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2738
diff changeset
6 <UIBoxHeader icon="clock" :title="importScheduleLabel" />
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="[
2782
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
26 { id: 'id', title: `${idLabel}`, class: 'col-1' },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
27 { id: 'kind', title: `${typeLabel}`, class: 'col-2' },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
28 { id: 'user', title: `${authorLabel}`, class: 'col-2' },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
29 { id: 'config.cron', title: `${scheduleLabel}`, class: 'col-2' },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
30 { id: 'config.send-email', title: `${emailLabel}`, class: 'col-2' }
2462
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 />
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
33 <UITableBody
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
34 :data="filteredSchedules() | sortTable(sortColumn, sortDirection)"
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
35 >
2874
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
36 <template v-slot:row="{ item: schedule }">
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
37 <div class="py-1 col-1">{{ schedule.id }}</div>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
38 <div class="py-1 col-2">{{ schedule.kind.toUpperCase() }}</div>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
39 <div class="py-1 col-2">{{ schedule.user }}</div>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
40 <div class="py-1 col-2">{{ schedule.config.cron }}</div>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
41 <div class="py-1 col-2 text-center">
2462
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
42 <font-awesome-icon
2874
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
43 v-if="schedule.config['send-email']"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
44 class="fa-fw mr-2"
2462
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
45 fixed-width
2874
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
46 icon="check"
2462
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
47 ></font-awesome-icon>
2874
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
48 </div>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
49 <div class="py-1 col text-right">
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
50 <button
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
51 @click="editSchedule(schedule.id)"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
52 class="btn btn-xs btn-dark mr-1"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
53 :disabled="importScheduleDetailVisible"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
54 >
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
55 <font-awesome-icon
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
56 icon="pencil-alt"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
57 fixed-width
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
58 ></font-awesome-icon>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
59 </button>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
60 <button
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
61 @click="deleteSchedule(schedule)"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
62 class="btn btn-xs btn-dark mr-1"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
63 :disabled="importScheduleDetailVisible"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
64 >
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
65 <font-awesome-icon icon="trash" fixed-width></font-awesome-icon>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
66 </button>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
67 <button
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
68 @click="triggerManualImport(schedule.id)"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
69 class="btn btn-xs btn-dark"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
70 :disabled="importScheduleDetailVisible"
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
71 >
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
72 <font-awesome-icon icon="play" fixed-width></font-awesome-icon>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
73 </button>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
74 </div>
b9a6abef9f1c client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents: 2782
diff changeset
75 </template>
2462
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
76 </UITableBody>
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
77 <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
78 <button
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
79 :disabled="importScheduleDetailVisible"
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
80 @click="newImport"
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
81 class="btn btn-info newbutton"
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
82 >
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
83 <translate>New Import</translate>
9ae2a2f758bb client: make use of new table header/body components
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
84 </button>
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 </div>
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 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 <Importscheduledetail></Importscheduledetail>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 </div>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 </template>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
92 <style lang="sass" scoped>
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
93 th
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
94 border-top: 0px
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
95
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
96 .card-body
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
97 padding-bottom: $small-offset
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
98
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
99 .schedulecard
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
100 margin-right: $small-offset
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
101 min-height: 20rem
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
102
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
103 .schedulecard-body
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
104 width: 100%
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
105 margin-left: auto
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
106 margin-right: auto
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
107 </style>
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
108
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 <script>
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 /* 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
111 * without warranty, see README.md and license for details.
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 * SPDX-License-Identifier: AGPL-3.0-or-later
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 * License-Filename: LICENSES/AGPL-3.0.txt
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 *
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 * Copyright (C) 2018 by via donau
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 * – Österreichische Wasserstraßen-Gesellschaft mbH
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 * Software engineering by Intevation GmbH
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 * Author(s):
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 * Thomas Junk <thomas.junk@intevation.de>
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
122 * Markus Kottländer <markus.kottlaender@intevation.de>
1430
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
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 import { mapState } from "vuex";
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
126 import { HTTP } from "@/lib/http";
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
127 import { displayInfo, displayError } from "@/lib/errors";
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
128 import { sortTable } from "@/lib/mixins";
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
129
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
130 export default {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
131 name: "importschedule",
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
132 mixins: [sortTable],
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 components: {
1669
16fb9667ddf8 refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents: 1613
diff changeset
134 Importscheduledetail: () => import("./Importscheduledetail"),
16fb9667ddf8 refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents: 1613
diff changeset
135 Spacer: () => import("@/components/Spacer")
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
136 },
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
137 data() {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138 return {
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
139 searchQuery: ""
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
140 };
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 },
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
142 computed: {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
143 ...mapState("application", ["showSidebar"]),
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
144 ...mapState("importschedule", ["schedules", "importScheduleDetailVisible"]),
2760
c6fba10926cc client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2738
diff changeset
145 importScheduleLabel() {
c6fba10926cc client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2738
diff changeset
146 return this.$gettext("Import Schedule");
c6fba10926cc client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2738
diff changeset
147 },
2782
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
148 idLabel() {
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
149 return this.$gettext("ID");
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
150 },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
151 typeLabel() {
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
152 return this.$gettext("Type");
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
153 },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
154 authorLabel() {
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
155 return this.$gettext("Author");
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
156 },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
157 scheduleLabel() {
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
158 return this.$gettext("Schedule");
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
159 },
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
160 emailLabel() {
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
161 return this.$gettext("Email");
615b0a9b8098 Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2760
diff changeset
162 },
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
163 spacerStyle() {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
164 return [
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
165 "spacer ml-3",
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
166 {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
167 "spacer-expanded": this.showSidebar,
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
168 "spacer-collapsed": !this.showSidebar
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
169 }
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
170 ];
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
171 }
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
172 },
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
173 methods: {
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
174 filteredSchedules() {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
175 return this.schedules.filter(s => {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
176 return (s.id + s.kind)
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
177 .toLowerCase()
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
178 .includes(this.searchQuery.toLowerCase());
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
179 });
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
180 },
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
181 editSchedule(id) {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
182 this.$store
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
183 .dispatch("importschedule/loadSchedule", id)
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
184 .then(() => {
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
185 this.$store.commit("importschedule/setImportScheduleDetailVisible");
1731
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
186 })
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
187 .catch(error => {
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
188 const { status, data } = error.response;
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
189 displayError({
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
190 title: this.$gettext("Backend Error"),
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
191 message: `${status}: ${data.message || data}`
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
192 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
193 });
8dd7452929ca WIP: edit scheduled imports
Thomas Junk <thomas.junk@intevation.de>
parents: 1728
diff changeset
194 },
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
195 triggerManualImport(id) {
1745
6eb099690279 importschedule: play button active
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
196 HTTP.get("/imports/config/" + id + "/run", {
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
197 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
198 })
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
199 .then(response => {
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
200 const { id } = response.data;
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
201 displayInfo({
1745
6eb099690279 importschedule: play button active
Thomas Junk <thomas.junk@intevation.de>
parents: 1731
diff changeset
202 title: this.$gettext("Imports"),
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
203 message: this.$gettext("Manually triggered import: #") + id
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
204 });
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
205 })
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
206 .catch(error => {
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
207 const { status, data } = error.response;
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
208 displayError({
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
209 title: this.$gettext("Backend Error"),
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
210 message: `${status}: ${data.message || data}`
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
211 });
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
212 });
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
213 },
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
214 getSchedules() {
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
215 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
216 const { status, data } = error.response;
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
217 displayError({
1725
b24a54c684bd importschedule: UI improvements
Thomas Junk <thomas.junk@intevation.de>
parents: 1724
diff changeset
218 title: this.$gettext("Backend Error"),
1711
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
219 message: `${status}: ${data.message || data}`
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
220 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
221 });
aec17976528e feat: scheduled import loaded from backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
222 },
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
223 newImport() {
2033
431f97fd873b importschedule: extracted to separate store
Thomas Junk <thomas.junk@intevation.de>
parents: 1892
diff changeset
224 this.$store.commit("importschedule/setImportScheduleDetailVisible");
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
225 },
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
226 deleteSchedule(schedule) {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
227 console.log(schedule);
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
228 this.$store.commit("application/popup", {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
229 icon: "trash",
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
230 title: this.$gettext("Delete Import"),
2595
dda4cec8e67b client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2534
diff changeset
231 content:
dda4cec8e67b client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2534
diff changeset
232 this.$gettext("Do you really want to delete the import with ID") +
dda4cec8e67b client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2534
diff changeset
233 `<b>${schedule.id}</b>` +
dda4cec8e67b client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2534
diff changeset
234 this.$gettext("of type") +
dda4cec8e67b client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2534
diff changeset
235 `<b>${schedule.kind.toUpperCase()}</b>?`,
2384
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
236 confirm: {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
237 label: this.$gettext("Delete"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
238 icon: "trash",
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
239 callback: () => {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
240 this.$store
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
241 .dispatch("importschedule/deleteSchedule", schedule.id)
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
242 .then(() => {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
243 this.getSchedules();
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
244 displayInfo({
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
245 title: this.$gettext("Imports"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
246 message: this.$gettext("Deleted import: #") + schedule.id
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
247 });
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
248 })
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
249 .catch(error => {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
250 const { status, data } = error.response;
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
251 displayError({
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
252 title: this.$gettext("Backend Error"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
253 message: `${status}: ${data.message || data}`
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
254 });
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
255 });
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
256 }
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
257 },
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
258 cancel: {
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
259 label: this.$gettext("Cancel"),
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
260 icon: "times"
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
261 }
c06b001dc26b client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents: 2379
diff changeset
262 });
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
263 }
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
264 },
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
265 mounted() {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2640
diff changeset
266 this.getSchedules();
1430
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
267 }
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
268 };
4e24c2db0bf5 automatic imports: added missing components
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
269 </script>