From 97657284a88169708be9df4943de6cdc3e4c5b17 Mon Sep 17 00:00:00 2001 From: Dmitriymush Date: Thu, 16 Jun 2022 22:23:14 +0300 Subject: [PATCH] fixes after review --- ui-ngx/src/app/core/services/dashboard-utils.service.ts | 8 ++++++-- .../components/dashboard-page/dashboard-page.component.ts | 3 ++- .../components/dashboard-page/dashboard-page.models.ts | 2 +- ui-ngx/src/app/shared/models/dashboard.models.ts | 3 +-- 4 files changed, 10 insertions(+), 6 deletions(-) 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 8e64822897..e95990e530 100644 --- a/ui-ngx/src/app/core/services/dashboard-utils.service.ts +++ b/ui-ngx/src/app/core/services/dashboard-utils.service.ts @@ -287,10 +287,14 @@ export class DashboardUtilsService { let addedCount = 0; let removedCount = 0; for (const l of Object.keys(state.layouts)) { - removedCount++; + if (!newLayouts[l]) { + removedCount++; + } } for (const l of Object.keys(newLayouts)) { - addedCount++; + if (!state.layouts[l]) { + addedCount++; + } } state.layouts = newLayouts; const layoutsCount = Object.keys(state.layouts).length; 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 436be6a399..366679cba8 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 @@ -43,7 +43,8 @@ import { DashboardLayoutsInfo, DashboardState, DashboardStateLayouts, - GridSettings, LayoutDimension, + GridSettings, + LayoutDimension, WidgetLayout } from '@app/shared/models/dashboard.models'; import { WINDOW } from '@core/services/window.service'; diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.models.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.models.ts index c7ffd6f49c..ea2421ed1e 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.models.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.models.ts @@ -73,7 +73,7 @@ export interface DashboardPageLayout { layoutCtx: DashboardPageLayoutContext; } -export declare type DashboardPageLayouts = {[key in DashboardLayoutId ]: DashboardPageLayout }; +export declare type DashboardPageLayouts = {[key in DashboardLayoutId]: DashboardPageLayout}; export class LayoutWidgetsArray implements Iterable { diff --git a/ui-ngx/src/app/shared/models/dashboard.models.ts b/ui-ngx/src/app/shared/models/dashboard.models.ts index 370faad98b..30c1446722 100644 --- a/ui-ngx/src/app/shared/models/dashboard.models.ts +++ b/ui-ngx/src/app/shared/models/dashboard.models.ts @@ -81,8 +81,7 @@ export declare type DashboardLayoutId = 'main' | 'right'; export declare type LayoutType = 'percentage' | 'fixed'; -// export declare type DashboardStateLayouts = {[key in DashboardLayoutId | 'layoutDimension']?: DashboardLayout & LayoutDimension }; -export declare type DashboardStateLayouts = {[key in DashboardLayoutId]?: DashboardLayout }; +export declare type DashboardStateLayouts = {[key in DashboardLayoutId]?: DashboardLayout}; export declare type DashboardLayoutsInfo = {[key in DashboardLayoutId]?: DashboardLayoutInfo};