annotate client/src/components/importoverview/Filters.vue @ 2774:6c1c4f55d99b

sidebar: only update when user is logged in
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 22 Mar 2019 12:45:53 +0100
parents 3c04c8e46bd4
children c40540889b53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 <button @click="setFilter('pending')" :class="pendingStyle">
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 <translate>pending</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 </button>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 <button @click="setFilter('failed')" :class="failedStyle">
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 <translate>failed</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 </button>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 <button @click="setFilter('accepted')" :class="acceptedStyle">
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 <translate>accepted</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 </button>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 <button @click="setFilter('declined')" :class="declinedStyle">
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 <translate>declined</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 </button>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 <button @click="setFilter('warning')" :class="warningStyle">
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 <translate>warning</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 </button>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 </div>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 </template>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 <script>
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
22 /* This is Free Software under GNU Affero General Public License v >= 3.0
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
23 * without warranty, see README.md and license for details.
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
24 *
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
25 * SPDX-License-Identifier: AGPL-3.0-or-later
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
26 * License-Filename: LICENSES/AGPL-3.0.txt
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
27 *
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
28 * Copyright (C) 2018 by via donau
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
29 * – Österreichische Wasserstraßen-Gesellschaft mbH
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
30 * Software engineering by Intevation GmbH
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
31 *
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
32 * Author(s):
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
33 * Thomas Junk <thomas.junk@intevation.de>
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
34 */
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
35 import { mapState } from "vuex";
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
36
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 export default {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38 name: "importfilters",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
39 methods: {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40 setFilter(name) {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41 if (this.loading) return;
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
42 this.$store.commit("imports/toggleFilter", name);
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 }
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 computed: {
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
46 ...mapState("imports", [
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
47 "pending",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
48 "failed",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
49 "accepted",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
50 "warning",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
51 "declined"
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
52 ]),
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 pendingStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 "btn-light": !this.pending,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 "btn-secondary": this.pending
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 failedStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 "btn-light": !this.failed,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 "btn-secondary": this.failed
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 declinedStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 "btn-light": !this.declined,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 "btn-secondary": this.declined
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 acceptedStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 "btn-light": !this.accepted,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 "btn-secondary": this.accepted
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 warningStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 "btn-light": !this.warning,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 "btn-secondary": this.warning
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 }
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 }
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 </script>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 <style lang="scss" scoped></style>