annotate client/src/components/importoverview/ImportOverview.vue @ 2738:add2d47c2567

client: tables: implemented simple default sorting
author Markus Kottlaender <markus@intevation.de>
date Tue, 19 Mar 2019 18:59:40 +0100
parents 375c9dd935ad
children 85de42146bdb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div class="overview">
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 <UIBoxHeader
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 icon="clipboard-check"
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2709
diff changeset
5 title="Import review"
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 :closeCallback="$parent.close"
2632
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
7 :actions="[{ callback: loadLogs, icon: 'redo' }]"
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 />
2632
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
9 <div class="position-relative">
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
10 <transition name="fade">
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
11 <div
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
12 class="loading d-flex justify-content-center align-items-center"
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
13 v-if="loading"
2626
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
14 >
2632
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
15 <font-awesome-icon icon="spinner" spin />
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
16 </div>
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
17 </transition>
2699
ef10f1cd6cb8 import_overview: testwise including header component
Thomas Junk <thomas.junk@intevation.de>
parents: 2666
diff changeset
18 <div class="p-2 mb-1 d-flex flex-row flex-fill justify-content-between">
2632
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
19 <Filters></Filters>
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
20 <div>
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
21 <button
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
22 class="btn btn-sm btn-info"
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
23 :disabled="!reviewed.length"
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
24 @click="save"
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
25 >
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
26 <translate>Commit</translate> {{ reviewed.length }}
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
27 </button>
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
28 </div>
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 </div>
2699
ef10f1cd6cb8 import_overview: testwise including header component
Thomas Junk <thomas.junk@intevation.de>
parents: 2666
diff changeset
30 <UITableHeader
ef10f1cd6cb8 import_overview: testwise including header component
Thomas Junk <thomas.junk@intevation.de>
parents: 2666
diff changeset
31 :columns="[
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
32 { id: 'id', title: 'Id', width: '79px' },
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
33 { id: 'kind', title: 'Kind', width: '53px' },
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
34 { id: 'enqueued', title: 'Enqueued', width: '138px' },
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
35 { id: 'user', title: 'User', width: '105px' },
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
36 { id: 'signer', title: 'Signer', width: '105px' },
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
37 { id: 'state', title: 'Status', width: '72px' },
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
38 { id: 'warnings', icon: 'exclamation-triangle', width: '44px' }
2699
ef10f1cd6cb8 import_overview: testwise including header component
Thomas Junk <thomas.junk@intevation.de>
parents: 2666
diff changeset
39 ]"
ef10f1cd6cb8 import_overview: testwise including header component
Thomas Junk <thomas.junk@intevation.de>
parents: 2666
diff changeset
40 />
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
41 <!--
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
42 For server-side sorting, etc simply don't use the sortTable filter.
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
43 Instead you could just pass a function that loads the imports, like:
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
44 :data="loadImports(sortColumn, sortDirection)"
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
45 -->
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
46 <UITableBody
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
47 :data="filteredImports() | sortTable(sortColumn, sortDirection)"
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
48 maxHeight="80vh"
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
49 v-slot="{ item: entry }"
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
50 >
2725
9465749410ba client: import overview: use table body component
Markus Kottlaender <markus@intevation.de>
parents: 2720
diff changeset
51 <LogEntry :entry="entry"></LogEntry>
9465749410ba client: import overview: use table body component
Markus Kottlaender <markus@intevation.de>
parents: 2720
diff changeset
52 </UITableBody>
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 </div>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 </div>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 </template>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56
2632
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
57 <style lang="sass" scoped>
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
58 .loading
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
59 background: rgba(255, 255, 255, 0.9)
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
60 position: absolute
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
61 z-index: 99
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
62 top: 0
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
63 right: 0
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
64 bottom: 0
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
65 left: 0
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
66 </style>
0b14de0bb85f client: importoverview2: moved refresh button to box header, added loading animation like in other boxes
Markus Kottlaender <markus@intevation.de>
parents: 2626
diff changeset
67
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 <script>
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
69 /* This is Free Software under GNU Affero General Public License v >= 3.0
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
70 * without warranty, see README.md and license for details.
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
71 *
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
72 * SPDX-License-Identifier: AGPL-3.0-or-later
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
73 * License-Filename: LICENSES/AGPL-3.0.txt
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
74 *
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
75 * Copyright (C) 2018 by via donau
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
76 * – Österreichische Wasserstraßen-Gesellschaft mbH
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
77 * Software engineering by Intevation GmbH
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
78 *
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
79 * Author(s):
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
80 * Thomas Junk <thomas.junk@intevation.de>
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
81 * Markus Kottländer <markus.kottlaender@intevation.de>
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
82 */
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2651
diff changeset
84 import { mapState, mapGetters } from "vuex";
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
85 import { displayError, displayInfo } from "@/lib/errors";
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
86 import { STATES } from "@/store/imports";
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
87 import { sortTable } from "@/lib/mixins";
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 export default {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 name: "importoverviewalt",
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
91 mixins: [sortTable],
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
92 components: {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
93 Filters: () => import("./Filters.vue"),
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
94 LogEntry: () => import("./LogEntry.vue")
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
95 },
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
96 data() {
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
97 return {
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
98 loading: false
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
99 };
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
100 },
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
101 computed: {
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
102 ...mapState("application", ["searchQuery"]),
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2651
diff changeset
103 ...mapState("imports", ["imports", "reviewed"]),
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2651
diff changeset
104 ...mapGetters("imports", ["filters"])
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 },
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 methods: {
2738
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
107 filteredImports() {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
108 return this.imports.filter(i => {
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
109 return (i.kind + i.id)
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
110 .toLowerCase()
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
111 .includes(this.searchQuery.toLowerCase());
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
112 });
add2d47c2567 client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents: 2734
diff changeset
113 },
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 loadLogs() {
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
115 this.loading = true;
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 this.$store
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2651
diff changeset
117 .dispatch("imports/getImports", this.filters)
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 .then(() => {
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
119 this.loading = false;
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 })
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 .catch(error => {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 const { status, data } = error.response;
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 displayError({
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 title: this.$gettext("Backend Error"),
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 message: `${status}: ${data.message || data}`
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126 });
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 });
2626
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
128 },
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
129 save() {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
130 if (!this.reviewed.length) return;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
131
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
132 let popupContent = `<table class="table table-sm small mb-0 border-0" style="margin-top: -1px;">`;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
133 this.reviewed.forEach(r => {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
134 let imp = this.imports.find(i => i.id === r.id);
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
135 let approved = STATES.APPROVED === r.status;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
136 popupContent += `<tr>
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
137 <td>${imp.id}</td>
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
138 <td>${imp.kind.toUpperCase()}</td>
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
139 <td>${this.$options.filters.dateTime(imp.enqueued)}</td>
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
140 <td class="text-${approved ? "success" : "danger"}">
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
141 ${this.$gettext(approved ? "approved" : "declined")}
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
142 </td>
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
143 </tr>`;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
144 });
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
145 popupContent += "</table>";
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
146
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
147 this.$store.commit("application/popup", {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
148 icon: "clipboard-check",
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
149 title: this.$gettext("Finish Review"),
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
150 padding: false,
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
151 big: true,
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
152 content: popupContent,
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
153 confirm: {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
154 icon: "check",
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
155 callback: () => {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
156 let data = this.reviewed.map(r => ({
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
157 id: r.id,
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
158 state: r.status
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
159 }));
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
160 this.$store
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
161 .dispatch("imports/confirmReview", data)
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
162 .then(response => {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
163 this.loadLogs();
2638
6c1730fc3dc1 client: importsoverview2: clear reviewed array after finishing review
Markus Kottlaender <markus@intevation.de>
parents: 2632
diff changeset
164 this.$store.commit("imports/setReviewed", []);
2626
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
165 const messages = response.data
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
166 .map(x => {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
167 if (x.message) return x.message;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
168 if (x.error) return x.error;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
169 })
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
170 .join("\n\n");
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
171 displayInfo({
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
172 title: "Staging Area",
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
173 message: messages,
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
174 options: {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
175 timeout: 0,
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
176 buttons: [{ text: "Ok", action: null, bold: true }]
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
177 }
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
178 });
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
179 })
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
180 .catch(error => {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
181 const { status, data } = error.response;
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
182 displayError({
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
183 title: "Backend Error",
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
184 message: `${status}: ${data.message || data}`
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
185 });
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
186 });
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
187 }
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
188 },
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
189 cancel: {
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
190 label: this.$gettext("Cancel"),
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
191 icon: "times"
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
192 }
50cc5bffd787 client: importoverview2: implemented Finish Review (confirm) dialog
Markus Kottlaender <markus@intevation.de>
parents: 2619
diff changeset
193 });
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
194 }
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
195 },
2593
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
196 watch: {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
197 filters() {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
198 this.$store.dispatch("imports/getImports", this.filters);
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
199 }
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
200 },
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
201 mounted() {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
202 this.loadLogs();
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
203 }
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
204 };
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
205 </script>