comparison client/src/components/importoverview/Filters.vue @ 2654:3c04c8e46bd4

importoverview: reload reloads current selection
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 14 Mar 2019 15:37:10 +0100
parents 956b230c6062
children c40540889b53
comparison
equal deleted inserted replaced
2653:7fd47d9641ac 2654:3c04c8e46bd4
17 </button> 17 </button>
18 </div> 18 </div>
19 </template> 19 </template>
20 20
21 <script> 21 <script>
22 /* This is Free Software under GNU Affero General Public License v >= 3.0
23 * without warranty, see README.md and license for details.
24 *
25 * SPDX-License-Identifier: AGPL-3.0-or-later
26 * License-Filename: LICENSES/AGPL-3.0.txt
27 *
28 * Copyright (C) 2018 by via donau
29 * – Österreichische Wasserstraßen-Gesellschaft mbH
30 * Software engineering by Intevation GmbH
31 *
32 * Author(s):
33 * Thomas Junk <thomas.junk@intevation.de>
34 */
35 import { mapState } from "vuex";
36
22 export default { 37 export default {
23 name: "importfilters", 38 name: "importfilters",
24 data() {
25 return {
26 failed: false,
27 pending: false,
28 accepted: false,
29 declined: false,
30 warning: false
31 };
32 },
33 methods: { 39 methods: {
34 setFilter(name) { 40 setFilter(name) {
35 if (this.loading) return; 41 if (this.loading) return;
36 this[name] = !this[name]; 42 this.$store.commit("imports/toggleFilter", name);
37 const allSet =
38 this.failed &&
39 this.pending &&
40 this.accepted &&
41 this.declined &&
42 this.warning;
43 if (allSet) {
44 this.warning = false;
45 this.successful = false;
46 this.failed = false;
47 this.pending = false;
48 this.accepted = false;
49 this.declined = false;
50 this.$store.commit("imports/clearFilers");
51 }
52 const filters = [
53 "failed",
54 "pending",
55 "accepted",
56 "declined",
57 "warning"
58 ].filter(x => this[x]);
59 this.$store.commit("imports/setFilters", filters);
60 } 43 }
61 }, 44 },
62 computed: { 45 computed: {
46 ...mapState("imports", [
47 "pending",
48 "failed",
49 "accepted",
50 "warning",
51 "declined"
52 ]),
63 pendingStyle() { 53 pendingStyle() {
64 return { 54 return {
65 btn: true, 55 btn: true,
66 "btn-sm": true, 56 "btn-sm": true,
67 "btn-light": !this.pending, 57 "btn-light": !this.pending,