diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.html
index bc1387e923..6d7313bf6c 100644
--- a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.html
@@ -76,7 +76,7 @@
-
+
@@ -158,7 +158,7 @@
Add breakpoint
-
+
{{ breakpoint }}
@@ -168,7 +168,7 @@
Copy from
-
+
{{ breakpoint }}
diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.scss b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.scss
index 8872ab89f8..cff90739ba 100644
--- a/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.scss
+++ b/ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.scss
@@ -154,6 +154,7 @@ $tb-warn: mat.get-color-from-palette(map-get($tb-theme, warn), text);
padding: 8px;
border: 2px dashed rgba(0, 0, 0, 0.08);
border-radius: 10px;
+ min-height: 56px;
}
}
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 0f1d66bc00..c879b755b3 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
@@ -76,7 +76,7 @@ export interface DashboardLayoutSettings {
export class ManageDashboardLayoutsDialogComponent extends DialogComponent
implements ErrorStateMatcher, OnDestroy {
- @ViewChild('tooltip', {static: true}) tooltip: MatTooltip;
+ @ViewChild('tooltip') tooltip: MatTooltip;
layoutsFormGroup: UntypedFormGroup;
addBreakpointFormGroup: UntypedFormGroup;
@@ -110,8 +110,8 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent,
protected router: Router,
@@ -122,7 +122,7 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent !this.selectedLayoutBreakpoints.includes(item));
+ this.allowBreakpointIds = Object.keys(this.layoutBreakpoint)
+ .filter((item) => !this.selectedBreakpointIds.includes(item));
this.dataSource.loadData(this.layoutBreakpoints);
@@ -270,6 +259,15 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent {
+ this.dataSource = new DashboardLayoutDatasource();
+ this.dataSource.loadData(this.layoutBreakpoints);
+ }
+ ));
}
ngOnDestroy(): void {
@@ -450,12 +448,14 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent item.breakpoint !== breakpoint);
+ this.layoutBreakpoints = this.layoutBreakpoints.filter((item) => item.breakpoint !== breakpointId);
+ this.allowBreakpointIds.push(breakpointId);
+ this.selectedBreakpointIds = this.selectedBreakpointIds.filter((item) => item !== breakpointId);
this.dataSource.loadData(this.layoutBreakpoints);
this.layoutsFormGroup.markAsDirty();
}
@@ -464,7 +464,7 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent item !== newBreakpoint);
+ this.selectedBreakpointIds.push(newBreakpoint);
+ this.allowBreakpointIds = this.allowBreakpointIds.filter((item) => item !== newBreakpoint);
+ this.addLayoutConfiguration(newBreakpoint);
+ this.dataSource.loadData(this.layoutBreakpoints);
+
+ this.addBreakpointMode = false;
+ }
+
+ private addLayoutConfiguration(breakpointId: string) {
+ const layout = breakpointId === 'default' ? this.layouts.main : this.layouts.main.breakpoints[breakpointId];
+ const size = breakpointId === 'default' ? '' : this.parseCssQuery(MediaBreakpoints[breakpointId]);
this.layoutBreakpoints.push({
icon: 'mdi:monitor',
- name: newBreakpoint,
- layout: this.layouts.main.breakpoints[newBreakpoint],
- descriptionSize: MediaBreakpoints[newBreakpoint],
- breakpoint: newBreakpoint
+ name: breakpointId,
+ layout,
+ descriptionSize: size,
+ breakpoint: breakpointId
});
+ }
- this.dataSource.loadData(this.layoutBreakpoints);
-
- this.addBreakpointMode = false;
+ private parseCssQuery(query: string): string {
+ const value = Array.from(query.matchAll(/\([^:]+:\s+([^()]+)\)/g));
+ return `min-width: ${value[0][1]} and max-width: ${value[1][1]}`;
}
}