Mercurial > gemma
annotate client/src/components/importoverview/LogEntry.vue @ 2698:472f4c6a1ec0
Sidebar: set count of pending imports correctly
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 18 Mar 2019 11:32:27 +0100 |
parents | 39a05f8c34e6 |
children | ef10f1cd6cb8 |
rev | line source |
---|---|
2579 | 1 <template> |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
2 <div class="logentry"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
3 <div class="row no-gutters text-left"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
4 <div style="width: 4%;" class="text-center"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
5 <font-awesome-icon |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
6 @click="toggleDetails" |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
7 class="my-auto mr-1 text-info pointer" |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
8 :icon="entry.id === show ? 'angle-down' : 'angle-right'" |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
9 fixed-width |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
10 ></font-awesome-icon> |
2605
11fd7ee37f10
overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents:
2601
diff
changeset
|
11 </div> |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
12 <div style="width: 7%; padding-right: 10px;" class="text-right"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
13 {{ entry.id }} |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
14 </div> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
15 <div style="width: 8%;"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
16 {{ entry.kind.toUpperCase() }} |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
17 </div> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
18 <div style="width: 22%;"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
19 {{ entry.enqueued | dateTime }} |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
20 </div> |
2656
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
21 <div style="width: 18%;" class="truncate">{{ entry.user }}</div> |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
22 <div style="width: 18%;" class="truncate">{{ entry.signer }}</div> |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
23 <div style="width: 10%;" class=""> |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
24 <span v-if="entry.state === 'failed'" class="text-danger">{{ |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
25 entry.state |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
26 }}</span> |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
27 <span v-else>{{ entry.state }}</span> |
8299cce986a2
import_overview: readded status
Thomas Junk <thomas.junk@intevation.de>
parents:
2617
diff
changeset
|
28 </div> |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
29 <div style="width: 6%;" class="text-center"> |
2592 | 30 <font-awesome-icon |
31 v-if="entry.warnings" | |
32 class="ml-1 text-warning" | |
33 icon="exclamation-triangle" | |
34 fixed-width | |
35 ></font-awesome-icon> | |
36 </div> | |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
37 <div style="width: 7%" class="text-right"> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
38 <div v-if="entry.state === 'pending'"> |
2592 | 39 <button |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
40 :class="['actions approved', { active: isApproved }]" |
2592 | 41 @click="toggleApproval($options.STATES.APPROVED)" |
42 > | |
43 <font-awesome-icon | |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
44 class="small pointer" |
2592 | 45 icon="check" |
46 ></font-awesome-icon> | |
47 </button> | |
48 <button | |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
49 :class="['actions rejected', { active: isRejected }]" |
2592 | 50 @click="toggleApproval($options.STATES.REJECTED)" |
51 > | |
52 <font-awesome-icon | |
53 icon="times" | |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
54 class="small pointer" |
2592 | 55 ></font-awesome-icon> |
56 </button> | |
57 </div> | |
58 </div> | |
59 </div> | |
2594 | 60 <div class="ml-1 d-flex flex-row"> |
2685
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
61 <LogDetail |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
62 :entry="entry" |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
63 :details="details" |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
64 v-if="show === entry.id" |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
65 ></LogDetail> |
2592 | 66 </div> |
2579 | 67 </div> |
68 </template> | |
69 | |
70 <script> | |
2592 | 71 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
72 * without warranty, see README.md and license for details. | |
73 * | |
74 * SPDX-License-Identifier: AGPL-3.0-or-later | |
75 * License-Filename: LICENSES/AGPL-3.0.txt | |
76 * | |
77 * Copyright (C) 2018 by via donau | |
78 * – Österreichische Wasserstraßen-Gesellschaft mbH | |
79 * Software engineering by Intevation GmbH | |
80 * | |
81 * Author(s): | |
82 * Thomas Junk <thomas.junk@intevation.de> | |
83 */ | |
84 import { mapState } from "vuex"; | |
85 import { STATES } from "@/store/imports.js"; | |
2685
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
86 import { displayError } from "@/lib/errors.js"; |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
87 import { HTTP } from "@/lib/http.js"; |
2592 | 88 |
2579 | 89 export default { |
90 name: "importlogentry", | |
91 props: ["entry"], | |
2685
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
92 data() { |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
93 return { |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
94 details: null |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
95 }; |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
96 }, |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
97 mounted() { |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
98 HTTP.get("/imports/" + this.entry.id, { |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
99 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
100 }) |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
101 .then(response => { |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
102 this.details = response.data; |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
103 }) |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
104 .catch(error => { |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
105 const { status, data } = error.response; |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
106 displayError({ |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
107 title: this.$gettext("Backend Error"), |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
108 message: `${status}: ${data.message || data}` |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
109 }); |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
110 }); |
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2656
diff
changeset
|
111 }, |
2592 | 112 components: { |
113 LogDetail: () => import("./LogDetail.vue") | |
114 }, | |
115 methods: { | |
116 toggleApproval(state) { | |
117 this.$store.commit("imports/toggleApprove", { | |
118 id: this.entry.id, | |
119 newStatus: state | |
120 }); | |
121 }, | |
122 toggleDetails() { | |
123 const { id } = this.entry; | |
124 if (id === this.show) { | |
125 this.$store.commit("imports/hideDetails"); | |
2597 | 126 this.$store.commit("imports/hideAdditionalInfo"); |
127 this.$store.commit("imports/hideAdditionalLogs"); | |
2592 | 128 } else { |
129 this.$store.commit("imports/showDetailsFor", id); | |
130 } | |
131 } | |
132 }, | |
2579 | 133 computed: { |
2592 | 134 ...mapState("imports", ["show"]), |
135 needsApproval() { | |
136 return this.entry.status === STATES.NEEDSAPPROVAL; | |
137 }, | |
138 isRejected() { | |
139 return this.entry.status === STATES.REJECTED; | |
140 }, | |
141 isApproved() { | |
142 return this.entry.status === STATES.APPROVED; | |
2579 | 143 } |
2592 | 144 }, |
145 STATES: STATES | |
2579 | 146 }; |
147 </script> | |
148 | |
2617
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
149 <style lang="sass" scoped> |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
150 .logentry |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
151 font-size: 80% |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
152 &:hover |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
153 background: #fafafa |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
154 .actions |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
155 height: 100% |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
156 width: 22px |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
157 border: 0 |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
158 background: transparent |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
159 border-left: 1px solid #dee2e6 |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
160 outline: none |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
161 &.approved |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
162 color: green |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
163 &.active, |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
164 &:hover |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
165 color: white |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
166 background: green |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
167 &.rejected |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
168 color: red |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
169 &.active, |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
170 &:hover |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
171 color: white |
359f5f0037f5
client: importoverview2: improved table layout to save more space
Markus Kottlaender <markus@intevation.de>
parents:
2616
diff
changeset
|
172 background: red |
2592 | 173 </style> |