Mercurial > gemma
annotate client/src/components/importoverview/staging/Staging.vue @ 2462:9ae2a2f758bb
client: make use of new table header/body components
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 04 Mar 2019 14:50:23 +0100 |
parents | 78d4ce079f9b |
children | 40bd6bb7886b |
rev | line source |
---|---|
2403 | 1 <template> |
2 <div class="w-100"> | |
3 <div class="d-flex justify-content-between flex-row w-100 border-bottom"> | |
2428 | 4 <h6><translate>Review</translate></h6> |
5 <button class="btn btn-sm btn-info align-self-end" @click="save"> | |
2403 | 6 <translate>Confirm</translate> |
7 </button> | |
8 </div> | |
9 <StagingDetail | |
10 class="mb-3 border-bottom" | |
11 :key="data.id" | |
12 v-for="data in filteredData" | |
13 :data="data" | |
14 ></StagingDetail> | |
15 </div> | |
16 </template> | |
17 | |
18 <script> | |
19 /* This is Free Software under GNU Affero General Public License v >= 3.0 | |
20 * without warranty, see README.md and license for details. | |
21 * | |
22 * SPDX-License-Identifier: AGPL-3.0-or-later | |
23 * License-Filename: LICENSES/AGPL-3.0.txt | |
24 * | |
25 * Copyright (C) 2018 by via donau | |
26 * – Österreichische Wasserstraßen-Gesellschaft mbH | |
27 * Software engineering by Intevation GmbH | |
28 * | |
29 * Author(s): | |
30 * Thomas Junk <thomas.junk@intevation.de> | |
31 * Markus Kottländer <markus@intevation.de> | |
32 */ | |
33 import { mapState, mapGetters } from "vuex"; | |
34 import { displayError, displayInfo } from "@/lib/errors.js"; | |
35 | |
36 export default { | |
37 name: "stagingsection", | |
38 computed: { | |
39 ...mapState("imports", ["staging"]), | |
40 ...mapGetters("imports", ["processedReviews"]), | |
41 filteredData() { | |
42 return this.staging; | |
43 } | |
44 }, | |
45 methods: { | |
2410 | 46 loadImportQueue() { |
2426
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2410
diff
changeset
|
47 this.$store.dispatch("imports/getStaging").catch(error => { |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2410
diff
changeset
|
48 const { status, data } = error.response; |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2410
diff
changeset
|
49 displayError({ |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2410
diff
changeset
|
50 title: "Backend Error", |
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2410
diff
changeset
|
51 message: `${status}: ${data.message || data}` |
2410 | 52 }); |
2426
53323f701cf3
reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents:
2410
diff
changeset
|
53 }); |
2410 | 54 }, |
2403 | 55 save() { |
56 if (!this.processedReviews.length) return; | |
57 this.$store | |
58 .dispatch("imports/confirmReview", this.processedReviews) | |
59 .then(response => { | |
2410 | 60 this.loadImportQueue(); |
2403 | 61 const messages = response.data |
62 .map(x => { | |
63 if (x.message) return x.message; | |
64 if (x.error) return x.error; | |
65 }) | |
66 .join("\n\n"); | |
67 displayInfo({ | |
68 title: "Staging Area", | |
69 message: messages, | |
70 options: { | |
71 timeout: 0, | |
72 buttons: [{ text: "Ok", action: null, bold: true }] | |
73 } | |
74 }); | |
75 }) | |
76 .catch(error => { | |
77 const { status, data } = error.response; | |
78 displayError({ | |
79 title: "Backend Error", | |
80 message: `${status}: ${data.message || data}` | |
81 }); | |
82 }); | |
83 } | |
84 }, | |
85 components: { | |
86 StagingDetail: () => import("./StagingDetail.vue") | |
87 } | |
88 }; | |
89 </script> | |
90 | |
91 <style></style> |