enable save button only if dashboard is dirty
This commit is contained in:
@@ -53,7 +53,7 @@
|
|||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<button mat-button (click)="addText()">Add Text</button>
|
<button mat-button (click)="addText()">Add Text</button>
|
||||||
<button mat-button (click)="addPlot()">Add Plot</button>
|
<button mat-button (click)="addPlot()">Add Plot</button>
|
||||||
<button class="save-button" mat-button (click)="save()">Save</button>
|
<button class="save-button" mat-button (click)="save()" [disabled]="!isDirty()">Save</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="editable">
|
<div class="editable">
|
||||||
<h1>{{dashboard.name}}<button mat-icon-button (click)="editNameAndDescription()" class="editable-hovered"><img src="/assets/img/edit-outline.svg"/></button></h1>
|
<h1>{{dashboard.name}}<button mat-icon-button (click)="editNameAndDescription()" class="editable-hovered"><img src="/assets/img/edit-outline.svg"/></button></h1>
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export class DashboardComponent implements OnInit {
|
|||||||
|
|
||||||
dashboard?: Dashboard = undefined;
|
dashboard?: Dashboard = undefined;
|
||||||
|
|
||||||
|
pristineDashboardJSON?: string = undefined;
|
||||||
|
|
||||||
error = "";
|
error = "";
|
||||||
|
|
||||||
plotWidgetRenderData: PlotWidgetRenderData[] = [];
|
plotWidgetRenderData: PlotWidgetRenderData[] = [];
|
||||||
@@ -34,6 +36,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
this.service.getDashboard(<string>this.route.snapshot.paramMap.get("id")).subscribe({
|
this.service.getDashboard(<string>this.route.snapshot.paramMap.get("id")).subscribe({
|
||||||
'next':(dashboard: Dashboard) => {
|
'next':(dashboard: Dashboard) => {
|
||||||
this.dashboard = dashboard;
|
this.dashboard = dashboard;
|
||||||
|
this.pristineDashboardJSON = JSON.stringify(dashboard);
|
||||||
this.repairArrangement();
|
this.repairArrangement();
|
||||||
|
|
||||||
dashboard.plots.forEach(p => {
|
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[]) {
|
loadImages(index: number, plotWidgetQueue: PlotWidgetRenderData[]) {
|
||||||
|
|
||||||
if (index < plotWidgetQueue.length){
|
if (index < plotWidgetQueue.length){
|
||||||
@@ -161,6 +168,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
duration: 5000,
|
duration: 5000,
|
||||||
verticalPosition: 'top'
|
verticalPosition: 'top'
|
||||||
});
|
});
|
||||||
|
this.pristineDashboardJSON = JSON.stringify(this.dashboard);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ button[disabled] .icon-inline {
|
|||||||
button.save-button {
|
button.save-button {
|
||||||
background-color: #ff9900;
|
background-color: #ff9900;
|
||||||
}
|
}
|
||||||
|
button.save-button:disabled {
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-small {
|
.icon-small {
|
||||||
width: 1.5em;
|
width: 1.5em;
|
||||||
|
|||||||
Reference in New Issue
Block a user