annotate client/src/components/importoverview/ImportOverviewAlt.vue @ 2619:eb1ec926ff97

client: importoverview2: added refresh button
author Markus Kottlaender <markus@intevation.de>
date Wed, 13 Mar 2019 14:59:49 +0100
parents 655c1db641b7
children 50cc5bffd787
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"
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 title="Staging Area"
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 :closeCallback="$parent.close"
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 />
2618
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
8 <div class="p-2 d-flex flex-row flex-fill justify-content-between">
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
9 <Filters></Filters>
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
10 <div>
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
11 <button class="btn btn-sm btn-info mr-1" @click="loadLogs()">
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
12 <font-awesome-icon icon="spinner" spin v-if="loading" />
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
13 <font-awesome-icon icon="redo" v-else />
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
14 </button>
2618
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
15 <button class="btn btn-sm btn-info" :disabled="!reviewed.length">
2615
7025d082c115 client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents: 2593
diff changeset
16 <translate>Commit</translate> {{ reviewed.length }}
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
17 </button>
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 </div>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 </div>
2618
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
20 <LogEntry
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
21 class="border-top d-flex-flex-column w-100"
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
22 :entry="entry"
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
23 v-for="entry in imports"
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
24 :key="entry.id"
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
25 ></LogEntry>
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 </div>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 </template>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 <script>
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
30 /* 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
31 * without warranty, see README.md and license for details.
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
32 *
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
33 * SPDX-License-Identifier: AGPL-3.0-or-later
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
34 * License-Filename: LICENSES/AGPL-3.0.txt
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
35 *
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
36 * Copyright (C) 2018 by via donau
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
37 * – Österreichische Wasserstraßen-Gesellschaft mbH
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
38 * Software engineering by Intevation GmbH
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
39 *
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
40 * Author(s):
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
41 * Thomas Junk <thomas.junk@intevation.de>
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
42 */
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
44 import { displayError } from "@/lib/errors.js";
2615
7025d082c115 client: importoverview2: fixed counter in commit button
Markus Kottlaender <markus@intevation.de>
parents: 2593
diff changeset
45 import { mapState } from "vuex";
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 export default {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 name: "importoverviewalt",
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
49 components: {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
50 Filters: () => import("./Filters.vue"),
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
51 LogEntry: () => import("./LogEntry.vue")
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
52 },
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
53 data() {
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
54 return {
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
55 loading: false
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
56 };
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
57 },
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
58 computed: {
2618
655c1db641b7 client: importoverview2: improved commit button state/style
Markus Kottlaender <markus@intevation.de>
parents: 2617
diff changeset
59 ...mapState("imports", ["imports", "filters", "reviewed"])
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 },
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 methods: {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 loadLogs() {
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
63 this.loading = true;
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 this.$store
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 .dispatch("imports/getImports")
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 .then(() => {
2619
eb1ec926ff97 client: importoverview2: added refresh button
Markus Kottlaender <markus@intevation.de>
parents: 2618
diff changeset
67 this.loading = false;
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 })
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 .catch(error => {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 const { status, data } = error.response;
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 displayError({
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 title: this.$gettext("Backend Error"),
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 message: `${status}: ${data.message || data}`
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 });
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 });
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 }
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 },
2593
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
78 watch: {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
79 filters() {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
80 this.$store.dispatch("imports/getImports", this.filters);
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
81 }
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
82 },
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 mounted() {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
84 this.loadLogs();
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
85 }
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 };
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 </script>