annotate client/src/components/importoverview/Filters.vue @ 3802:e8a950cf6c02 yworks-svg2pdf

Move Template loading and Imageprocessing to mixin Rationale: 1) Template loading is a process used by many components. As such it makes sense to parametrize the URL and centralize loading. 2) Imageprocessing has to be done after each template is loaded on the client As such it makes sense to centralize that. To make handling easier, each (1) and (2) is in an independend Promise to make chaining of calls easier to read.
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 04 Jul 2019 10:57:43 +0200
parents 3473f3b72e21
children
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>
2883
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
3 <button
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
4 @click="setFilter('pending')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
5 :class="'mr-1 btn btn-xs btn-' + (this.pending ? 'secondary' : 'light')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
6 >
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 <translate>pending</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 </button>
2883
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
9 <button
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
10 @click="setFilter('failed')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
11 :class="'mr-1 btn btn-xs btn-' + (this.failed ? 'secondary' : 'light')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
12 >
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 <translate>failed</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 </button>
2883
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
15 <button
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
16 @click="setFilter('accepted')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
17 :class="'mr-1 btn btn-xs btn-' + (this.accepted ? 'secondary' : 'light')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
18 >
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 <translate>accepted</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 </button>
2883
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
21 <button
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
22 @click="setFilter('declined')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
23 :class="'mr-1 btn btn-xs btn-' + (this.declined ? 'secondary' : 'light')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
24 >
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 <translate>declined</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 </button>
2883
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
27 <button
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
28 @click="setFilter('warning')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
29 :class="'btn btn-xs btn-' + (this.warning ? 'secondary' : 'light')"
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
30 >
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 <translate>warning</translate>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 </button>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 </div>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 </template>
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 <script>
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
37 /* 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
38 * 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
39 *
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
40 * SPDX-License-Identifier: AGPL-3.0-or-later
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
41 * License-Filename: LICENSES/AGPL-3.0.txt
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
42 *
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
43 * Copyright (C) 2018 by via donau
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
44 * – Österreichische Wasserstraßen-Gesellschaft mbH
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
45 * Software engineering by Intevation GmbH
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
46 *
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
47 * Author(s):
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
48 * Thomas Junk <thomas.junk@intevation.de>
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
49 */
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
50 import { mapState } from "vuex";
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
51
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 export default {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 name: "importfilters",
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 methods: {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 setFilter(name) {
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 if (this.loading) return;
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
57 this.$store.commit("imports/toggleFilter", name);
2579
5295a182b4a4 overview2 WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 }
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 computed: {
2654
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
61 ...mapState("imports", [
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
62 "pending",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
63 "failed",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
64 "accepted",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
65 "warning",
3c04c8e46bd4 importoverview: reload reloads current selection
Thomas Junk <thomas.junk@intevation.de>
parents: 2593
diff changeset
66 "declined"
2883
3473f3b72e21 client: importsoverview: filters: made code more compact
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
67 ])
2579
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 </script>