From 6116052afc44215342e923660e67f28d277f05d4 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 11 Oct 2023 18:34:58 +0200 Subject: [PATCH 01/39] fixed device active/inactive widgets in home-page --- ui-ngx/src/assets/dashboard/tenant_admin_home_page.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/assets/dashboard/tenant_admin_home_page.json b/ui-ngx/src/assets/dashboard/tenant_admin_home_page.json index a2edebb7c4..37e8d82e45 100644 --- a/ui-ngx/src/assets/dashboard/tenant_admin_home_page.json +++ b/ui-ngx/src/assets/dashboard/tenant_admin_home_page.json @@ -943,7 +943,7 @@ "keyFilters": [ { "key": { - "type": "ATTRIBUTE", + "type": "SERVER_ATTRIBUTE", "key": "active" }, "valueType": "BOOLEAN", @@ -975,7 +975,7 @@ "keyFilters": [ { "key": { - "type": "ATTRIBUTE", + "type": "SERVER_ATTRIBUTE", "key": "active" }, "valueType": "BOOLEAN", @@ -1051,4 +1051,4 @@ }, "externalId": null, "name": "Tenant Administrator Home Page" -} \ No newline at end of file +} From f0bb74cf5b8201e6229a1174848047dddb0385dd Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 11 Oct 2023 19:02:56 +0200 Subject: [PATCH 02/39] fixed home page for customer --- ui-ngx/src/assets/dashboard/customer_user_home_page.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/assets/dashboard/customer_user_home_page.json b/ui-ngx/src/assets/dashboard/customer_user_home_page.json index 7c79162d5b..aef3367ff3 100644 --- a/ui-ngx/src/assets/dashboard/customer_user_home_page.json +++ b/ui-ngx/src/assets/dashboard/customer_user_home_page.json @@ -461,7 +461,7 @@ "keyFilters": [ { "key": { - "type": "ATTRIBUTE", + "type": "SERVER_ATTRIBUTE", "key": "active" }, "valueType": "BOOLEAN", @@ -493,7 +493,7 @@ "keyFilters": [ { "key": { - "type": "ATTRIBUTE", + "type": "SERVER_ATTRIBUTE", "key": "active" }, "valueType": "BOOLEAN", @@ -569,4 +569,4 @@ }, "externalId": null, "name": "Customer User Home Page" -} \ No newline at end of file +} From fed3ec95ec85952b6eafb9007f07a4365a0d1af7 Mon Sep 17 00:00:00 2001 From: rusikv Date: Fri, 27 Oct 2023 11:21:36 +0300 Subject: [PATCH 03/39] UI: fix for timeseries charts validation blocks widget adding --- .../widget/config/basic/chart/flot-basic-config.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/flot-basic-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/flot-basic-config.component.ts index 2b2618e25f..745bb262d5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/flot-basic-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/flot-basic-config.component.ts @@ -82,6 +82,8 @@ export class FlotBasicConfigComponent extends BasicWidgetConfigComponent { legendConfig: [configData.config.settings?.legendConfig, []], actions: [configData.config.actions || {}, []] }); + this.flotWidgetConfigForm.get('series').valueChanges + .subscribe(() => this.flotWidgetConfigForm.get('datasources').updateValueAndValidity()); } protected prepareOutputConfig(config: any): WidgetConfigComponentData { From 95f37ee61bfc3a094033c87e20e14ce45f6e54b6 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 27 Oct 2023 11:30:07 +0300 Subject: [PATCH 04/39] UI: Fixed alarm type list width and empty option --- .../home/components/alarm/alarm-filter-config.component.scss | 3 +++ .../shared/components/entity/entity-subtype-list.component.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss index 9b0c323a40..16a2f43006 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.scss @@ -40,6 +40,9 @@ tb-entity-subtype-list { flex: 1; width: 180px; + .mdc-evolution-chip-set__chips { + width: 100%; + } } .mat-mdc-chip { diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index cb7cc7b63d..b2ea6a185d 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -298,7 +298,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, } else { result = subTypes.filter(subType => searchText ? subType.toUpperCase().startsWith(searchText.toUpperCase()) : true); } - if (!result.length) { + if (!result.length && searchText.length) { result = [searchText]; } return result; From 2677eff78e1c9c20ce05647a235d48731e37135c Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 27 Oct 2023 17:06:52 +0300 Subject: [PATCH 05/39] UI: Fixed width for alarm rule in dialog --- .../components/profile/add-device-profile-dialog.component.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss b/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss index ca54ae2053..c2cc55fb83 100644 --- a/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss @@ -45,6 +45,7 @@ overflow: hidden; .mat-horizontal-stepper-wrapper { + max-width: 100%; flex: 1 1 100%; } From 6adbc1ad1e6f04649608c02ce1365474ca51e1c3 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 30 Oct 2023 11:33:32 +0200 Subject: [PATCH 06/39] UI: Fixed panel for long list --- .../components/widget/lib/display-columns-panel.component.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss index b1abff0335..f3b531f32e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss @@ -16,8 +16,9 @@ :host { width: 100%; height: 100%; + max-height: 80vh; min-width: 300px; - overflow: hidden; + overflow: auto; background: #fff; border-radius: 4px; box-shadow: From b206061e602f8cbb699bb4835588bf4604350112 Mon Sep 17 00:00:00 2001 From: Dmitriymush Date: Tue, 31 Oct 2023 13:35:56 +0200 Subject: [PATCH 07/39] UI: bug-fix to tables basic settings columns error appearence --- .../basic/alarm/alarms-table-basic-config.component.html | 1 + ui-ngx/src/app/shared/components/tb-error.component.ts | 6 +++++- ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html index 860072fbbd..c2e8de37c4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/alarm/alarms-table-basic-config.component.html @@ -40,6 +40,7 @@ keySettingsTitle="{{ 'widgets.table.column-settings' | translate }}" removeKeyTitle="{{ 'widgets.table.remove-column' | translate }}" noKeysText="{{ 'widgets.table.no-columns' | translate }}" + requiredKeysText="{{ 'widgets.table.alarm-column-error' | translate }}" hideDataKeyColor hideUnits hideDecimals diff --git a/ui-ngx/src/app/shared/components/tb-error.component.ts b/ui-ngx/src/app/shared/components/tb-error.component.ts index 5ddd2d7896..3cd842ee6a 100644 --- a/ui-ngx/src/app/shared/components/tb-error.component.ts +++ b/ui-ngx/src/app/shared/components/tb-error.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, Input } from '@angular/core'; +import { ChangeDetectorRef, Component, Input } from '@angular/core'; import { animate, state, style, transition, trigger } from '@angular/animations'; import { coerceBoolean } from '@shared/decorators/coercion'; @@ -61,12 +61,16 @@ export class TbErrorComponent { if (value && !this.message) { this.message = value; this.state = 'hide'; + setTimeout(() => { this.state = 'show'; + this.cd.markForCheck(); }); } else { this.errorValue = value; this.state = value ? 'show' : 'hide'; } } + + constructor(private cd: ChangeDetectorRef) {} } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index f5c09ce75f..efb94c7782 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -6193,6 +6193,7 @@ "pagination": "Pagination", "rows": "Rows", "timeseries-column-error": "At least one timeseries column should be specified", + "alarm-column-error": "At least one alarm column should be specified", "table-tabs": "Table tabs", "show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode" }, From 900bb9a57ca4ea284f5fe7eb8099cf22ef3d0f6f Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 1 Nov 2023 12:28:24 +0200 Subject: [PATCH 08/39] UI: Refactoring entity subtype list --- .../components/entity/entity-subtype-list.component.html | 8 ++------ .../components/entity/entity-subtype-list.component.ts | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html index 44c61d605a..fa2d716530 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html @@ -24,7 +24,7 @@ *ngFor="let entitySubtype of entitySubtypeList" [removable]="!disabled" (removed)="remove(entitySubtype)"> - {{entitySubtype}} + {{customTranslate(entitySubtype)}} close - - - {{ translate.get(noSubtypesMathingText, {entitySubtype: searchText}) | async }} - -
diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index b2ea6a185d..6661d257b4 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -33,6 +33,7 @@ import { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angula import { coerceArray, coerceBoolean } from '@shared/decorators/coercion'; import { PageLink } from '@shared/models/page/page-link'; import { PageData } from '@shared/models/page/page-data'; +import { UtilsService } from '@core/services/utils.service'; @Component({ selector: 'tb-entity-subtype-list', @@ -129,6 +130,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, private edgeService: EdgeService, private entityViewService: EntityViewService, private alarmService: AlarmService, + private utils: UtilsService, private fb: FormBuilder) { this.entitySubtypeListFormGroup = this.fb.group({ entitySubtypeList: [this.entitySubtypeList, this.required ? [Validators.required] : []], @@ -372,4 +374,8 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, }, 0); } + customTranslate(entity: string) { + return this.utils.customTranslation(entity, entity); + } + } From 883c51f334cc67197e666abc927044ef70286a1b Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 1 Nov 2023 13:14:19 +0200 Subject: [PATCH 09/39] UI: Refactoring --- .../profile/add-device-profile-dialog.component.scss | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss b/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss index c2cc55fb83..0018264075 100644 --- a/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.scss @@ -40,13 +40,10 @@ padding: 0 !important; .mat-stepper-horizontal { - display: flex; - height: 100%; overflow: hidden; .mat-horizontal-stepper-wrapper { - max-width: 100%; - flex: 1 1 100%; + max-height: 100%; } .mat-horizontal-content-container { From 8f9ac73ee34565806fc4f45e60ab79e167e8fd03 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 1 Nov 2023 15:55:08 +0200 Subject: [PATCH 10/39] UI: Refactoring display columns for tables --- .../alarm/alarms-table-widget.component.ts | 32 ++++++++----- .../lib/display-columns-panel.component.scss | 1 - .../entity/entities-table-widget.component.ts | 47 +++++++++++-------- .../lib/timeseries-table-widget.component.ts | 39 +++++++++------ ui-ngx/src/styles.scss | 2 +- 5 files changed, 73 insertions(+), 48 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts index 034c131769..7fbd741fe1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts @@ -503,17 +503,16 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, $event.stopPropagation(); } const target = $event.target || $event.srcElement || $event.currentTarget; - const config = new OverlayConfig(); - config.backdropClass = 'cdk-overlay-transparent-backdrop'; - config.hasBackdrop = true; - const connectedPosition: ConnectedPosition = { - originX: 'end', - originY: 'bottom', - overlayX: 'end', - overlayY: 'top' - }; - config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement) - .withPositions([connectedPosition]); + const config = new OverlayConfig({ + panelClass: 'tb-display-columns', + backdropClass: 'cdk-overlay-transparent-backdrop', + hasBackdrop: true, + height: 'fit-content', + maxHeight: '75vh' + }); + config.positionStrategy = this.overlay.position() + .flexibleConnectedTo(target as HTMLElement) + .withPositions(DEFAULT_OVERLAY_POSITIONS); const overlayRef = this.overlay.create(config); overlayRef.backdropClick().subscribe(() => { @@ -549,9 +548,18 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, useValue: overlayRef } ]; + const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); - overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, + const componentRef = overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, this.viewContainerRef, injector)); + + const resizeWindows$ = fromEvent(window, 'resize').subscribe(() => { + overlayRef.updatePosition(); + }); + componentRef.onDestroy(() => { + resizeWindows$.unsubscribe(); + }); + this.ctx.detectChanges(); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss index f3b531f32e..7017c61de0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/display-columns-panel.component.scss @@ -16,7 +16,6 @@ :host { width: 100%; height: 100%; - max-height: 80vh; min-width: 300px; overflow: auto; background: #fff; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts index df71fce4f8..f7e5025a26 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts @@ -46,7 +46,7 @@ import { deepClone, hashCode, isDefined, isNumber, isObject, isUndefined } from import cssjs from '@core/css/css'; import { CollectionViewer, DataSource } from '@angular/cdk/collections'; import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; -import { BehaviorSubject, merge, Observable, Subject } from 'rxjs'; +import { BehaviorSubject, fromEvent, merge, Observable, Subject } from 'rxjs'; import { emptyPageData, PageData } from '@shared/models/page/page-data'; import { EntityId } from '@shared/models/id/entity-id'; import { entityTypeTranslations } from '@shared/models/entity-type.models'; @@ -106,6 +106,7 @@ import { ResizeObserver } from '@juggle/resize-observer'; import { hidePageSizePixelValue } from '@shared/models/constants'; import { AggregationType } from '@shared/models/time/time.models'; import { FormBuilder } from '@angular/forms'; +import { DEFAULT_OVERLAY_POSITIONS } from '@shared/models/overlay.models'; interface EntitiesTableWidgetSettings extends TableWidgetSettings { entitiesTitle: string; @@ -462,18 +463,17 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.currentTarget; - const config = new OverlayConfig(); - config.backdropClass = 'cdk-overlay-transparent-backdrop'; - config.hasBackdrop = true; - const connectedPosition: ConnectedPosition = { - originX: 'end', - originY: 'bottom', - overlayX: 'end', - overlayY: 'top' - }; - config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement) - .withPositions([connectedPosition]); + const target = $event.target || $event.srcElement || $event.currentTarget; + const config = new OverlayConfig({ + panelClass: 'tb-display-columns', + backdropClass: 'cdk-overlay-transparent-backdrop', + hasBackdrop: true, + height: 'fit-content', + maxHeight: '75vh' + }); + config.positionStrategy = this.overlay.position() + .flexibleConnectedTo(target as HTMLElement) + .withPositions(DEFAULT_OVERLAY_POSITIONS); const overlayRef = this.overlay.create(config); overlayRef.backdropClick().subscribe(() => { @@ -481,11 +481,11 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni }); const columns: DisplayColumn[] = this.columns.map(column => ({ - title: column.title, - def: column.def, - display: this.displayedColumns.indexOf(column.def) > -1, - selectable: this.columnSelectionAvailability[column.def] - })); + title: column.title, + def: column.def, + display: this.displayedColumns.indexOf(column.def) > -1, + selectable: this.columnSelectionAvailability[column.def] + })); const providers: StaticProvider[] = [ { @@ -506,9 +506,18 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni useValue: overlayRef } ]; + const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); - overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, + const componentRef = overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, this.viewContainerRef, injector)); + + const resizeWindows$ = fromEvent(window, 'resize').subscribe(() => { + overlayRef.updatePosition(); + }); + componentRef.onDestroy(() => { + resizeWindows$.unsubscribe(); + }); + this.ctx.detectChanges(); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 20dff4d85a..5e9dabbeb2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -56,7 +56,7 @@ import cssjs from '@core/css/css'; import { PageLink } from '@shared/models/page/page-link'; import { Direction, SortOrder, sortOrderFromString } from '@shared/models/page/sort-order'; import { CollectionViewer, DataSource } from '@angular/cdk/collections'; -import { BehaviorSubject, merge, Observable, of, Subject, Subscription } from 'rxjs'; +import { BehaviorSubject, fromEvent, merge, Observable, of, Subject, Subscription } from 'rxjs'; import { emptyPageData, PageData } from '@shared/models/page/page-data'; import { catchError, debounceTime, distinctUntilChanged, map, skip, startWith, takeUntil } from 'rxjs/operators'; import { MatPaginator } from '@angular/material/paginator'; @@ -81,7 +81,7 @@ import { TableWidgetDataKeySettings, TableWidgetSettings } from '@home/components/widget/lib/table-widget.models'; -import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; +import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { SubscriptionEntityInfo } from '@core/api/widget-api.models'; import { DatePipe } from '@angular/common'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; @@ -93,6 +93,7 @@ import { } from '@home/components/widget/lib/display-columns-panel.component'; import { ComponentPortal } from '@angular/cdk/portal'; import { FormBuilder } from '@angular/forms'; +import { DEFAULT_OVERLAY_POSITIONS } from '@shared/models/overlay.models'; export interface TimeseriesTableWidgetSettings extends TableWidgetSettings { showTimestamp: boolean; @@ -411,23 +412,23 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI $event.stopPropagation(); } if (this.sources.length) { - const target = $event.target || $event.currentTarget; - const config = new OverlayConfig(); - config.backdropClass = 'cdk-overlay-transparent-backdrop'; - config.hasBackdrop = true; - const connectedPosition: ConnectedPosition = { - originX: 'end', - originY: 'bottom', - overlayX: 'end', - overlayY: 'top' - }; - config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement) - .withPositions([connectedPosition]); + const target = $event.target || $event.srcElement || $event.currentTarget; + const config = new OverlayConfig({ + panelClass: 'tb-display-columns', + backdropClass: 'cdk-overlay-transparent-backdrop', + hasBackdrop: true, + height: 'fit-content', + maxHeight: '75vh' + }); + config.positionStrategy = this.overlay.position() + .flexibleConnectedTo(target as HTMLElement) + .withPositions(DEFAULT_OVERLAY_POSITIONS); const overlayRef = this.overlay.create(config); overlayRef.backdropClick().subscribe(() => { overlayRef.dispose(); }); + const source = this.sources[this.sourceIndex]; this.prepareDisplayedColumn(); @@ -450,8 +451,16 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI ]; const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); - overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, + const componentRef = overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, this.viewContainerRef, injector)); + + const resizeWindows$ = fromEvent(window, 'resize').subscribe(() => { + overlayRef.updatePosition(); + }); + componentRef.onDestroy(() => { + resizeWindows$.unsubscribe(); + }); + this.ctx.detectChanges(); } } diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index 0ee154cf7d..716af758f2 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -268,7 +268,7 @@ pre.tb-highlight { letter-spacing: normal; } -.tb-timewindow-panel, .tb-legend-config-panel, .tb-filter-panel { +.tb-timewindow-panel, .tb-legend-config-panel, .tb-filter-panel, .tb-display-columns { overflow: hidden; background: #fff; border-radius: 4px; From 3407c210b5af83fa13a3a85e6aa9cf3c42ff4c2d Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 1 Nov 2023 17:28:33 +0200 Subject: [PATCH 11/39] testFindTenantWidgetsBundlesByPageLink - cleanup system widgets --- .../server/controller/WidgetsBundleControllerTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java index 80d70c1b8b..82dfa82d5a 100644 --- a/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java @@ -268,6 +268,13 @@ public class WidgetsBundleControllerTest extends AbstractControllerTest { Collections.sort(loadedWidgetsBundles2, idComparator); Assert.assertEquals(tenantWidgetsBundles, loadedWidgetsBundles2); + + // cleanup + loginSysAdmin(); + for (WidgetsBundle sysWidgetsBundle : sysWidgetsBundles) { + doDelete("/api/widgetsBundle/" + sysWidgetsBundle.getId().getId().toString()) + .andExpect(status().isOk()); + } } @Test From 7ab9051a52dabd92ffe75b40432c8a941a9c2094 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 2 Nov 2023 13:03:21 +0200 Subject: [PATCH 12/39] UI: Change panel class name --- .../widget/lib/alarm/alarms-table-widget.component.ts | 2 +- .../widget/lib/entity/entities-table-widget.component.ts | 4 ++-- .../widget/lib/timeseries-table-widget.component.ts | 2 +- ui-ngx/src/styles.scss | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts index 7fbd741fe1..b6129b74a7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts @@ -504,7 +504,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, } const target = $event.target || $event.srcElement || $event.currentTarget; const config = new OverlayConfig({ - panelClass: 'tb-display-columns', + panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', hasBackdrop: true, height: 'fit-content', diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts index f7e5025a26..b7d1841431 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts @@ -83,7 +83,7 @@ import { TableWidgetSettings, widthStyle } from '@home/components/widget/lib/table-widget.models'; -import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; +import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; import { DISPLAY_COLUMNS_PANEL_DATA, @@ -465,7 +465,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni } const target = $event.target || $event.srcElement || $event.currentTarget; const config = new OverlayConfig({ - panelClass: 'tb-display-columns', + panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', hasBackdrop: true, height: 'fit-content', diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 5e9dabbeb2..2b7d538a4d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -414,7 +414,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI if (this.sources.length) { const target = $event.target || $event.srcElement || $event.currentTarget; const config = new OverlayConfig({ - panelClass: 'tb-display-columns', + panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', hasBackdrop: true, height: 'fit-content', diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index 716af758f2..2f068fd9ca 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -268,7 +268,7 @@ pre.tb-highlight { letter-spacing: normal; } -.tb-timewindow-panel, .tb-legend-config-panel, .tb-filter-panel, .tb-display-columns { +.tb-timewindow-panel, .tb-legend-config-panel, .tb-filter-panel, .tb-panel-container { overflow: hidden; background: #fff; border-radius: 4px; From cdaedc8b51785c5a2d66b047045e6dbadffc6bed Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 2 Nov 2023 16:52:51 +0200 Subject: [PATCH 13/39] UI: Refactoring event filter panel --- .../event/event-filter-panel.component.html | 86 ++++++++++--------- .../event/event-filter-panel.component.scss | 19 ++-- .../components/event/event-table-config.ts | 30 ++++--- 3 files changed, 65 insertions(+), 70 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/event/event-filter-panel.component.html b/ui-ngx/src/app/modules/home/components/event/event-filter-panel.component.html index adfe411670..77e5dafca8 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-filter-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/event/event-filter-panel.component.html @@ -15,50 +15,52 @@ limitations under the License. --> -
- - - - - {{ column.title | translate}} - - {{ 'event.all-events' | translate}} - - {{ value }} - - - - - - - {{ column.title | translate}} - - - {{ 'event.min-value' | translate }} - - - - - - {{ 'event.has-error' | translate }} - - - - - {{ column.title | translate}} - - - - - - {{ column.title | translate}} - - + +
+ + + + + {{ column.title | translate}} + + {{ 'event.all-events' | translate}} + + {{ value }} + + + + + + + {{ column.title | translate}} + + + {{ 'event.min-value' | translate }} + + + + + + {{ 'event.has-error' | translate }} + + + + + {{ column.title | translate}} + + + + + + {{ column.title | translate}} + + + - -
+
+