edit name and description on dashboard page
This commit is contained in:
@@ -17,6 +17,9 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
.no-break {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div *ngIf="loading" class="center">
|
<div *ngIf="loading" class="center">
|
||||||
@@ -49,11 +52,14 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef>Description</th>
|
<th mat-header-cell *matHeaderCellDef>Description</th>
|
||||||
<td mat-cell *matCellDef="let element">{{element.description}}</td>
|
<td mat-cell *matCellDef="let element">{{element.description}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<!-- Delete Column -->
|
<!-- actions Column -->
|
||||||
<ng-container matColumnDef="delete">
|
<ng-container matColumnDef="actions">
|
||||||
<th mat-header-cell *matHeaderCellDef></th>
|
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element" class="no-break">
|
||||||
<button mat-icon-button (click)="delete(element)" aria-label="delete dashboard">
|
<button mat-icon-button (click)="edit(element)" aria-label="edit dashboard" title="edit dashboard">
|
||||||
|
<img src="assets/img/edit-outline.svg" class="icon-small" title="delete" />
|
||||||
|
</button>
|
||||||
|
<button mat-icon-button (click)="delete(element)" aria-label="delete dashboard" title="delete dashboard">
|
||||||
<img src="assets/img/recycle-bin-line.svg" class="icon-small" title="delete" />
|
<img src="assets/img/recycle-bin-line.svg" class="icon-small" title="delete" />
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { NewDashboardComponent } from './new-dashboard/new-dashboard.component';
|
|||||||
})
|
})
|
||||||
export class DashboardPageComponent implements OnInit {
|
export class DashboardPageComponent implements OnInit {
|
||||||
|
|
||||||
displayedColumns: string[] = [/*'icon',*/ 'name', 'description','delete'];
|
displayedColumns: string[] = [/*'icon',*/ 'name', 'description','actions'];
|
||||||
dataSource: Dashboard[] = [];
|
dataSource: Dashboard[] = [];
|
||||||
loading = true;
|
loading = true;
|
||||||
error = "";
|
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){
|
delete(dashboard: Dashboard){
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
|
|||||||
Reference in New Issue
Block a user