fix(ui) - dashboard info update

This commit is contained in:
Shekar Siri 2023-02-27 11:36:30 +01:00
parent f38956592b
commit b94bd834d3
2 changed files with 10 additions and 2 deletions

View file

@ -215,9 +215,9 @@ export default class DashboardStore {
syncDashboardInfo(id: string, info: { name: string, description: string, isPublic: boolean, createdAt: number }) { syncDashboardInfo(id: string, info: { name: string, description: string, isPublic: boolean, createdAt: number }) {
if (this.selectedDashboard !== null) { if (this.selectedDashboard !== null) {
this.selectedDashboard.update(info) this.selectedDashboard.updateInfo(info)
const index = this.dashboards.findIndex((d) => d.dashboardId === id); const index = this.dashboards.findIndex((d) => d.dashboardId === id);
Object.assign(this.dashboards[index], info) this.dashboards[index].updateInfo(info);
} }
} }

View file

@ -30,6 +30,14 @@ export default class Dashboard {
this.validate() this.validate()
} }
updateInfo(data: any) {
runInAction(() => {
this.name = data.name || this.name
this.description = data.description || this.description
this.isPublic = data.isPublic
})
}
toJson() { toJson() {
return { return {
dashboardId: this.dashboardId, dashboardId: this.dashboardId,