Mercurial > gemma
changeset 5355:16c026da50b1 extented-report
Merged
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 22 Jun 2021 14:40:59 +0200 |
parents | 6a94ab82eaaa (current diff) 2578fd6f4c63 (diff) |
children | 3216b4a19023 |
files | |
diffstat | 4 files changed, 35 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue Tue Jun 22 14:40:27 2021 +0200 +++ b/client/src/components/identify/Identify.vue Tue Jun 22 14:40:59 2021 +0200 @@ -284,6 +284,7 @@ import filters from "@/lib/filters"; import { HTTP } from "@/lib/http"; import { format } from "date-fns"; +import { displayError } from "@/lib/errors"; const { recencyColorCodes, @@ -421,20 +422,32 @@ }, methods: { downloadDataQualityReport() { - HTTP.get(`/data/report/gauges`, { + HTTP.get(`/data/report/default`, { responseType: "blob", headers: { "X-Gemma-Auth": localStorage.getItem("token") } - }).then(response => { - const link = document.createElement("a"); - const now = new Date(); - link.href = window.URL.createObjectURL(new Blob([response.data])); - link.download = `DataQualityReport-${format(now, "YYYY-MM-DD")}.xlsx`; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - }); + }) + .then(response => { + const link = document.createElement("a"); + const now = new Date(); + link.href = window.URL.createObjectURL(new Blob([response.data])); + link.download = `DataQualityReport-${format(now, "YYYY-MM-DD")}.xlsx`; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }) + .catch(error => { + let message = "Backend not reachable"; + if (error.response) { + const { status, data } = error.response; + message = `${status}: ${data.message || data}`; + } + displayError({ + title: this.$gettext("Backend Error"), + message: message + }); + }); }, getGaugeStatusText(feature) { if (/bottleneck/.test(feature.getId())) return this.refGaugeStatusText;
--- a/client/src/components/usermanagement/Userdetail.vue Tue Jun 22 14:40:27 2021 +0200 +++ b/client/src/components/usermanagement/Userdetail.vue Tue Jun 22 14:40:59 2021 +0200 @@ -220,6 +220,7 @@ components: { PasswordField: () => import("./Passwordfield") }, + props: ["reportToggled"], data() { return { passwordLabel: this.$gettext("Password"), @@ -245,6 +246,9 @@ this.path = this.user.name; }, watch: { + reportToggled() { + this.currentUser.reports = this.user.reports; + }, user() { this.currentUser = { ...this.user }; this.path = this.user.name;
--- a/client/src/components/usermanagement/Usermanagement.vue Tue Jun 22 14:40:27 2021 +0200 +++ b/client/src/components/usermanagement/Usermanagement.vue Tue Jun 22 14:40:59 2021 +0200 @@ -100,7 +100,7 @@ </div> </div> </div> - <Userdetail v-if="isUserDetailsVisible" /> + <Userdetail :reportToggled="reportToggled" v-if="isUserDetailsVisible" /> </div> </div> </template> @@ -148,14 +148,14 @@ import { displayError, displayInfo } from "@/lib/errors"; import { HTTP } from "@/lib/http"; import { sortTable } from "@/lib/mixins"; -import Vue from "vue"; export default { name: "userview", mixins: [sortTable], data() { return { - sortColumn: "user" // overriding the sortTable mixin's empty default value + sortColumn: "user", // overriding the sortTable mixin's empty default value + reportToggled: false }; }, components: { @@ -228,12 +228,14 @@ { headers: { "X-Gemma-Auth": localStorage.getItem("token"), - "Content-type": "text/xml; charset=UTF-8" + "Content-type": "application/json; charset=UTF-8" } } ) .then(() => { - Vue.set(this.currentUser, "reports", user.reports); + if (this.currentUser.user === user.user) { + this.reportToggled = !this.reportToggled; + } }) .catch(error => { let message = "Backend not reachable";