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