diff --git a/ui-ngx/src/app/core/services/dashboard-utils.service.ts b/ui-ngx/src/app/core/services/dashboard-utils.service.ts index 4d9788ce8e..3f3972da8a 100644 --- a/ui-ngx/src/app/core/services/dashboard-utils.service.ts +++ b/ui-ngx/src/app/core/services/dashboard-utils.service.ts @@ -785,28 +785,6 @@ export class DashboardUtilsService { } } - public removeBreakpointsDuplicateInLayouts(dashboard: Dashboard) { - const dashboardConfiguration = dashboard.configuration; - const states = dashboardConfiguration.states; - for (const s of Object.keys(states)) { - const state = states[s]; - for (const l of Object.keys(state.layouts)) { - const layout: DashboardLayout = state.layouts[l]; - if (layout.breakpoints) { - for (const breakpoint of Object.keys(layout.breakpoints)) { - const breakpointLayout = layout.breakpoints[breakpoint]; - if (isEqual(breakpointLayout.widgets, layout.widgets) && isEqual(breakpointLayout.gridSettings, layout.gridSettings)) { - delete layout.breakpoints[breakpoint]; - if (isEqual(layout.breakpoints, {})) { - delete layout.breakpoints; - } - } - } - } - } - } - } - private validateAndUpdateEntityAliases(configuration: DashboardConfiguration, datasourcesByAliasId: {[aliasId: string]: Array}, targetDevicesByAliasId: {[aliasId: string]: Array}): DashboardConfiguration { 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 d67f22f3da..311fd6c258 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 @@ -1216,7 +1216,6 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC }; this.window.parent.postMessage(JSON.stringify(message), '*'); } else { - this.dashboardUtils.removeBreakpointsDuplicateInLayouts(this.dashboard); this.dashboardService.saveDashboard(this.dashboard).subscribe(); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts index 3f9e0e9ffe..7ca05f9a7c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts @@ -40,6 +40,7 @@ import { GridsterItemComponent } from 'angular-gridster2'; import { UtilsService } from '@core/services/utils.service'; import ITooltipsterInstance = JQueryTooltipster.ITooltipsterInstance; import { from } from 'rxjs'; +import { DashboardUtilsService } from '@core/services/dashboard-utils.service'; export enum WidgetComponentActionType { MOUSE_DOWN, @@ -118,6 +119,7 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O widgetComponentAction: EventEmitter = new EventEmitter(); hovered = false; + isReferenceWidget = false; get widgetEditActionsEnabled(): boolean { return (this.isEditActionEnabled || this.isRemoveActionEnabled || this.isExportActionEnabled) && !this.widget?.isFullscreen; @@ -127,19 +129,17 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O private editWidgetActionsTooltip: ITooltipsterInstance; - isReferenceWidget = false; - constructor(protected store: Store, private cd: ChangeDetectorRef, private renderer: Renderer2, private container: ViewContainerRef, + private dashboardUtils: DashboardUtilsService, private utils: UtilsService) { super(store); } ngOnInit(): void { this.widget.widgetContext.containerChangeDetector = this.cd; - this.isReferenceWidget = this.dashboardWidgets.isReferenceWidget(this.widget); const cssString = this.widget.widget.config.widgetCss; if (isNotEmptyStr(cssString)) { this.cssClass = @@ -291,6 +291,11 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O functionAfter: () => { this.hovered = false; this.cd.markForCheck(); + }, + functionBefore: () => { + this.isReferenceWidget = this.dashboardUtils.isReferenceWidget( + this.widget.widgetContext.dashboard.stateController.dashboardCtrl.dashboardCtx.getDashboard(), this.widget.widgetId); + componentRef.instance.cd.detectChanges(); } }); this.editWidgetActionsTooltip = $(this.gridsterItem.el).tooltipster('instance'); @@ -339,7 +344,7 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O @Component({ template: `
-