annotate client/src/components/importoverview/LogEntry.vue @ 2601:b9523d876d01

overview2 WIP
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 12 Mar 2019 14:47:14 +0100
parents 61aba7e78d3a
children 11fd7ee37f10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
2 <div>
2601
b9523d876d01 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2599
diff changeset
3 <div class="logentry d-flex flex-row text-left">
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
4 <font-awesome-icon
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
5 v-if="entry.id === show"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
6 @click="toggleDetails"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
7 class="my-auto mr-1 text-info pointer"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
8 icon="angle-down"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
9 fixed-width
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
10 ></font-awesome-icon>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
11 <font-awesome-icon
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
12 v-if="entry.id !== show"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
13 @click="toggleDetails"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
14 class="my-auto mr-1 text-info pointer"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
15 icon="angle-right"
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 fixed-width
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
17 ></font-awesome-icon>
2599
61aba7e78d3a overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2597
diff changeset
18 <div class="kind">{{ entry.kind.toUpperCase() }}</div>
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
19 <div class="enqueued">{{ entry.enqueued | surveyDate }}</div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
20 <div class="user">{{ entry.user }}</div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
21 <div class="signer">{{ entry.signer }}</div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
22 <div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
23 <font-awesome-icon
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
24 v-if="entry.warnings"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
25 class="ml-1 text-warning"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
26 icon="exclamation-triangle"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
27 fixed-width
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
28 ></font-awesome-icon>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
29 </div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
30 <div v-if="reviewable" class="controls d-flex flex-row ml-auto">
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
31 <div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
32 <button
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
33 :class="{
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
34 'ml-3': true,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
35 'mr-3': true,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
36 btn: true,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
37 'btn-outline-success': needsApproval || isRejected,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
38 'btn-success': isApproved,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
39 actions: true
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
40 }"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
41 @click="toggleApproval($options.STATES.APPROVED)"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
42 >
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
43 <font-awesome-icon
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
44 class="mx-auto small pointer mb-2"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
45 icon="check"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
46 ></font-awesome-icon>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
47 </button>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
48 </div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
49 <div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
50 <button
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
51 :class="{
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
52 'mr-3': true,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
53 btn: true,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
54 'btn-outline-danger': needsApproval || isApproved,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
55 'btn-danger': isRejected,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
56 actions: true
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
57 }"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
58 @click="toggleApproval($options.STATES.REJECTED)"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
59 >
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
60 <font-awesome-icon
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
61 icon="times"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
62 class="small pointer mb-2"
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
63 ></font-awesome-icon>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
64 </button>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
65 </div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
66 </div>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
67 </div>
2594
ecec6d5aae00 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
68 <div class="ml-1 d-flex flex-row">
2597
02d5de05291f overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2594
diff changeset
69 <LogDetail :entry="entry" v-if="show === entry.id"></LogDetail>
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
70 </div>
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 </div>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 </template>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 <script>
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
75 /* This is Free Software under GNU Affero General Public License v >= 3.0
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
76 * without warranty, see README.md and license for details.
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
77 *
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
78 * SPDX-License-Identifier: AGPL-3.0-or-later
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
79 * License-Filename: LICENSES/AGPL-3.0.txt
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
80 *
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
81 * Copyright (C) 2018 by via donau
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
82 * – Österreichische Wasserstraßen-Gesellschaft mbH
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
83 * Software engineering by Intevation GmbH
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
84 *
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
85 * Author(s):
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
86 * Thomas Junk <thomas.junk@intevation.de>
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
87 */
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
88 import { mapState } from "vuex";
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
89 import { STATES } from "@/store/imports.js";
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
90
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 export default {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 name: "importlogentry",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 props: ["entry"],
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
94 components: {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
95 LogDetail: () => import("./LogDetail.vue")
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
96 },
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
97 methods: {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
98 toggleApproval(state) {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
99 this.$store.commit("imports/toggleApprove", {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
100 id: this.entry.id,
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
101 newStatus: state
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
102 });
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
103 },
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
104 toggleDetails() {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
105 const { id } = this.entry;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
106 if (id === this.show) {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
107 this.$store.commit("imports/hideDetails");
2597
02d5de05291f overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2594
diff changeset
108 this.$store.commit("imports/hideAdditionalInfo");
02d5de05291f overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2594
diff changeset
109 this.$store.commit("imports/hideAdditionalLogs");
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
110 } else {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
111 this.$store.commit("imports/showDetailsFor", id);
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
112 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
113 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
114 },
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 computed: {
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
116 ...mapState("imports", ["show"]),
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
117 needsApproval() {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
118 return this.entry.status === STATES.NEEDSAPPROVAL;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
119 },
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
120 isRejected() {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
121 return this.entry.status === STATES.REJECTED;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
122 },
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
123 isApproved() {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
124 return this.entry.status === STATES.APPROVED;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
125 },
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126 reviewable() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 return this.entry.state === "pending";
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
128 }
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
129 },
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
130 STATES: STATES
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
131 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 </script>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
134 <style lang="scss" scoped>
2601
b9523d876d01 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2599
diff changeset
135 .logentry {
b9523d876d01 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2599
diff changeset
136 }
b9523d876d01 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2599
diff changeset
137
2599
61aba7e78d3a overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2597
diff changeset
138 .kind {
61aba7e78d3a overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2597
diff changeset
139 width: 10%;
61aba7e78d3a overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2597
diff changeset
140 }
2592
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
141 .enqueued {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
142 width: 20%;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
143 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
144 .user {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
145 width: 10%;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
146 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
147 .signer {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
148 width: 10%;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
149 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
150 button {
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
151 height: 19px;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
152 width: 19px;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
153 padding: 0.1rem;
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
154 }
5472a5be09c2 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
155 </style>