From 55a949b6d97473223603577ede52b36b81a5936e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 25 May 2020 17:22:17 +0300 Subject: [PATCH] Fix setting 'Margin beetween widgets' set 0 --- ui-ngx/src/app/core/services/dashboard-utils.service.ts | 2 +- .../modules/home/components/dashboard/dashboard.component.ts | 4 ++-- .../pages/dashboard/dashboard-settings-dialog.component.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 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 15f0b23d6a..b3387f066e 100644 --- a/ui-ngx/src/app/core/services/dashboard-utils.service.ts +++ b/ui-ngx/src/app/core/services/dashboard-utils.service.ts @@ -275,7 +275,7 @@ export class DashboardUtilsService { layout.gridSettings.margin = layout.gridSettings.margins[0]; delete layout.gridSettings.margins; } - layout.gridSettings.margin = layout.gridSettings.margin || 10; + layout.gridSettings.margin = isDefined(layout.gridSettings.margin) ? layout.gridSettings.margin : 10; } public setLayouts(dashboard: Dashboard, targetState: string, newLayouts: DashboardStateLayouts) { diff --git a/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts b/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts index 18503a1aed..0bc4f6beee 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts @@ -196,7 +196,7 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo maxItemRows: 1000, maxItemArea: 1000000, outerMargin: true, - margin: this.margin ? this.margin : 10, + margin: isDefined(this.margin) ? this.margin : 10, minItemCols: 1, minItemRows: 1, defaultItemCols: 8, @@ -495,7 +495,7 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo private updateLayoutOpts() { this.gridsterOpts.minCols = this.columns ? this.columns : 24; - this.gridsterOpts.margin = this.margin ? this.margin : 10; + this.gridsterOpts.margin = isDefined(this.margin) ? this.margin : 10; } private updateEditingOpts() { diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.ts index 548dfa65a1..642a97c1b3 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.ts @@ -25,7 +25,7 @@ import { DialogComponent } from '@app/shared/components/dialog.component'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; import { DashboardSettings, GridSettings, StateControllerId } from '@app/shared/models/dashboard.models'; -import { isUndefined } from '@core/utils'; +import { isDefined, isUndefined } from '@core/utils'; import { DashboardUtilsService } from '@core/services/dashboard-utils.service'; import { StatesControllerService } from './states/states-controller.service'; @@ -96,7 +96,8 @@ export class DashboardSettingsDialogComponent extends DialogComponent