From d0c2e9e1cb125aeed8eaa638e7fc584928a2fae7 Mon Sep 17 00:00:00 2001 From: Dmitriymush Date: Tue, 20 Sep 2022 18:09:25 +0300 Subject: [PATCH] feature/6371: bug-fix and refactoring --- .../dashboard-page.component.ts | 17 ++++- .../layout/dashboard-layout.component.html | 2 +- .../dashboard-page/layout/layout.models.ts | 10 +++ ...ge-dashboard-layouts-dialog.component.html | 74 +++++++++---------- ...nage-dashboard-layouts-dialog.component.ts | 47 ++++++++---- .../components/dashboard/layout-button.scss | 9 +++ 6 files changed, 102 insertions(+), 57 deletions(-) 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 85f12c2a32..2d0526f984 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 @@ -140,7 +140,7 @@ import { MatButton } from '@angular/material/button'; import { VersionControlComponent } from '@home/components/vc/version-control.component'; import { TbPopoverService } from '@shared/components/popover.service'; import { tap } from 'rxjs/operators'; -import { LayoutWidthType } from '@home/components/dashboard-page/layout/layout.models'; +import { LayoutFixedSize, LayoutWidthType } from '@home/components/dashboard-page/layout/layout.models'; // @dynamic @Component({ @@ -703,11 +703,20 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC return layoutDimension.leftWidthPercentage + '%'; } } else { + const dashboardWidth = this.dashboardContainer.nativeElement.getBoundingClientRect().width; + const minAvailableWidth = dashboardWidth - LayoutFixedSize.MIN; if (layoutDimension.fixedLayout === layout) { - return layoutDimension.fixedWidth + 'px'; + if (minAvailableWidth <= layoutDimension.fixedWidth) { + return minAvailableWidth + 'px'; + } else { + return layoutDimension.fixedWidth + 'px'; + } } else { - const layoutWidth = this.dashboardContainer.nativeElement.getBoundingClientRect().width - layoutDimension.fixedWidth; - return layoutWidth + 'px'; + if (minAvailableWidth <= layoutDimension.fixedWidth) { + return LayoutFixedSize.MIN + 'px'; + } else { + return (dashboardWidth - layoutDimension.fixedWidth) + 'px'; + } } } } else { diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/dashboard-layout.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/dashboard-layout.component.html index 3c3e6b9110..df1f5892d0 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/dashboard-layout.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/dashboard-layout.component.html @@ -28,7 +28,7 @@
- + {{'dashboard.no-widgets' | translate}} -
- + -
-
+
-
- + -
-
- + -
- - + +
diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.ts index d4ac0a9fd3..917ee619f9 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.ts @@ -39,7 +39,11 @@ import { DashboardSettingsDialogComponent, DashboardSettingsDialogData } from '@home/components/dashboard-page/dashboard-settings-dialog.component'; -import { LayoutWidthType } from '@home/components/dashboard-page/layout/layout.models'; +import { + LayoutFixedSize, + LayoutPercentageSize, + LayoutWidthType +} from '@home/components/dashboard-page/layout/layout.models'; import { Subscription } from 'rxjs'; import { MatTooltip } from '@angular/material/tooltip'; @@ -60,7 +64,11 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent