Mercurial > gemma
changeset 5351:4b367f7e39b4 extented-report
Added messaging from overview to details.
When the userdetails is open and the state of the toggle for
receiving reports is changed, this change is now progagated
to the details view via props.
The canonical way would have been to use Vue.set on the instance of
currentUser. But this did not work as expected. So this way
via props seems to do the trick.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 22 Jun 2021 12:58:38 +0200 |
parents | 59db9836e29a |
children | 979f139cde4d |
files | client/src/components/usermanagement/Userdetail.vue client/src/components/usermanagement/Usermanagement.vue |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/usermanagement/Userdetail.vue Tue Jun 22 11:11:56 2021 +0200 +++ b/client/src/components/usermanagement/Userdetail.vue Tue Jun 22 12:58:38 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 11:11:56 2021 +0200 +++ b/client/src/components/usermanagement/Usermanagement.vue Tue Jun 22 12:58:38 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: { @@ -233,7 +233,9 @@ } ) .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";