annotate client/src/components/importoverview/ImportOverviewAlt.vue @ 2593:956b230c6062

overview2 WIP
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 12 Mar 2019 10:42:27 +0100
parents 5472a5be09c2
children 7025d082c115
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 />
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
8 <div
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
9 class="ml-2 mt-2 d-flex flex-row flex-fill justify-content-between mr-2"
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
10 >
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
11 <Filters></Filters>
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
12 <div>
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
13 <button :class="commitStyle">
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
14 <translate>Commit</translate> {{ toCommit.length }}
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
15 </button>
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 </div>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 </div>
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
18 <div class="ml-3 mr-2 mt-2 w-95 ">
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
19 <LogEntry
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
20 class="logentry border-bottom d-flex-flex-column w-100"
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
21 :entry="entry"
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
22 v-for="entry in imports"
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
23 :key="entry.id"
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
24 ></LogEntry>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2578
diff changeset
25 </div>
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";
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
45 import { mapState, mapGetters } 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 },
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
53 computed: {
2593
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
54 ...mapState("imports", ["imports", "filters"]),
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
55 ...mapGetters("imports", ["toCommit"]),
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
56 commitStyle() {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
57 return {
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
58 btn: true,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
59 "btn-sm": true,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
60 "btn-light": this.toCommit.length == 0,
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
61 "btn-info": this.toCommit.length > 0
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
62 };
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
63 }
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 },
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 methods: {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 loadLogs() {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 this.$store
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 .dispatch("imports/getImports")
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 .then(() => {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 this.reload = false;
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 })
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 .catch(error => {
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 const { status, data } = error.response;
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 displayError({
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 title: this.$gettext("Backend Error"),
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 message: `${status}: ${data.message || data}`
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 });
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 });
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 }
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 },
2593
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
81 watch: {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
82 filters() {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
83 this.$store.dispatch("imports/getImports", this.filters);
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
84 }
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
85 },
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 mounted() {
2578
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
87 this.loadLogs();
3ad81357a57c overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2559
diff changeset
88 }
2559
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 };
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 </script>
d9e1db955d49 Backed out changeset 91c68153e7b6
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
92 <style lang="scss" scoped>
2593
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
93 .logentry {
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
94 font-size: 90%;
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2592
diff changeset
95 }
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
96 .logentry:hover {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
97 background: #fafafa;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
98 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
99 </style>