annotate client/src/components/importoverview/Filters.vue @ 2605:11fd7ee37f10

overview2: added stretch zoom functionality
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 12 Mar 2019 17:08:49 +0100
parents 956b230c6062
children 3c04c8e46bd4
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>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 export default {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 name: "importfilters",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 data() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 failed: false,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 pending: false,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 accepted: false,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 declined: false,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 warning: false
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 methods: {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 setFilter(name) {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35 if (this.loading) return;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 this[name] = !this[name];
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 const allSet =
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38 this.failed &&
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
39 this.pending &&
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40 this.accepted &&
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41 this.declined &&
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
42 this.warning;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 if (allSet) {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 this.warning = false;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 this.successful = false;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 this.failed = false;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 this.pending = false;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 this.accepted = false;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 this.declined = false;
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 this.$store.commit("imports/clearFilers");
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
51 }
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 const filters = [
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 "failed",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 "pending",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 "accepted",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 "declined",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 "warning"
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 ].filter(x => this[x]);
2593
956b230c6062 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2579
diff changeset
59 this.$store.commit("imports/setFilters", filters);
2579
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 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 computed: {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 pendingStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 "btn-light": !this.pending,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 "btn-secondary": this.pending
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 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 failedStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 "btn-light": !this.failed,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 "btn-secondary": this.failed
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 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 declinedStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 "btn-light": !this.declined,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 "btn-secondary": this.declined
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 },
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 acceptedStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 "btn-light": !this.accepted,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 "btn-secondary": this.accepted
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 warningStyle() {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 return {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100 "ml-2": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 btn: true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 "btn-sm": true,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 "btn-light": !this.warning,
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 "btn-secondary": this.warning
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 }
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 }
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 };
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 </script>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 <style lang="scss" scoped></style>