enable save button only if dashboard is dirty

This commit is contained in:
2023-03-12 09:36:33 +01:00
parent bc0ae23de5
commit dafe6813ed
3 changed files with 12 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ export class DashboardComponent implements OnInit {
dashboard?: Dashboard = undefined;
pristineDashboardJSON?: string = undefined;
error = "";
plotWidgetRenderData: PlotWidgetRenderData[] = [];
@@ -34,6 +36,7 @@ export class DashboardComponent implements OnInit {
this.service.getDashboard(<string>this.route.snapshot.paramMap.get("id")).subscribe({
'next':(dashboard: Dashboard) => {
this.dashboard = dashboard;
this.pristineDashboardJSON = JSON.stringify(dashboard);
this.repairArrangement();
dashboard.plots.forEach(p => {
@@ -54,6 +57,10 @@ export class DashboardComponent implements OnInit {
});
}
isDirty() {
return this.pristineDashboardJSON !== JSON.stringify(this.dashboard);
}
loadImages(index: number, plotWidgetQueue: PlotWidgetRenderData[]) {
if (index < plotWidgetQueue.length){
@@ -161,6 +168,7 @@ export class DashboardComponent implements OnInit {
duration: 5000,
verticalPosition: 'top'
});
this.pristineDashboardJSON = JSON.stringify(this.dashboard);
}
});
}