diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 49ed46d440..8e2d58e232 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -55,7 +55,7 @@ import { } from '@app/shared/models/dashboard.models'; import { WINDOW } from '@core/services/window.service'; import { WindowMessage } from '@shared/models/window-message.model'; -import { deepClone, guid, isDefined, isDefinedAndNotNull, isNotEmptyStr } from '@app/core/utils'; +import { deepClone, guid, isDefined, isDefinedAndNotNull, isEqual, isNotEmptyStr } from '@app/core/utils'; import { DashboardContext, DashboardPageInitData, @@ -868,15 +868,21 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC $event.stopPropagation(); } this.dialog.open(ManageDashboardStatesDialogComponent, { + {states: {[id: string]: DashboardState}; widgets: {[id: string]: Widget}}>(ManageDashboardStatesDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data: { - states: deepClone(this.dashboard.configuration.states) + states: deepClone(this.dashboard.configuration.states), + widgets: deepClone(this.dashboard.configuration.widgets) as {[id: string]: Widget} } - }).afterClosed().subscribe((states) => { - if (states) { - this.updateStates(states); + }).afterClosed().subscribe((result) => { + if (result) { + if (!isEqual(result.widgets, this.dashboard.configuration.widgets)) { + this.dashboard.configuration.widgets = result.widgets; + } + if (result.states) { + this.updateStates(result.states); + } } }); } diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.html index 8e6bf449e7..a260016760 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.html @@ -15,7 +15,7 @@ limitations under the License. --> -
+

dashboard.manage-states

@@ -96,7 +96,7 @@ - +
@@ -107,6 +107,13 @@ (click)="editState($event, state)"> edit +