5397
|
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>DQL Report</translate>
|
|
8 </small>
|
|
9 </div>
|
|
10 <div class="w-50">
|
|
11 <select
|
|
12 v-model="selectedReport"
|
|
13 class="ml-1 mr-1 form-control form-control-sm"
|
|
14 >
|
|
15 <option value="" v-if="this.availableReports.length === 0"
|
|
16 ><translate>No data selectable</translate></option
|
|
17 >
|
|
18 <option
|
|
19 v-for="(option, index) in this.availableReports"
|
|
20 :key="index"
|
|
21 :value="option"
|
|
22 >{{ option }}</option
|
|
23 >
|
|
24 </select>
|
|
25 </div>
|
|
26 </div>
|
|
27 </div>
|
|
28 <div v-if="!selectedReport" class="d-flex px-2">
|
|
29 <small
|
|
30 ><translate class="text-danger"
|
|
31 >Please select a report to update</translate
|
|
32 ></small
|
|
33 >
|
|
34 </div>
|
|
35 </div>
|
|
36 </template>
|
|
37
|
|
38 <script>
|
|
39 /* This is Free Software under GNU Affero General Public License v >= 3.0
|
|
40 * without warranty, see README.md and license for details.
|
|
41 *
|
|
42 * SPDX-License-Identifier: AGPL-3.0-or-later
|
|
43 * License-Filename: LICENSES/AGPL-3.0.txt
|
|
44 *
|
|
45 * Copyright (C) 2018 by via donau
|
|
46 * – Österreichische Wasserstraßen-Gesellschaft mbH
|
|
47 * Software engineering by Intevation GmbH
|
|
48 *
|
|
49 * Author(s):
|
|
50 * Thomas Junk <thomas.junk@intevation.de>
|
|
51 */
|
|
52 import { displayError } from "@/lib/errors";
|
|
53
|
|
54 export default {
|
|
55 name: "reports",
|
|
56 props: ["reportName", "availableReports"],
|
|
57 mounted() {
|
|
58 this.$store.dispatch("importschedule/loadAvailableReports").catch(error => {
|
|
59 let message = "Backend not reachable";
|
|
60 if (error.response) {
|
|
61 const { status, data } = error.response;
|
|
62 message = `${status}: ${data.message || data}`;
|
|
63 }
|
|
64 displayError({
|
|
65 title: this.$gettext("Backend Error"),
|
|
66 message: message
|
|
67 });
|
|
68 });
|
|
69 },
|
|
70 computed: {
|
|
71 selectedReport: {
|
|
72 get() {
|
|
73 return this.reportName;
|
|
74 },
|
|
75 set(value) {
|
|
76 this.selected = value;
|
|
77 this.$emit("reportNameChanged", value);
|
|
78 }
|
|
79 }
|
|
80 }
|
|
81 };
|
|
82 </script>
|
|
83
|
|
84 <style></style>
|