Mercurial > gemma
annotate client/src/components/importoverview/ImportOverview.vue @ 2455:54c9fe587fe6
Subdivide SQL function to prepare for improved error handling
The context of an error (e.g. the function in which it occured)
can be inferred by the database client. Not doing all in one
statement will render the context more meaningful.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 01 Mar 2019 18:38:02 +0100 |
parents | 0c9121abf120 |
children | 40bd6bb7886b |
rev | line source |
---|---|
2403 | 1 <template> |
2 <div> | |
3 <UIBoxHeader | |
4 icon="clipboard-check" | |
5 title="Staging Area" | |
6 :closeCallback="$parent.close" | |
7 /> | |
8 <div class="d-flex flex-row w-100 justify-content-end"> | |
2430 | 9 <button |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
10 class="btn btn-sm btn-outline-info align-self-start mt-3 mr-3" |
2430 | 11 @click="refresh" |
12 > | |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
13 <font-awesome-icon icon="redo"></font-awesome-icon> |
2403 | 14 </button> |
15 </div> | |
16 <div class="d-flex flex-row w-100 border-bottom"> | |
17 <font-awesome-icon | |
18 class="pointer" | |
19 @click="toggleStaging()" | |
2428 | 20 v-if="stagingVisible && staging.length > 0" |
2403 | 21 icon="angle-up" |
22 fixed-width | |
23 ></font-awesome-icon> | |
24 <font-awesome-icon | |
25 class="pointer" | |
26 @click="toggleStaging()" | |
2428 | 27 v-if="!stagingVisible && staging.length > 0" |
2403 | 28 icon="angle-down" |
29 fixed-width | |
30 ></font-awesome-icon> | |
2428 | 31 <span style="width:1.25em;" v-if="!(staging.length > 0)"></span> |
32 <Staging v-if="stagingVisible && staging.length > 0"></Staging> | |
33 <div v-else class="d-flex flex-row"> | |
34 <h6> | |
35 <small><translate>Review</translate></small> | |
36 </h6> | |
37 <small class="ml-3" v-if="!(staging.length > 0)" | |
38 ><translate>Nothing to review</translate></small | |
39 > | |
40 </div> | |
2403 | 41 </div> |
2428 | 42 <div class="mt-2"> |
43 <div class="d-flex flex-row"> | |
44 <font-awesome-icon | |
45 class="pointer" | |
46 @click="toggleLogs()" | |
47 v-if="logsVisible" | |
48 icon="angle-up" | |
49 fixed-width | |
50 ></font-awesome-icon> | |
51 <font-awesome-icon | |
52 class="pointer" | |
53 @click="toggleLogs()" | |
54 v-if="!logsVisible" | |
55 icon="angle-down" | |
56 fixed-width | |
57 ></font-awesome-icon> | |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
58 <Logs v-if="logsVisible" :reload="reload"></Logs> |
2428 | 59 <div v-else> |
60 <h6> | |
61 <small><translate>Logs</translate></small> | |
62 </h6> | |
63 </div> | |
64 </div> | |
2403 | 65 </div> |
66 </div> | |
67 </template> | |
68 | |
69 <script> | |
70 /* This is Free Software under GNU Affero General Public License v >= 3.0 | |
71 * without warranty, see README.md and license for details. | |
72 * | |
73 * SPDX-License-Identifier: AGPL-3.0-or-later | |
74 * License-Filename: LICENSES/AGPL-3.0.txt | |
75 * | |
76 * Copyright (C) 2018 by via donau | |
77 * – Österreichische Wasserstraßen-Gesellschaft mbH | |
78 * Software engineering by Intevation GmbH | |
79 * | |
80 * Author(s): | |
81 * Thomas Junk <thomas.junk@intevation.de> | |
82 */ | |
83 import { displayError } from "@/lib/errors.js"; | |
84 import { mapState } from "vuex"; | |
85 | |
86 export default { | |
87 name: "importoverview", | |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
88 data() { |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
89 return { |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
90 reload: false |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
91 }; |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
92 }, |
2403 | 93 components: { |
94 Staging: () => import("./staging/Staging.vue"), | |
2422
77baf4f0ee1e
logs->importlogs due to .hgignore
Thomas Junk <thomas.junk@intevation.de>
parents:
2403
diff
changeset
|
95 Logs: () => import("./importlogs/Logs.vue") |
2403 | 96 }, |
97 computed: { | |
2428 | 98 ...mapState("imports", ["stagingVisible", "logsVisible", "staging"]) |
2403 | 99 }, |
100 methods: { | |
101 toggleStaging() { | |
102 this.$store.commit("imports/setStagingVisibility", !this.stagingVisible); | |
103 }, | |
104 toggleLogs() { | |
105 this.$store.commit("imports/setLogsVisibility", !this.logsVisible); | |
106 }, | |
107 refresh() { | |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
108 this.reload = true; |
2403 | 109 this.loadImportQueue(); |
110 this.loadLogs(); | |
111 }, | |
112 loadImportQueue() { | |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
113 this.$store |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
114 .dispatch("imports/getStaging") |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
115 .then(() => { |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
116 this.reload = false; |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
117 }) |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
118 .catch(error => { |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
119 const { status, data } = error.response; |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
120 displayError({ |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
121 title: "Backend Error", |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
122 message: `${status}: ${data.message || data}` |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
123 }); |
2426
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
124 }); |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
125 }, |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
126 loadLogs() { |
2403 | 127 this.$store |
128 .dispatch("imports/getImports") | |
2449
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
129 .then(() => { |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
130 this.reload = false; |
0c9121abf120
staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents:
2430
diff
changeset
|
131 }) |
2403 | 132 .catch(error => { |
133 const { status, data } = error.response; | |
134 displayError({ | |
135 title: this.$gettext("Backend Error"), | |
136 message: `${status}: ${data.message || data}` | |
137 }); | |
138 }); | |
139 } | |
140 }, | |
141 mounted() { | |
142 this.refresh(); | |
143 } | |
144 }; | |
145 </script> | |
146 | |
147 <style></style> |