Mercurial > gemma
annotate client/src/components/importoverview/ImportOverview.vue @ 2428:78d4ce079f9b
staging: optics
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 28 Feb 2019 17:24:19 +0100 |
parents | 53323f701cf3 |
children | 2a93a8649751 |
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"> | |
9 <button class="btn btn-dark align-self-start" @click="refresh"> | |
10 <translate>Refresh</translate> | |
11 </button> | |
12 </div> | |
13 <div class="d-flex flex-row w-100 border-bottom"> | |
14 <font-awesome-icon | |
15 class="pointer" | |
16 @click="toggleStaging()" | |
2428 | 17 v-if="stagingVisible && staging.length > 0" |
2403 | 18 icon="angle-up" |
19 fixed-width | |
20 ></font-awesome-icon> | |
21 <font-awesome-icon | |
22 class="pointer" | |
23 @click="toggleStaging()" | |
2428 | 24 v-if="!stagingVisible && staging.length > 0" |
2403 | 25 icon="angle-down" |
26 fixed-width | |
27 ></font-awesome-icon> | |
2428 | 28 <span style="width:1.25em;" v-if="!(staging.length > 0)"></span> |
29 <Staging v-if="stagingVisible && staging.length > 0"></Staging> | |
30 <div v-else class="d-flex flex-row"> | |
31 <h6> | |
32 <small><translate>Review</translate></small> | |
33 </h6> | |
34 <small class="ml-3" v-if="!(staging.length > 0)" | |
35 ><translate>Nothing to review</translate></small | |
36 > | |
37 </div> | |
2403 | 38 </div> |
2428 | 39 <div class="mt-2"> |
40 <div class="d-flex flex-row"> | |
41 <font-awesome-icon | |
42 class="pointer" | |
43 @click="toggleLogs()" | |
44 v-if="logsVisible" | |
45 icon="angle-up" | |
46 fixed-width | |
47 ></font-awesome-icon> | |
48 <font-awesome-icon | |
49 class="pointer" | |
50 @click="toggleLogs()" | |
51 v-if="!logsVisible" | |
52 icon="angle-down" | |
53 fixed-width | |
54 ></font-awesome-icon> | |
55 <Logs v-if="logsVisible"></Logs> | |
56 <div v-else> | |
57 <h6> | |
58 <small><translate>Logs</translate></small> | |
59 </h6> | |
60 </div> | |
61 </div> | |
2403 | 62 </div> |
63 </div> | |
64 </template> | |
65 | |
66 <script> | |
67 /* This is Free Software under GNU Affero General Public License v >= 3.0 | |
68 * without warranty, see README.md and license for details. | |
69 * | |
70 * SPDX-License-Identifier: AGPL-3.0-or-later | |
71 * License-Filename: LICENSES/AGPL-3.0.txt | |
72 * | |
73 * Copyright (C) 2018 by via donau | |
74 * – Österreichische Wasserstraßen-Gesellschaft mbH | |
75 * Software engineering by Intevation GmbH | |
76 * | |
77 * Author(s): | |
78 * Thomas Junk <thomas.junk@intevation.de> | |
79 */ | |
80 import { displayError } from "@/lib/errors.js"; | |
81 import { mapState } from "vuex"; | |
82 | |
83 export default { | |
84 name: "importoverview", | |
85 components: { | |
86 Staging: () => import("./staging/Staging.vue"), | |
2422
77baf4f0ee1e
logs->importlogs due to .hgignore
Thomas Junk <thomas.junk@intevation.de>
parents:
2403
diff
changeset
|
87 Logs: () => import("./importlogs/Logs.vue") |
2403 | 88 }, |
89 computed: { | |
2428 | 90 ...mapState("imports", ["stagingVisible", "logsVisible", "staging"]) |
2403 | 91 }, |
92 methods: { | |
93 toggleStaging() { | |
94 this.$store.commit("imports/setStagingVisibility", !this.stagingVisible); | |
95 }, | |
96 toggleLogs() { | |
97 this.$store.commit("imports/setLogsVisibility", !this.logsVisible); | |
98 }, | |
99 refresh() { | |
100 this.loadImportQueue(); | |
101 this.loadLogs(); | |
102 }, | |
103 loadImportQueue() { | |
2426
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
104 this.$store.dispatch("imports/getStaging").catch(error => { |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
105 const { status, data } = error.response; |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
106 displayError({ |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
107 title: "Backend Error", |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
108 message: `${status}: ${data.message || data}` |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
109 }); |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
110 }); |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
111 }, |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2422
diff
changeset
|
112 loadLogs() { |
2403 | 113 this.$store |
114 .dispatch("imports/getImports") | |
115 .then(() => {}) | |
116 .catch(error => { | |
117 const { status, data } = error.response; | |
118 displayError({ | |
119 title: this.$gettext("Backend Error"), | |
120 message: `${status}: ${data.message || data}` | |
121 }); | |
122 }); | |
123 } | |
124 }, | |
125 mounted() { | |
126 this.refresh(); | |
127 } | |
128 }; | |
129 </script> | |
130 | |
131 <style></style> |