edit name and description on dashboard page

This commit is contained in:
2023-03-12 08:52:54 +01:00
parent 96ed788793
commit 44aed2883d
2 changed files with 37 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ import { NewDashboardComponent } from './new-dashboard/new-dashboard.component';
})
export class DashboardPageComponent implements OnInit {
displayedColumns: string[] = [/*'icon',*/ 'name', 'description','delete'];
displayedColumns: string[] = [/*'icon',*/ 'name', 'description','actions'];
dataSource: Dashboard[] = [];
loading = true;
error = "";
@@ -54,6 +54,31 @@ export class DashboardPageComponent implements OnInit {
});
}
edit(dashboard: Dashboard) {
const dialogRef = this.dialog.open(NewDashboardComponent, {
data: {name: dashboard.name, description: dashboard.description},
hasBackdrop: true
});
dialogRef.afterClosed().subscribe((result?: DashboardCreationData) => {
if (result) {
dashboard.name = result.name;
dashboard.description = result.description;
this.dashboardService.saveDashboard(dashboard).subscribe({
'error': () => {
this.snackBar.open("server made a boo boo", "", {
duration:5000
})
},
complete: () => {
this.refreshTable()
}
});
}
});
}
delete(dashboard: Dashboard){
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {