comparison client/src/components/importconfiguration/types/Statsupdate.vue @ 5388:60bba8e6322b extented-report

Add import for updating stats. Rationale: Due to performance optimization it seems advised to decouple updating the stats for the DQL report from the actual consumption while generating the report. -- Therefore we have a new import kind "statsupdate" which is selectable for sysadmins only. It could be scheduled as any other import. The available names for which stats to update are dynamically queried from the backend.
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 02 Jul 2021 13:56:51 +0200
parents
children 661e8a2deed9
comparison
equal deleted inserted replaced
5387:8e30b926b94d 5388:60bba8e6322b
1 <template>
2 <div>
3 <div class="d-flex px-2">
4 <div class="flex-column w-100">
5 <div class="flex-row text-left">
6 <small class="text-muted">
7 <translate>Stats Update</translate>
8 </small>
9 </div>
10 <div class="w-50">
11 <select
12 v-model="selectedStatsUpdate"
13 class="ml-1 mr-1 form-control form-control-sm"
14 >
15 <option
16 v-for="(option, index) in this.statsUpdates"
17 :key="index"
18 :value="option"
19 >{{ option }}</option
20 >
21 </select>
22 </div>
23 </div>
24 </div>
25 <div v-if="!statsUpdate" class="d-flex px-2">
26 <small
27 ><translate class="text-danger"
28 >Please select stats to update</translate
29 ></small
30 >
31 </div>
32 </div>
33 </template>
34
35 <script>
36 /* This is Free Software under GNU Affero General Public License v >= 3.0
37 * without warranty, see README.md and license for details.
38 *
39 * SPDX-License-Identifier: AGPL-3.0-or-later
40 * License-Filename: LICENSES/AGPL-3.0.txt
41 *
42 * Copyright (C) 2018 by via donau
43 * – Österreichische Wasserstraßen-Gesellschaft mbH
44 * Software engineering by Intevation GmbH
45 *
46 * Author(s):
47 * Thomas Junk <thomas.junk@intevation.de>
48 */
49 import { HTTP } from "@/lib/http";
50 import { displayError } from "@/lib/errors";
51
52 export default {
53 name: "statsupdate",
54 props: ["statsUpdate"],
55 data() {
56 return {
57 statsUpdates: []
58 };
59 },
60 mounted() {
61 HTTP.get("/data/stats-updates", {
62 headers: {
63 "X-Gemma-Auth": localStorage.getItem("token")
64 }
65 })
66 .then(response => {
67 this.statsUpdates = response.data["stats-updates"];
68 })
69 .catch(error => {
70 let message = "Backend not reachable";
71 if (error.response) {
72 const { status, data } = error.response;
73 message = `${status}: ${data.message || data}`;
74 }
75 displayError({
76 title: this.$gettext("Backend Error"),
77 message: message
78 });
79 });
80 },
81 computed: {
82 selectedStatsUpdate: {
83 get() {
84 return this.statsUpdate;
85 },
86 set(value) {
87 this.selected = value;
88 this.$emit("statsUpdateChanged", value);
89 }
90 }
91 }
92 };
93 </script>
94
95 <style></style>