support dashboards associated to the selected role (#280)

pull/3759/head
elsiosanchez 2020-01-28 18:03:39 -04:00 committed by Yamel Senih
parent 63944c9815
commit 16f74a429e
2 changed files with 14 additions and 8 deletions

View File

@ -28,6 +28,14 @@ export default {
computed: {
getterDashboard() {
return this.$store.getters.getDashboardByRole(this.roleUuid)
},
getterRol() {
return this.$store.getters.getRoleUuid
}
},
watch: {
getterRol(value) {
this.getDashboardListFromServer()
}
},
mounted() {
@ -35,14 +43,11 @@ export default {
},
methods: {
getDashboardListFromServer() {
if (this.getterDashboard) {
this.dashboardList = this.getterDashboard.dashboardList
} else {
this.$store.dispatch('listDashboard', this.roleUuid)
.then(response => {
this.dashboardList = response.dashboardsList
})
}
this.$store.dispatch('listDashboard')
.then(response => {
this.dashboardList = response.dashboardsList
this.$forceUpdate()
})
}
}
}

View File

@ -62,6 +62,7 @@ export default {
})
this.$store.dispatch('user/changeRoles', valueSelected)
.then(response => {
this.$store.dispatch('listDashboard', response.uuid)
this.showMessage({
message: this.$t('notifications.successChangeRole'),
type: 'success'