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 fa5c0abfab..5d5015a4a9 100644 --- a/ui-ngx/src/app/core/services/dashboard-utils.service.ts +++ b/ui-ngx/src/app/core/services/dashboard-utils.service.ts @@ -29,7 +29,7 @@ import { GridSettings, WidgetLayout } from '@shared/models/dashboard.models'; -import { deepClone, isDefined, isDefinedAndNotNull, isNotEmptyStr, isString, isUndefined } from '@core/utils'; +import { deepClone, isDefined, isDefinedAndNotNull, isNotEmptyStr, isString, isUndefined, isEqual } from '@core/utils'; import { Datasource, datasourcesHasOnlyComparisonAggregation, @@ -742,6 +742,28 @@ 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.html b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html index de5bd65061..a8953f659f 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html @@ -285,7 +285,8 @@ + [class]="{'tb-shrinked' : isEditingWidget, + 'diagonal-stripes': !layouts.right.show && layouts.main.layoutCtx.breakpoint !== 'default'}"> + [style]="{width: mainLayoutSize.width, + height: mainLayoutSize.height, + maxWidth: mainLayoutSize.maxWidth}"> (); - constructor(protected store: Store, - private translate: TranslateService, - private itembuffer: ItemBufferService, - private imagePipe: ImagePipe, - private sanitizer: DomSanitizer, - private dashboardUtils: DashboardUtilsService,) { + constructor( + protected store: Store, + private translate: TranslateService, + private itembuffer: ItemBufferService, + private imagePipe: ImagePipe, + private sanitizer: DomSanitizer, + private dashboardUtils: DashboardUtilsService, + ) { super(store); this.initHotKeys(); }