annotate client/src/components/importoverview/ImportOverview.vue @ 2503:51dbcbf11c5f critical-bottlenecks

client: addendum for e13daf439068 Of course, as you'd expect, this only solves the problem if you don't care about significant changes in the tables sorting behavior. To point out the difference this commit shows the other way to solve the problem without changing the tables behavior.
author Markus Kottlaender <markus@intevation.de>
date Mon, 04 Mar 2019 16:28:49 +0100
parents 0c9121abf120
children 40bd6bb7886b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 <UIBoxHeader
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 icon="clipboard-check"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 title="Staging Area"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 :closeCallback="$parent.close"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 />
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 <div class="d-flex flex-row w-100 justify-content-end">
2430
2a93a8649751 staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2428
diff changeset
9 <button
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
10 class="btn btn-sm btn-outline-info align-self-start mt-3 mr-3"
2430
2a93a8649751 staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2428
diff changeset
11 @click="refresh"
2a93a8649751 staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2428
diff changeset
12 >
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
13 <font-awesome-icon icon="redo"></font-awesome-icon>
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 </button>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 </div>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 <div class="d-flex flex-row w-100 border-bottom">
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 <font-awesome-icon
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 class="pointer"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 @click="toggleStaging()"
2428
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
20 v-if="stagingVisible && staging.length > 0"
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 icon="angle-up"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 fixed-width
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 ></font-awesome-icon>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 <font-awesome-icon
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 class="pointer"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 @click="toggleStaging()"
2428
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
27 v-if="!stagingVisible && staging.length > 0"
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 icon="angle-down"
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 fixed-width
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 ></font-awesome-icon>
2428
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
31 <span style="width:1.25em;" v-if="!(staging.length > 0)"></span>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
32 <Staging v-if="stagingVisible && staging.length > 0"></Staging>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
33 <div v-else class="d-flex flex-row">
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
34 <h6>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
35 <small><translate>Review</translate></small>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
36 </h6>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
37 <small class="ml-3" v-if="!(staging.length > 0)"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
38 ><translate>Nothing to review</translate></small
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
39 >
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
40 </div>
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41 </div>
2428
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
42 <div class="mt-2">
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
43 <div class="d-flex flex-row">
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
44 <font-awesome-icon
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
45 class="pointer"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
46 @click="toggleLogs()"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
47 v-if="logsVisible"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
48 icon="angle-up"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
49 fixed-width
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
50 ></font-awesome-icon>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
51 <font-awesome-icon
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
52 class="pointer"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
53 @click="toggleLogs()"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
54 v-if="!logsVisible"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
55 icon="angle-down"
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
56 fixed-width
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
57 ></font-awesome-icon>
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
58 <Logs v-if="logsVisible" :reload="reload"></Logs>
2428
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
59 <div v-else>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
60 <h6>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
61 <small><translate>Logs</translate></small>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
62 </h6>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
63 </div>
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
64 </div>
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 </div>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 </div>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 </template>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 <script>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 /* This is Free Software under GNU Affero General Public License v >= 3.0
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 * without warranty, see README.md and license for details.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 *
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 * SPDX-License-Identifier: AGPL-3.0-or-later
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 * License-Filename: LICENSES/AGPL-3.0.txt
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 *
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 * Copyright (C) 2018 by via donau
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 * – Österreichische Wasserstraßen-Gesellschaft mbH
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 * Software engineering by Intevation GmbH
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 *
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 * Author(s):
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 * Thomas Junk <thomas.junk@intevation.de>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 */
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 import { displayError } from "@/lib/errors.js";
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 import { mapState } from "vuex";
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 export default {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 name: "importoverview",
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
88 data() {
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
89 return {
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
90 reload: false
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
91 };
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
92 },
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 components: {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 Staging: () => import("./staging/Staging.vue"),
2422
77baf4f0ee1e logs->importlogs due to .hgignore
Thomas Junk <thomas.junk@intevation.de>
parents: 2403
diff changeset
95 Logs: () => import("./importlogs/Logs.vue")
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 },
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 computed: {
2428
78d4ce079f9b staging: optics
Thomas Junk <thomas.junk@intevation.de>
parents: 2426
diff changeset
98 ...mapState("imports", ["stagingVisible", "logsVisible", "staging"])
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 },
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100 methods: {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 toggleStaging() {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 this.$store.commit("imports/setStagingVisibility", !this.stagingVisible);
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 },
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 toggleLogs() {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 this.$store.commit("imports/setLogsVisibility", !this.logsVisible);
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 },
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 refresh() {
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
108 this.reload = true;
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 this.loadImportQueue();
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 this.loadLogs();
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 },
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 loadImportQueue() {
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
113 this.$store
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
114 .dispatch("imports/getStaging")
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
115 .then(() => {
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
116 this.reload = false;
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
117 })
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
118 .catch(error => {
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
119 const { status, data } = error.response;
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
120 displayError({
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
121 title: "Backend Error",
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
122 message: `${status}: ${data.message || data}`
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
123 });
2426
53323f701cf3 reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents: 2422
diff changeset
124 });
53323f701cf3 reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents: 2422
diff changeset
125 },
53323f701cf3 reload staging after confirm
Thomas Junk <thomas.junk@intevation.de>
parents: 2422
diff changeset
126 loadLogs() {
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 this.$store
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
128 .dispatch("imports/getImports")
2449
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
129 .then(() => {
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
130 this.reload = false;
0c9121abf120 staging: reload button clears filtering
Thomas Junk <thomas.junk@intevation.de>
parents: 2430
diff changeset
131 })
2403
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 .catch(error => {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 const { status, data } = error.response;
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
134 displayError({
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 title: this.$gettext("Backend Error"),
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
136 message: `${status}: ${data.message || data}`
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
137 });
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138 });
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
139 }
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
140 },
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 mounted() {
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 this.refresh();
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
143 }
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
144 };
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
145 </script>
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
146
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 <style></style>