From f81955653506c6371a65b3a1dd69fd749e81ed6d Mon Sep 17 00:00:00 2001 From: Serhii Titenko Date: Mon, 16 Nov 2026 11:38:49 +0200 Subject: [PATCH 01/16] Fixed the first converter created from an integration after a page load rejecting all uplinks (#16666) * Apply the converter version and defaults when the converters info loads after the converter is set * Applied converter defaults only after they are loaded --------- Co-authored-by: Vladyslav_Prykhodko --- .../converter/converter.component.ts | 114 ++++++++++++------ 1 file changed, 80 insertions(+), 34 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/converter/converter.component.ts b/ui-ngx/src/app/modules/home/components/converter/converter.component.ts index b22265fdb6..ef4ef7f2a6 100644 --- a/ui-ngx/src/app/modules/home/components/converter/converter.component.ts +++ b/ui-ngx/src/app/modules/home/components/converter/converter.component.ts @@ -47,8 +47,8 @@ import { } from '@shared/models/integration.models'; import { capitalize, deepClone, isDefinedAndNotNull, isEmptyStr, isNotEmptyStr } from '@core/utils'; import { NULL_UUID } from '@shared/models/id/has-uuid'; -import { catchError, filter, map, startWith } from 'rxjs/operators'; -import { combineLatest, defer, forkJoin, merge, Observable, of, shareReplay } from 'rxjs'; +import { catchError, filter, map, startWith, switchMap, tap } from 'rxjs/operators'; +import { combineLatest, defer, forkJoin, merge, Observable, of, shareReplay, Subscription } from 'rxjs'; import { ContentType } from '@shared/models/constants'; import { ConverterLibraryService } from '@core/http/converter-library.service'; import { EntityType } from '@shared/models/entity-type.models'; @@ -61,6 +61,12 @@ import { EventsDialogComponent, EventsDialogData } from '@home/dialogs/events-di import { Operation, Resource } from '@shared/models/security.models'; import { UserPermissionsService } from '@core/http/user-permissions.service'; +interface ConverterDefaults { + updateOnlyKeys: DefaultUpdateOnlyKeys; + converterV2Config: Record; + integrationsConvertersInfo: IntegrationsConvertersInfo; +} + @Component({ selector: 'tb-converter', templateUrl: './converter.component.html', @@ -149,6 +155,10 @@ export class ConverterComponent extends EntityComponent implements On private defaultUpdateOnlyKeysByIntegrationType: DefaultUpdateOnlyKeys = {}; private defaultConverterV2Configuration: Record = {} as Record; + // Emits once, when the data above is loaded; replays at once to later subscribers + private readonly defaults$: Observable; + private scriptTemplateSubscriptions: Record = {}; + constructor(protected store: Store, protected translate: TranslateService, private converterService: ConverterService, @@ -163,13 +173,21 @@ export class ConverterComponent extends EntityComponent implements On private destroyRef: DestroyRef, private userPermissionsService: UserPermissionsService) { super(store, fb, entityValue, entitiesTableConfigValue, cd); - forkJoin({ - updateOnlyKeys: this.resourcesService.loadJsonResource('/assets/converters/default-update-only-keys.json'), - converterV2Config: this.resourcesService.loadJsonResource>('/assets/converters/default-converters-v2-configuration.json'), + // A failed request falls back to the initial value of its field + this.defaults$ = forkJoin({ + updateOnlyKeys: this.resourcesService.loadJsonResource('/assets/converters/default-update-only-keys.json') + .pipe(catchError(() => of(this.defaultUpdateOnlyKeysByIntegrationType))), + converterV2Config: this.resourcesService.loadJsonResource>('/assets/converters/default-converters-v2-configuration.json') + .pipe(catchError(() => of(this.defaultConverterV2Configuration))), integrationsConvertersInfo: this.integrationService.getIntegrationsConvertersInfoCached() + .pipe(catchError(() => of(this.integrationsConvertersInfo))) }).pipe( + shareReplay(1) + ); + // Subscribed first, so the fields are set before any other subscriber of defaults$ runs + this.defaults$.pipe( takeUntilDestroyed() - ).subscribe((value) =>{ + ).subscribe((value) => { this.defaultUpdateOnlyKeysByIntegrationType = value.updateOnlyKeys; this.defaultConverterV2Configuration = value.converterV2Config; this.integrationsConvertersInfo = value.integrationsConvertersInfo; @@ -200,11 +218,11 @@ export class ConverterComponent extends EntityComponent implements On const typeControl = this.entityForm.get('integrationType'); // The type can be set before the template subscribes (e.g. preset from the integration form) this.integrationInfo$ = combineLatest([ - this.integrationService.getIntegrationsConvertersInfoCached(), + this.defaults$, defer(() => typeControl.valueChanges.pipe(startWith(typeControl.value))) ]).pipe( filter(([, type]) => !!type), - map(([info, type]) => info?.[type]), + map(([defaults, type]) => defaults.integrationsConvertersInfo?.[type]), shareReplay(1) ); } @@ -214,24 +232,12 @@ export class ConverterComponent extends EntityComponent implements On this.entityForm.get('type').valueChanges, this.entityForm.get('integrationType').valueChanges ).pipe( + tap(() => this.onTypesChanged()), + // The version, the scripts and the default configuration need the loaded defaults: + // at once when they are loaded, otherwise once, for the latest types, when they arrive + switchMap(() => this.defaults$), takeUntilDestroyed(this.destroyRef) - ).subscribe(() => { - this.resetToNewTab(); - let converterType: ConverterType = this.entityForm.get('type').value; - const integrationType: IntegrationType = this.entityForm.get('integrationType').value; - this.hideDownlink = integrationTypeInfoMap.get(integrationType)?.hideDownlink ?? false; - if (this.hideDownlink && converterType === ConverterType.DOWNLINK) { - converterType = ConverterType.UPLINK; - this.entityForm.get('type').setValue(converterType, {emitEvent: false}); - } - - this.updateConverterVersion(); - this.onConverterTypeChanged(converterType); - if (converterType === ConverterType.UPLINK) { - this.updateDefaultConfiguration(integrationType); - } - this.updatedConverterScriptLangDisableState(); - }); + ).subscribe(() => this.applyTypesDefaults()); this.entityForm.get('configuration.scriptLang').valueChanges.pipe( takeUntilDestroyed(this.destroyRef) ).subscribe(() => { @@ -245,6 +251,41 @@ export class ConverterComponent extends EntityComponent implements On this.checkIsNewConverter(this.entity, this.entityForm, true); } + private onTypesChanged(): void { + this.resetToNewTab(); + const integrationType: IntegrationType = this.entityForm.get('integrationType').value; + this.hideDownlink = integrationTypeInfoMap.get(integrationType)?.hideDownlink ?? false; + if (this.hideDownlink && this.entityForm.get('type').value === ConverterType.DOWNLINK) { + this.entityForm.get('type').setValue(ConverterType.UPLINK, {emitEvent: false}); + } + } + + private applyTypesDefaults(): void { + // A library converter selected while the defaults were loading keeps its version and scripts + if (this.entityForm.get('converterLibrary').value) { + return; + } + const converterType: ConverterType = this.entityForm.get('type').value; + const integrationType: IntegrationType = this.entityForm.get('integrationType').value; + this.updateConverterVersion(); + this.onConverterTypeChanged(converterType); + if (converterType === ConverterType.UPLINK) { + this.updateDefaultConfiguration(integrationType); + } + this.updatedConverterScriptLangDisableState(); + this.cd.markForCheck(); + } + + // Runs the action at once when the defaults are loaded, otherwise when they arrive + private whenDefaultsLoaded(action: () => void): void { + this.defaults$.pipe( + takeUntilDestroyed(this.destroyRef) + ).subscribe(() => { + action(); + this.cd.markForCheck(); + }); + } + private resetToNewTab() { this.prevLibraryConverterFormValue = null; this.prevNewConverterFormValue = null; @@ -384,12 +425,12 @@ export class ConverterComponent extends EntityComponent implements On form.get('configuration.scriptLang').patchValue( this.tbelEnabled ? ScriptLanguage.TBEL : ScriptLanguage.JS, {emitEvent}); if (!emitEvent) { - this.updateConverterVersion(); + this.whenDefaultsLoaded(() => this.updateConverterVersion()); } else { form.get('integrationType').updateValueAndValidity({onlySelf: true}); } } else { - this.updatedPredefinedConverterKeys(); + this.whenDefaultsLoaded(() => this.updatedPredefinedConverterKeys()); this.updatedConverterVersionDisableState(); this.updatedConverterScriptLangDisableState(entity); form.updateValueAndValidity(); @@ -403,10 +444,10 @@ export class ConverterComponent extends EntityComponent implements On form.get('configuration.scriptLang').patchValue(scriptLang, {emitEvent: true}); } if (isDefinedAndNotNull(entity?.converterVersion)) { - this.updatedPredefinedConverterKeys(); + this.whenDefaultsLoaded(() => this.updatedPredefinedConverterKeys()); this.updatedConverterVersionDisableState(); } else { - this.updateConverterVersion(); + this.whenDefaultsLoaded(() => this.updateConverterVersion()); } } } @@ -489,8 +530,9 @@ export class ConverterComponent extends EntityComponent implements On const converterType: ConverterType = this.entityForm.get('type').value; const integrationType: IntegrationType = this.entityForm.get('integrationType').value; const converterInfo: ConverterInfo = this.integrationsConvertersInfo?.[integrationType]?.[converterType.toLocaleLowerCase()]; - this.predefinedConverterKeys = converterInfo.keys.map(value => ({name: value, value})); - this.predefinedKeys = deepClone(converterInfo.keys); + const keys = converterInfo?.keys ?? []; + this.predefinedConverterKeys = keys.map(value => ({name: value, value})); + this.predefinedKeys = deepClone(keys); } else { this.predefinedConverterKeys = null; this.predefinedKeys = []; @@ -515,11 +557,15 @@ export class ConverterComponent extends EntityComponent implements On if (!isNotEmptyStr(scriptBody)) { const targetTemplateUrl = getTargetTemplateUrl(converterType, scriptLang, integrationType, converterVersion); - this.resourcesService.loadJsonResource(targetTemplateUrl) + this.scriptTemplateSubscriptions[targetField]?.unsubscribe(); + this.scriptTemplateSubscriptions[targetField] = this.resourcesService.loadJsonResource(targetTemplateUrl) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(template => { - this.entityForm.get('configuration').get(targetField) - .patchValue(template, { emitEvent: false }); + const scriptControl = this.entityForm.get('configuration').get(targetField); + // A template that arrives late does not replace a script set in the meantime + if (!isNotEmptyStr(scriptControl.value)) { + scriptControl.patchValue(template, {emitEvent: false}); + } }); } } From 19383a7e84ad68382d1dafb84b05f7c03d47ff20 Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 16 Nov 2026 11:41:18 +0200 Subject: [PATCH 02/16] Fixed the integration wizard getting stuck on the Downlink step after switching to a type without downlink and back (#16692) * Fixed the integration wizard ignoring the downlink converter after switching through a type without downlink * Re-attached the downlink converter form only when the step is re-created --- .../integration-wizard-dialog.component.ts | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/wizard/integration-wizard-dialog.component.ts b/ui-ngx/src/app/modules/home/components/wizard/integration-wizard-dialog.component.ts index d1fb7e666a..fc73da1626 100644 --- a/ui-ngx/src/app/modules/home/components/wizard/integration-wizard-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/wizard/integration-wizard-dialog.component.ts @@ -49,7 +49,25 @@ export class IntegrationWizardDialogComponent extends @ViewChild('addIntegrationWizardStepper', {static: true}) addIntegrationWizardStepper: MatStepper; @ViewChild('uplinkDataConverter', {static: true}) uplinkDataConverterComponent: ConverterComponent; - @ViewChild('downlinkDataConverter') downlinkDataConverterComponent: ConverterComponent; + + private _downlinkDataConverterComponent: ConverterComponent; + + // The downlink step is re-created when the integration type changes, so its form is re-attached here + @ViewChild('downlinkDataConverter') + set downlinkDataConverterComponent(component: ConverterComponent) { + if (component === this._downlinkDataConverterComponent) { + return; + } + this._downlinkDataConverterComponent = component; + if (component) { + this.downlinkConverterForm.setControl('newDownlinkConverter', component.entityForm, {emitEvent: false}); + this.downlinkConverterForm.get('newDownlinkConverter').disable({emitEvent: false}); + } + } + + get downlinkDataConverterComponent(): ConverterComponent { + return this._downlinkDataConverterComponent; + } selectedIndex = 0; converterType = ConverterType; @@ -216,8 +234,6 @@ export class IntegrationWizardDialogComponent extends ngAfterViewInit() { setTimeout(() => { this.uplinkConverterForm.setControl('newUplinkConverter', this.uplinkDataConverterComponent.entityForm, {emitEvent: false}); - this.downlinkConverterForm.setControl('newDownlinkConverter', this.downlinkDataConverterComponent.entityForm, {emitEvent: false}); - this.downlinkConverterForm.get('newDownlinkConverter').disable({emitEvent: false}); }, 0); } From 4f0cd3e1eae823ab85c464a28e95704f418911c1 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 16 Nov 2026 10:52:19 +0100 Subject: [PATCH 03/16] Remove horizontal padding from group permissions table on self-registration page (#16693) --- .../components/role/registration-permissions.component.html | 2 +- .../app/shared/components/role/group-permissions.component.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/role/registration-permissions.component.html b/ui-ngx/src/app/modules/home/components/role/registration-permissions.component.html index 7e67523e0a..3d496b9bfe 100644 --- a/ui-ngx/src/app/modules/home/components/role/registration-permissions.component.html +++ b/ui-ngx/src/app/modules/home/components/role/registration-permissions.component.html @@ -5,7 +5,7 @@ --> -
+
From ee7bf3af0e5dd61ef6d7b9269bedb0461dfaac7c Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 16 Nov 2026 11:01:28 +0100 Subject: [PATCH 04/16] Fixed KPN downlink credentials not marked as required (#16691) * Fixed KPN downlink credentials not marked as required * Marked Azure Service Bus downlink and OPC-UA keystore fields as required --------- Co-authored-by: Vladyslav_Prykhodko --- .../azure-services-bus-integration-form.component.html | 6 ++++-- .../kpn-integration-form.component.html | 8 ++++++-- .../opc-ua-integration-form.component.html | 1 + ui-ngx/src/assets/locale/locale.constant-ar_AE.json | 2 +- ui-ngx/src/assets/locale/locale.constant-ca_ES.json | 2 +- ui-ngx/src/assets/locale/locale.constant-da_DK.json | 2 +- ui-ngx/src/assets/locale/locale.constant-de_DE.json | 2 +- ui-ngx/src/assets/locale/locale.constant-el_GR.json | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 3 ++- ui-ngx/src/assets/locale/locale.constant-es_ES.json | 2 +- ui-ngx/src/assets/locale/locale.constant-fr_FR.json | 2 +- ui-ngx/src/assets/locale/locale.constant-hi_IN.json | 2 +- ui-ngx/src/assets/locale/locale.constant-it_IT.json | 2 +- ui-ngx/src/assets/locale/locale.constant-ja_JP.json | 2 +- ui-ngx/src/assets/locale/locale.constant-ka_GE.json | 2 +- ui-ngx/src/assets/locale/locale.constant-ko_KR.json | 2 +- ui-ngx/src/assets/locale/locale.constant-lt_LT.json | 2 +- ui-ngx/src/assets/locale/locale.constant-lv_LV.json | 2 +- ui-ngx/src/assets/locale/locale.constant-nl_BE.json | 2 +- ui-ngx/src/assets/locale/locale.constant-nl_NL.json | 2 +- ui-ngx/src/assets/locale/locale.constant-no_NO.json | 2 +- ui-ngx/src/assets/locale/locale.constant-pl_PL.json | 2 +- ui-ngx/src/assets/locale/locale.constant-pt_BR.json | 2 +- ui-ngx/src/assets/locale/locale.constant-sl_SI.json | 2 +- ui-ngx/src/assets/locale/locale.constant-tr_TR.json | 2 +- ui-ngx/src/assets/locale/locale.constant-uk_UA.json | 2 +- ui-ngx/src/assets/locale/locale.constant-zh_CN.json | 2 +- ui-ngx/src/assets/locale/locale.constant-zh_TW.json | 2 +- 28 files changed, 37 insertions(+), 29 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/azure-services-bus-integration-form/azure-services-bus-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/azure-services-bus-integration-form/azure-services-bus-integration-form.component.html index 251aee6eb6..6e3cde027c 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/azure-services-bus-integration-form/azure-services-bus-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/azure-services-bus-integration-form/azure-services-bus-integration-form.component.html @@ -42,11 +42,13 @@ + [required]="isSetDownLink" + label="{{ 'integration.downlink-connection-string' | translate }}" + requiredText="{{ 'integration.downlink-connection-string-required' | translate }}"> integration.downlink-topic-name - + @if (azureServicesBusIntegrationConfigForm.get('downlinkTopicName').hasError('required')) { integration.downlink-topic-name-required diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html index 9e6f8b8b48..ffe43c2556 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html @@ -78,10 +78,14 @@ integration.downlink-credentials
+ required + label="{{ 'integration.api-id' | translate }}" + requiredText="{{ 'integration.api-id-required' | translate }}"> + required + label="{{ 'integration.api-key' | translate }}" + requiredText="{{ 'integration.api-key-required' | translate }}">
diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/opc-ua-integration-form/opc-ua-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/opc-ua-integration-form/opc-ua-integration-form.component.html index 5ac1d9fab7..39848a8a87 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/opc-ua-integration-form/opc-ua-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/opc-ua-integration-form/opc-ua-integration-form.component.html @@ -78,6 +78,7 @@ diff --git a/ui-ngx/src/assets/locale/locale.constant-ar_AE.json b/ui-ngx/src/assets/locale/locale.constant-ar_AE.json index f0bf9f377b..5bfc4afc48 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ar_AE.json +++ b/ui-ngx/src/assets/locale/locale.constant-ar_AE.json @@ -5781,7 +5781,7 @@ "opc-ua-type": "النوع", "opc-ua-keystore-type": "النوع", "opc-ua-keystore-type-required": "النوع مطلوب", - "opc-ua-keystore-location": "الموقع *", + "opc-ua-keystore-location": "الموقع", "opc-ua-keystore-password": "كلمة المرور", "opc-ua-keystore-password-required": "كلمة المرور مطلوبة", "opc-ua-keystore-alias": "الاسم المستعار", diff --git a/ui-ngx/src/assets/locale/locale.constant-ca_ES.json b/ui-ngx/src/assets/locale/locale.constant-ca_ES.json index 261ddeb0aa..c0a5da79a5 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ca_ES.json +++ b/ui-ngx/src/assets/locale/locale.constant-ca_ES.json @@ -5776,7 +5776,7 @@ "opc-ua-type": "Tipus", "opc-ua-keystore-type": "Tipus", "opc-ua-keystore-type-required": "El tipus és obligatori", - "opc-ua-keystore-location": "Ubicació *", + "opc-ua-keystore-location": "Ubicació", "opc-ua-keystore-password": "Contrasenya", "opc-ua-keystore-password-required": "La contrasenya és obligatòria", "opc-ua-keystore-alias": "Àlies", diff --git a/ui-ngx/src/assets/locale/locale.constant-da_DK.json b/ui-ngx/src/assets/locale/locale.constant-da_DK.json index 96850db156..818260aba9 100644 --- a/ui-ngx/src/assets/locale/locale.constant-da_DK.json +++ b/ui-ngx/src/assets/locale/locale.constant-da_DK.json @@ -5745,7 +5745,7 @@ "opc-ua-type": "Type", "opc-ua-keystore-type": "Type", "opc-ua-keystore-type-required": "Type er påkrævet", - "opc-ua-keystore-location": "Placering *", + "opc-ua-keystore-location": "Placering", "opc-ua-keystore-password": "Adgangskode", "opc-ua-keystore-password-required": "Adgangskode er påkrævet", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-de_DE.json b/ui-ngx/src/assets/locale/locale.constant-de_DE.json index d23ff27ad7..79f234c029 100644 --- a/ui-ngx/src/assets/locale/locale.constant-de_DE.json +++ b/ui-ngx/src/assets/locale/locale.constant-de_DE.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Typ", "opc-ua-keystore-type": "Typ", "opc-ua-keystore-type-required": "Typ ist erforderlich", - "opc-ua-keystore-location": "Speicherort *", + "opc-ua-keystore-location": "Speicherort", "opc-ua-keystore-password": "Passwort", "opc-ua-keystore-password-required": "Passwort ist erforderlich", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-el_GR.json b/ui-ngx/src/assets/locale/locale.constant-el_GR.json index d660316e4f..a78399fefc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-el_GR.json +++ b/ui-ngx/src/assets/locale/locale.constant-el_GR.json @@ -5754,7 +5754,7 @@ "opc-ua-type": "Τύπος", "opc-ua-keystore-type": "Τύπος", "opc-ua-keystore-type-required": "Απαιτείται τύπος", - "opc-ua-keystore-location": "Τοποθεσία *", + "opc-ua-keystore-location": "Τοποθεσία", "opc-ua-keystore-password": "Κωδικός πρόσβασης", "opc-ua-keystore-password-required": "Απαιτείται κωδικός πρόσβασης", "opc-ua-keystore-alias": "Ψευδώνυμο", 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 15ca6ed759..94a28be63e 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5624,6 +5624,7 @@ "kpn-no-security-warning": "Requests to this endpoint are not authenticated. Add the security header generated in KPN Things.", "customer-id": "Customer id", "api-id": "API ID", + "api-id-required": "API ID is required.", "azure-ca-cert": "CA certificate file", "ca-cert": "CA certificate file", "private-key": "Private key file", @@ -5782,7 +5783,7 @@ "opc-ua-type": "Type", "opc-ua-keystore-type": "Type", "opc-ua-keystore-type-required": "Type is required", - "opc-ua-keystore-location": "Location *", + "opc-ua-keystore-location": "Location", "opc-ua-keystore-password": "Password", "opc-ua-keystore-password-required": "Password is required", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-es_ES.json b/ui-ngx/src/assets/locale/locale.constant-es_ES.json index 87d1dd9ca8..d9e4242226 100644 --- a/ui-ngx/src/assets/locale/locale.constant-es_ES.json +++ b/ui-ngx/src/assets/locale/locale.constant-es_ES.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Tipo", "opc-ua-keystore-type": "Tipo", "opc-ua-keystore-type-required": "Se requiere el tipo", - "opc-ua-keystore-location": "Ubicación *", + "opc-ua-keystore-location": "Ubicación", "opc-ua-keystore-password": "Contraseña", "opc-ua-keystore-password-required": "Se requiere la contraseña", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json index 398be9f91f..588e0a9223 100644 --- a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json +++ b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Type", "opc-ua-keystore-type": "Type", "opc-ua-keystore-type-required": "Le type est requis", - "opc-ua-keystore-location": "Emplacement *", + "opc-ua-keystore-location": "Emplacement", "opc-ua-keystore-password": "Mot de passe", "opc-ua-keystore-password-required": "Le mot de passe est requis", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-hi_IN.json b/ui-ngx/src/assets/locale/locale.constant-hi_IN.json index 54c7b7e751..0a5100aae8 100644 --- a/ui-ngx/src/assets/locale/locale.constant-hi_IN.json +++ b/ui-ngx/src/assets/locale/locale.constant-hi_IN.json @@ -5780,7 +5780,7 @@ "opc-ua-type": "प्रकार", "opc-ua-keystore-type": "प्रकार", "opc-ua-keystore-type-required": "प्रकार आवश्यक है", - "opc-ua-keystore-location": "स्थान *", + "opc-ua-keystore-location": "स्थान", "opc-ua-keystore-password": "पासवर्ड", "opc-ua-keystore-password-required": "पासवर्ड आवश्यक है", "opc-ua-keystore-alias": "उपनाम", diff --git a/ui-ngx/src/assets/locale/locale.constant-it_IT.json b/ui-ngx/src/assets/locale/locale.constant-it_IT.json index ef9e66844d..f90bdb507c 100644 --- a/ui-ngx/src/assets/locale/locale.constant-it_IT.json +++ b/ui-ngx/src/assets/locale/locale.constant-it_IT.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Tipo", "opc-ua-keystore-type": "Tipo", "opc-ua-keystore-type-required": "Il tipo è obbligatorio", - "opc-ua-keystore-location": "Posizione *", + "opc-ua-keystore-location": "Posizione", "opc-ua-keystore-password": "Password", "opc-ua-keystore-password-required": "La password è obbligatoria", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-ja_JP.json b/ui-ngx/src/assets/locale/locale.constant-ja_JP.json index 25d1a3c796..60a592b2db 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ja_JP.json +++ b/ui-ngx/src/assets/locale/locale.constant-ja_JP.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "タイプ", "opc-ua-keystore-type": "タイプ", "opc-ua-keystore-type-required": "タイプは必須です。", - "opc-ua-keystore-location": "場所 *", + "opc-ua-keystore-location": "場所", "opc-ua-keystore-password": "パスワード", "opc-ua-keystore-password-required": "パスワードは必須です。", "opc-ua-keystore-alias": "エイリアス", diff --git a/ui-ngx/src/assets/locale/locale.constant-ka_GE.json b/ui-ngx/src/assets/locale/locale.constant-ka_GE.json index 66b61e10bb..f5f661cd8e 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ka_GE.json +++ b/ui-ngx/src/assets/locale/locale.constant-ka_GE.json @@ -1743,7 +1743,7 @@ "opc-ua-type": "ტიპი", "opc-ua-keystore-type": "ტიპი", "opc-ua-keystore-type-required": "ტიპი სავალდებულოა", - "opc-ua-keystore-location": "ლოკაცია *", + "opc-ua-keystore-location": "ლოკაცია", "opc-ua-keystore-password": "პაროლი", "opc-ua-keystore-password-required": "პაროლი სავალდებულოა", "opc-ua-keystore-alias": "ზედმესახელი", diff --git a/ui-ngx/src/assets/locale/locale.constant-ko_KR.json b/ui-ngx/src/assets/locale/locale.constant-ko_KR.json index 500b524f76..8a36c6a18a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ko_KR.json +++ b/ui-ngx/src/assets/locale/locale.constant-ko_KR.json @@ -5772,7 +5772,7 @@ "opc-ua-type": "유형", "opc-ua-keystore-type": "유형", "opc-ua-keystore-type-required": "유형은 필수 항목입니다.", - "opc-ua-keystore-location": "위치 *", + "opc-ua-keystore-location": "위치", "opc-ua-keystore-password": "비밀번호", "opc-ua-keystore-password-required": "비밀번호는 필수 항목입니다.", "opc-ua-keystore-alias": "별명", diff --git a/ui-ngx/src/assets/locale/locale.constant-lt_LT.json b/ui-ngx/src/assets/locale/locale.constant-lt_LT.json index 903615936a..488d8e823a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-lt_LT.json +++ b/ui-ngx/src/assets/locale/locale.constant-lt_LT.json @@ -5780,7 +5780,7 @@ "opc-ua-type": "Tipas", "opc-ua-keystore-type": "Tipas", "opc-ua-keystore-type-required": "Tipas yra privalomas", - "opc-ua-keystore-location": "Vieta *", + "opc-ua-keystore-location": "Vieta", "opc-ua-keystore-password": "Slaptažodis", "opc-ua-keystore-password-required": "Slaptažodis yra privalomas", "opc-ua-keystore-alias": "Pseudonimas", diff --git a/ui-ngx/src/assets/locale/locale.constant-lv_LV.json b/ui-ngx/src/assets/locale/locale.constant-lv_LV.json index be19ddbe72..36b3e0c6b1 100644 --- a/ui-ngx/src/assets/locale/locale.constant-lv_LV.json +++ b/ui-ngx/src/assets/locale/locale.constant-lv_LV.json @@ -1648,7 +1648,7 @@ "opc-ua-type": "Tips", "opc-ua-keystore-type": "Tips", "opc-ua-keystore-type-required": "Tips ir nepieciešams", - "opc-ua-keystore-location": "Vieta *", + "opc-ua-keystore-location": "Vieta", "opc-ua-keystore-password": "Parole", "opc-ua-keystore-password-required": "Parole ir nepieciešama", "opc-ua-keystore-alias": "Segvārds", diff --git a/ui-ngx/src/assets/locale/locale.constant-nl_BE.json b/ui-ngx/src/assets/locale/locale.constant-nl_BE.json index 0c9c317a7e..65e5fe4ea2 100644 --- a/ui-ngx/src/assets/locale/locale.constant-nl_BE.json +++ b/ui-ngx/src/assets/locale/locale.constant-nl_BE.json @@ -5780,7 +5780,7 @@ "opc-ua-type": "Type", "opc-ua-keystore-type": "Type", "opc-ua-keystore-type-required": "Type is verplicht", - "opc-ua-keystore-location": "Locatie *", + "opc-ua-keystore-location": "Locatie", "opc-ua-keystore-password": "Wachtwoord", "opc-ua-keystore-password-required": "Wachtwoord is verplicht", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-nl_NL.json b/ui-ngx/src/assets/locale/locale.constant-nl_NL.json index c6c15e6a7e..c371e04d72 100644 --- a/ui-ngx/src/assets/locale/locale.constant-nl_NL.json +++ b/ui-ngx/src/assets/locale/locale.constant-nl_NL.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Type", "opc-ua-keystore-type": "Type", "opc-ua-keystore-type-required": "Type is verplicht", - "opc-ua-keystore-location": "Locatie *", + "opc-ua-keystore-location": "Locatie", "opc-ua-keystore-password": "Wachtwoord", "opc-ua-keystore-password-required": "Wachtwoord is verplicht", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-no_NO.json b/ui-ngx/src/assets/locale/locale.constant-no_NO.json index db9e9d2a8c..5a3500b271 100644 --- a/ui-ngx/src/assets/locale/locale.constant-no_NO.json +++ b/ui-ngx/src/assets/locale/locale.constant-no_NO.json @@ -5754,7 +5754,7 @@ "opc-ua-type": "Type", "opc-ua-keystore-type": "Type", "opc-ua-keystore-type-required": "Type er påkrevd", - "opc-ua-keystore-location": "Plassering *", + "opc-ua-keystore-location": "Plassering", "opc-ua-keystore-password": "Passord", "opc-ua-keystore-password-required": "Passord er påkrevd", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-pl_PL.json b/ui-ngx/src/assets/locale/locale.constant-pl_PL.json index 1ab72dfc96..c518eb3c44 100644 --- a/ui-ngx/src/assets/locale/locale.constant-pl_PL.json +++ b/ui-ngx/src/assets/locale/locale.constant-pl_PL.json @@ -5780,7 +5780,7 @@ "opc-ua-type": "Typ", "opc-ua-keystore-type": "Typ", "opc-ua-keystore-type-required": "Typ jest wymagany", - "opc-ua-keystore-location": "Lokalizacja *", + "opc-ua-keystore-location": "Lokalizacja", "opc-ua-keystore-password": "Hasło", "opc-ua-keystore-password-required": "Hasło jest wymagane", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-pt_BR.json b/ui-ngx/src/assets/locale/locale.constant-pt_BR.json index db43c5e8a7..49202c8603 100644 --- a/ui-ngx/src/assets/locale/locale.constant-pt_BR.json +++ b/ui-ngx/src/assets/locale/locale.constant-pt_BR.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Tipo", "opc-ua-keystore-type": "Tipo", "opc-ua-keystore-type-required": "O tipo é obrigatório", - "opc-ua-keystore-location": "Localização *", + "opc-ua-keystore-location": "Localização", "opc-ua-keystore-password": "Senha", "opc-ua-keystore-password-required": "A senha é obrigatória", "opc-ua-keystore-alias": "Alias", diff --git a/ui-ngx/src/assets/locale/locale.constant-sl_SI.json b/ui-ngx/src/assets/locale/locale.constant-sl_SI.json index b0d0e2ad4d..143d393917 100644 --- a/ui-ngx/src/assets/locale/locale.constant-sl_SI.json +++ b/ui-ngx/src/assets/locale/locale.constant-sl_SI.json @@ -5770,7 +5770,7 @@ "opc-ua-type": "Vrsta", "opc-ua-keystore-type": "Vrsta", "opc-ua-keystore-type-required": "Vrsta je obvezna", - "opc-ua-keystore-location": "Lokacija *", + "opc-ua-keystore-location": "Lokacija", "opc-ua-keystore-password": "Geslo", "opc-ua-keystore-password-required": "Geslo je obvezno", "opc-ua-keystore-alias": "Vzdevek", diff --git a/ui-ngx/src/assets/locale/locale.constant-tr_TR.json b/ui-ngx/src/assets/locale/locale.constant-tr_TR.json index 92617a2bcb..d4abdc5315 100644 --- a/ui-ngx/src/assets/locale/locale.constant-tr_TR.json +++ b/ui-ngx/src/assets/locale/locale.constant-tr_TR.json @@ -5745,7 +5745,7 @@ "opc-ua-type": "Tür", "opc-ua-keystore-type": "Tür", "opc-ua-keystore-type-required": "Tür gereklidir", - "opc-ua-keystore-location": "Konum *", + "opc-ua-keystore-location": "Konum", "opc-ua-keystore-password": "Parola", "opc-ua-keystore-password-required": "Parola gereklidir", "opc-ua-keystore-alias": "Takma ad", diff --git a/ui-ngx/src/assets/locale/locale.constant-uk_UA.json b/ui-ngx/src/assets/locale/locale.constant-uk_UA.json index ffb5e01081..4051e0f89d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-uk_UA.json +++ b/ui-ngx/src/assets/locale/locale.constant-uk_UA.json @@ -5743,7 +5743,7 @@ "opc-ua-type": "Тип", "opc-ua-keystore-type": "Тип", "opc-ua-keystore-type-required": "Потрібно вказати тип", - "opc-ua-keystore-location": "Розташування *", + "opc-ua-keystore-location": "Розташування", "opc-ua-keystore-password": "Пароль", "opc-ua-keystore-password-required": "Потрібно вказати пароль", "opc-ua-keystore-alias": "Псевдонім", diff --git a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json index 41e6a3ae47..5a85eb997d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json +++ b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json @@ -5745,7 +5745,7 @@ "opc-ua-type": "类型", "opc-ua-keystore-type": "类型", "opc-ua-keystore-type-required": "类型为必填项", - "opc-ua-keystore-location": "位置 *", + "opc-ua-keystore-location": "位置", "opc-ua-keystore-password": "密码", "opc-ua-keystore-password-required": "密码为必填项", "opc-ua-keystore-alias": "别名", diff --git a/ui-ngx/src/assets/locale/locale.constant-zh_TW.json b/ui-ngx/src/assets/locale/locale.constant-zh_TW.json index 5aa9fc1942..9f9d2e3bab 100644 --- a/ui-ngx/src/assets/locale/locale.constant-zh_TW.json +++ b/ui-ngx/src/assets/locale/locale.constant-zh_TW.json @@ -11897,7 +11897,7 @@ "opc-ua-type": "類型", "opc-ua-keystore-type": "類型", "opc-ua-keystore-type-required": "類型為必填項。", - "opc-ua-keystore-location": "位置 *", + "opc-ua-keystore-location": "位置", "opc-ua-keystore-password": "密碼", "opc-ua-keystore-password-required": "密碼為必填項。", "opc-ua-keystore-alias": "別名", From d91ced01ab2346512a3f882e47d3a9c12eb1d77f Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 16 Nov 2026 11:37:37 +0100 Subject: [PATCH 05/16] Merge pull request #16449 from mtsymbarov-del/fix/outline-dropdowns-consistency Replaced the type and profile dropdowns on the Assets, Entity views, Edges, Resources and Scripts pages with a Filter button --- .../msa/ui/pages/DevicePageElements.java | 2 +- .../python/license-headers/curations.json | 18 +- .../device/device-info-filter.component.html | 79 +----- .../device/device-info-filter.component.ts | 261 ++---------------- .../entity/entities-table.component.scss | 12 + .../asset-profile-autocomplete.component.html | 17 +- .../asset-profile-autocomplete.component.ts | 5 + ...device-profile-autocomplete.component.html | 6 +- .../device-profile-autocomplete.component.ts | 1 + .../js-library-table-header.component.html | 39 +-- .../js-library-table-header.component.ts | 11 +- .../resources-table-header.component.html | 39 +-- .../resources-table-header.component.ts | 11 +- .../asset/asset-table-header.component.html | 29 +- .../asset/asset-table-header.component.scss | 6 - .../asset/asset-table-header.component.ts | 11 +- .../device/device-table-header.component.html | 13 +- .../device/device-table-header.component.ts | 26 +- .../edge/edge-table-header.component.html | 25 +- .../pages/edge/edge-table-header.component.ts | 1 - .../entity-view-table-header.component.html | 26 +- .../entity-view-table-header.component.scss | 6 - .../entity-view-table-header.component.ts | 1 - .../button/filter-button.component.html | 41 +++ .../button/filter-button.component.ts | 204 ++++++++++++++ .../entity-subtype-select.component.html | 13 +- .../entity/entity-subtype-select.component.ts | 9 +- .../time/timezone-select.component.ts | 7 +- ui-ngx/src/app/shared/shared.module.ts | 6 + .../assets/locale/locale.constant-ar_AE.json | 1 - .../assets/locale/locale.constant-da_DK.json | 2 - .../assets/locale/locale.constant-de_DE.json | 2 - .../assets/locale/locale.constant-el_GR.json | 2 - .../assets/locale/locale.constant-en_US.json | 7 +- .../assets/locale/locale.constant-es_ES.json | 2 - .../assets/locale/locale.constant-fr_FR.json | 2 - .../assets/locale/locale.constant-hi_IN.json | 2 - .../assets/locale/locale.constant-it_IT.json | 2 - .../assets/locale/locale.constant-ja_JP.json | 2 - .../assets/locale/locale.constant-ko_KR.json | 2 - .../assets/locale/locale.constant-lt_LT.json | 2 - .../assets/locale/locale.constant-nl_BE.json | 2 - .../assets/locale/locale.constant-nl_NL.json | 2 - .../assets/locale/locale.constant-no_NO.json | 2 - .../assets/locale/locale.constant-pl_PL.json | 2 - .../assets/locale/locale.constant-pt_BR.json | 2 - .../assets/locale/locale.constant-sl_SI.json | 2 - .../assets/locale/locale.constant-tr_TR.json | 2 - .../assets/locale/locale.constant-uk_UA.json | 2 - .../assets/locale/locale.constant-zh_CN.json | 2 - .../assets/locale/locale.constant-zh_TW.json | 2 - .../filter-button.scss} | 9 +- 52 files changed, 508 insertions(+), 474 deletions(-) delete mode 100644 ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.scss delete mode 100644 ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.scss create mode 100644 ui-ngx/src/app/shared/components/button/filter-button.component.html create mode 100644 ui-ngx/src/app/shared/components/button/filter-button.component.ts rename ui-ngx/src/{app/modules/home/components/device/device-info-filter.component.scss => scss/filter-button.scss} (73%) diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DevicePageElements.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DevicePageElements.java index e3da490636..03a20ca70e 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DevicePageElements.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DevicePageElements.java @@ -42,7 +42,7 @@ public class DevicePageElements extends OtherPageElementsHelper { private static final String DEVICE_LABEL_EDIT = "//input[@formcontrolname='label']"; private static final String DEVICE_DEVICE_PROFILE_PAGE = DEVICE + "/ancestor::mat-row//mat-cell[contains(@class,'cdk-column-type')]/span"; protected static final String CHANGE_OWNER_BTN = "//mat-icon[text() = 'assignment_ind']/parent::button"; - private static final String FILTER_BTN = "//tb-device-info-filter/button"; + private static final String FILTER_BTN = "//tb-device-table-header//tb-filter-button/button"; private static final String DEVICE_PROFILE_FIELD = "(//input[@formcontrolname='deviceProfile'])[2]"; private static final String DEVICE_STATE_SELECT = "//div[contains(@class,'tb-filter-panel')]//mat-select[@role='combobox']"; private static final String LIST_OF_DEVICES_STATE = "//div[@class='status']"; diff --git a/tools/src/main/python/license-headers/curations.json b/tools/src/main/python/license-headers/curations.json index b7c246d042..1087d63225 100644 --- a/tools/src/main/python/license-headers/curations.json +++ b/tools/src/main/python/license-headers/curations.json @@ -1393,12 +1393,6 @@ "reason": "PE agent entity tabs component added in f5e28c9cc42 as part of the PE agent feature introduced on lts-4.4, which has no counterpart in CE. The candidate CE ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts shares only the entity tabs component boilerplate. Reviewed candidate at a0aff29ef42d3636473b017115a9334b48d54d15 (blob 58bc88a8db4).", "contentHash": "sha256:774979b5f77b5d58e1d7dfabc31f6271a46cfa346b8f43e6bb18db92e0cb2429" }, - { - "path": "ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.scss", - "header": "ce-modified", - "reason": "Retained CE file subsequently deleted on the CE mainline in d81add6fd73 (Angular 15 migration). PE keeps the assets table header stylesheet and updated it for the MDC slide toggle. Reviewed against last CE path version 80430897422ae13b600ee9c9dbc57f7d558a3b4b^1 (blob 488e5b4c27e).", - "contentHash": "sha256:57aabaed35a0bf7d372df84d6d3c7e7562eeccc06bd19655f94000bd2693f3c0" - }, { "path": "ui-ngx/src/app/modules/home/pages/converter/converter.module.ts", "header": "busl", @@ -1441,12 +1435,6 @@ "reason": "New PE file implementing a PE feature. It was written by adapting CE ui-ngx/src/app/modules/home/pages/dashboard/make-dashboard-public-dialog.component.ts, which PE still carries at its own path, so this is not a CE file with PE modifications. Adaptation from CE does not make it CE-derived. Maintainer rule (2026-09-09): a file that exists in CE and carries PE changes is modified CE; a file that does not exist in CE and implements a PE feature is PE-only, however closely it resembles a CE file.", "contentHash": "sha256:07f295f637db24d600798215d33391f4e966954899f644a41b9735f5ed5392db" }, - { - "path": "ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.scss", - "header": "ce-modified", - "reason": "Retained CE file subsequently deleted on the CE mainline in d81add6fd73 (Angular 15 migration). PE keeps the entity views table header stylesheet and updated it for the MDC slide toggle. Reviewed against last CE path version 80430897422ae13b600ee9c9dbc57f7d558a3b4b^1 (blob 66a9d55fb35).", - "contentHash": "sha256:6c7ddc99037190175a49c49f17e30954e2e46d03f7e91cb02ae5e40381a4850b" - }, { "path": "ui-ngx/src/app/modules/home/pages/iframe/iframe-view.module.ts", "header": "busl", @@ -1710,6 +1698,12 @@ "header": "busl", "reason": "ID wrapper for a PE-only entity. Maintainer resolved ConverterId and comparable PE-only entity wrappers as PE-authored; extending the common ID type and repeating its annotations/type tag is template use. Reviewed similarity candidate ui-ngx/src/app/shared/models/id/asset-id.ts at 0d3b41e002f958887a317ca8366fdc4efa549058 (blob 86ca874a92346a950b6912d78116f1f7ee6bb654).", "contentHash": "sha256:5427b1c6bf59f9e9372c47717fee96bf94bddeaf65ad920b77647b16539bf5f9" + }, + { + "path": "ui-ngx/src/scss/filter-button.scss", + "header": "ce-modified", + "reason": "Shared filter button styles extracted from the CE device filter component, which now uses this file instead of its own copy; the rules are the CE implementation with the panel class renamed. Reviewed against CE ui-ngx/src/app/modules/home/components/device/device-info-filter.component.scss at 269bc8dc73a4892e93cf61db6a8a41ea377c8636 (blob 4a79c6c9ce599e85209d5a6ee9062b6f713ac0f1).", + "contentHash": "sha256:3b19b678564aa147c087269d91d7996a5c2a58d7ff058afbe6610c5cda56cc0e" } ] } diff --git a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html index e34c644b74..7e86f073f4 100644 --- a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html @@ -1,95 +1,30 @@ -@if (panelMode) { - -} @else { - @if (buttonMode) { - - } @else { -
-
-
device-profile.device-profile
- - -
-
-
device.device-state
- - - {{ 'device.any' | translate }} - {{ 'device.active' | translate }} - {{ 'device.inactive' | translate }} - - -
-
- } -} - -
- -
- - - - -
-
-
- -
+
device-profile.device-profile
device.device-state
- - + + {{ 'device.any' | translate }} {{ 'device.active' | translate }} {{ 'device.inactive' | translate }}
-
-
+ diff --git a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts index 8141b30d0c..bf16ae726d 100644 --- a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts +++ b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts @@ -1,45 +1,16 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 -import { - ChangeDetectorRef, - Component, - DestroyRef, - ElementRef, - forwardRef, - Inject, - InjectionToken, - Input, - OnInit, - Optional, - TemplateRef, - ViewChild, - ViewContainerRef -} from '@angular/core'; -import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { coerceBoolean } from '@shared/decorators/coercion'; -import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; -import { TemplatePortal } from '@angular/cdk/portal'; -import { TranslateService } from '@ngx-translate/core'; -import { DeviceInfoFilter } from '@shared/models/device.models'; -import { deepClone, isDefinedAndNotNull, isEmpty, isUndefinedOrNull } from '@core/utils'; -import { EntityInfoData } from '@shared/models/entity.models'; -import { DeviceProfileService } from '@core/http/device-profile.service'; +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +import { ChangeDetectionStrategy, Component, DestroyRef, forwardRef, inject } from '@angular/core'; +import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { fromEvent, Subscription } from 'rxjs'; - -export const DEVICE_FILTER_CONFIG_DATA = new InjectionToken('DeviceFilterConfigData'); - -export interface DeviceFilterConfigData { - panelMode: boolean; - deviceInfoFilter: DeviceInfoFilter; - initialFilterConfig?: DeviceInfoFilter; -} +import { DeviceInfoFilter } from '@shared/models/device.models'; -// @dynamic @Component({ selector: 'tb-device-info-filter', templateUrl: './device-info-filter.component.html', - styleUrls: ['./device-info-filter.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + host: {class: 'contents'}, providers: [ { provide: NG_VALUE_ACCESSOR, @@ -49,78 +20,25 @@ export interface DeviceFilterConfigData { ], standalone: false }) -export class DeviceInfoFilterComponent implements OnInit, ControlValueAccessor { - - @ViewChild('deviceFilterPanel') - deviceFilterPanel: TemplateRef; - - @Input() disabled: boolean; - - @coerceBoolean() - @Input() - buttonMode = true; - - @Input() - initialDeviceFilterConfig: DeviceInfoFilter = { - deviceProfileId: null, - active: null - }; - - panelMode = false; - - buttonDisplayValue = this.translate.instant('device.device-filter-title'); - - deviceInfoFilterForm: FormGroup; - - deviceFilterOverlayRef: OverlayRef; +export class DeviceInfoFilterComponent implements ControlValueAccessor { - panelResult: DeviceInfoFilter = null; + private fb = inject(FormBuilder); + private destroyRef = inject(DestroyRef); - private deviceProfileInfo: EntityInfoData; - private deviceInfoFilter: DeviceInfoFilter; - private resizeWindows: Subscription; + deviceInfoFilterForm = this.fb.group({ + deviceProfileId: [null as DeviceInfoFilter['deviceProfileId']], + active: [null as boolean] + }); - private propagateChange = (_: any) => {}; + private propagateChange = (_: DeviceInfoFilter) => {}; - constructor(@Optional() @Inject(DEVICE_FILTER_CONFIG_DATA) - private data: DeviceFilterConfigData | undefined, - @Optional() - private overlayRef: OverlayRef, - private fb: FormBuilder, - private translate: TranslateService, - private overlay: Overlay, - private nativeElement: ElementRef, - private viewContainerRef: ViewContainerRef, - private deviceProfileService: DeviceProfileService, - private cd: ChangeDetectorRef, - private destroyRef: DestroyRef) { - } - - ngOnInit(): void { - if (this.data) { - this.panelMode = this.data.panelMode; - this.deviceInfoFilter = this.data.deviceInfoFilter; - this.initialDeviceFilterConfig = this.data.initialFilterConfig; - if (this.panelMode && !this.initialDeviceFilterConfig) { - this.initialDeviceFilterConfig = deepClone(this.deviceInfoFilter); - } - } - this.deviceInfoFilterForm = this.fb.group({ - deviceProfileId: [null, []], - active: ['', []] - }); + constructor() { this.deviceInfoFilterForm.valueChanges.pipe( takeUntilDestroyed(this.destroyRef) - ).subscribe( - () => { - if (!this.buttonMode) { - this.deviceFilterUpdated(this.deviceInfoFilterForm.value); - } - } - ); - if (this.panelMode) { - this.updateDeviceInfoFilterForm(this.deviceInfoFilter); - } + ).subscribe(value => this.propagateChange({ + deviceProfileId: value.deviceProfileId ?? null, + active: value.active ?? null + })); } registerOnChange(fn: any): void { @@ -131,8 +49,7 @@ export class DeviceInfoFilterComponent implements OnInit, ControlValueAccessor { } setDisabledState(isDisabled: boolean): void { - this.disabled = isDisabled; - if (this.disabled) { + if (isDisabled) { this.deviceInfoFilterForm.disable({emitEvent: false}); } else { this.deviceInfoFilterForm.enable({emitEvent: false}); @@ -140,145 +57,9 @@ export class DeviceInfoFilterComponent implements OnInit, ControlValueAccessor { } writeValue(deviceInfoFilter?: DeviceInfoFilter): void { - this.deviceInfoFilter = deviceInfoFilter; - if (!this.initialDeviceFilterConfig && deviceInfoFilter) { - this.initialDeviceFilterConfig = deepClone(deviceInfoFilter); - } - this.updateButtonDisplayValue(); - this.updateDeviceInfoFilterForm(deviceInfoFilter); - } - - toggleDeviceFilterPanel($event: Event) { - if ($event) { - $event.stopPropagation(); - } - const config = new OverlayConfig({ - panelClass: 'tb-filter-panel', - backdropClass: 'cdk-overlay-transparent-backdrop', - hasBackdrop: true, - maxHeight: '80vh', - height: 'min-content', - minWidth: '' - }); - config.hasBackdrop = true; - const connectedPosition: ConnectedPosition = { - originX: 'start', - originY: 'bottom', - overlayX: 'start', - overlayY: 'top' - }; - config.positionStrategy = this.overlay.position().flexibleConnectedTo(this.nativeElement) - .withPositions([connectedPosition]); - - this.deviceFilterOverlayRef = this.overlay.create(config); - this.deviceFilterOverlayRef.backdropClick().subscribe(() => { - this.deviceFilterOverlayRef.dispose(); - }); - this.deviceFilterOverlayRef.attach(new TemplatePortal(this.deviceFilterPanel, - this.viewContainerRef)); - this.resizeWindows = fromEvent(window, 'resize').subscribe(() => { - this.deviceFilterOverlayRef.updatePosition(); - }); - } - - cancel() { - this.updateDeviceInfoFilterForm(this.deviceInfoFilter); - this.deviceInfoFilterForm.markAsPristine(); - if (this.overlayRef) { - this.overlayRef.dispose(); - } else { - this.resizeWindows.unsubscribe(); - this.deviceFilterOverlayRef.dispose(); - } - } - - update() { - this.deviceFilterUpdated(this.deviceInfoFilterForm.value); - this.deviceInfoFilterForm.markAsPristine(); - if (this.panelMode) { - this.panelResult = this.deviceInfoFilter; - } - if (this.overlayRef) { - this.overlayRef.dispose(); - } else { - this.resizeWindows.unsubscribe(); - this.deviceFilterOverlayRef.dispose(); - } - } - - reset() { - const deviceInfoFilter = this.deviceFilterFromFormValue(this.deviceInfoFilterForm.value); - if (!this.deviceInfoFilterConfigEquals(deviceInfoFilter, this.initialDeviceFilterConfig)) { - this.updateDeviceInfoFilterForm(this.initialDeviceFilterConfig); - this.deviceInfoFilterForm.markAsDirty(); - } - } - - deviceProfileChanged(deviceProfileInfo: EntityInfoData) { - this.deviceProfileInfo = deviceProfileInfo; - this.updateButtonDisplayValue(); - } - - private deviceInfoFilterConfigEquals = (filter1?: DeviceInfoFilter, filter2?: DeviceInfoFilter): boolean => { - if (filter1 === filter2) { - return true; - } - if ((isUndefinedOrNull(filter1) || isEmpty(filter1)) && (isUndefinedOrNull(filter2) || isEmpty(filter2))) { - return true; - } else if (isDefinedAndNotNull(filter1) && isDefinedAndNotNull(filter2)) { - if (filter1.active !== filter2.active) { - return false; - } - return filter1.deviceProfileId === filter2.deviceProfileId; - } - return false; - }; - - private updateDeviceInfoFilterForm(deviceInfoFilter?: DeviceInfoFilter) { this.deviceInfoFilterForm.patchValue({ deviceProfileId: deviceInfoFilter?.deviceProfileId ?? null, active: deviceInfoFilter?.active ?? null }, {emitEvent: false}); } - - private deviceFilterUpdated(deviceInfoFilter: DeviceInfoFilter) { - this.deviceInfoFilter = this.deviceFilterFromFormValue(deviceInfoFilter); - this.updateButtonDisplayValue(); - this.propagateChange(this.deviceInfoFilter); - } - - private updateButtonDisplayValue() { - if (this.buttonMode) { - const filterTextParts: string[] = []; - if (isDefinedAndNotNull(this.deviceInfoFilter?.deviceProfileId)) { - if (!this.deviceProfileInfo) { - this.deviceProfileService.getDeviceProfileInfo(this.deviceInfoFilter?.deviceProfileId.id, - {ignoreLoading: true, ignoreErrors: true}).subscribe( - (deviceProfileInfo) => { - this.deviceProfileChanged(deviceProfileInfo); - }); - return; - } else { - filterTextParts.push(this.deviceProfileInfo.name); - } - } - if (isDefinedAndNotNull(this.deviceInfoFilter?.active)) { - const translationKey = this.deviceInfoFilter?.active ? 'device.active' : 'device.inactive'; - filterTextParts.push(this.translate.instant(translationKey)); - } - if (!filterTextParts.length) { - this.buttonDisplayValue = this.translate.instant('device.device-filter-title'); - } else { - this.buttonDisplayValue = this.translate.instant('device.filter-title') + `: ${filterTextParts.join(', ')}`; - } - this.cd.detectChanges(); - } - } - - private deviceFilterFromFormValue(formValue: any): DeviceInfoFilter { - return { - deviceProfileId: formValue?.deviceProfileId ?? null, - active: formValue?.active ?? null - }; - } } diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.scss b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.scss index 278d9121ea..ab4ac7b7dd 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.scss +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.scss @@ -32,6 +32,18 @@ .title-container{ overflow: hidden; height: 100%; + min-width: 0; + .tb-entity-table-title { + flex: 0 1 auto; + min-width: 64px; + } + ::ng-deep > :not(.tb-entity-table-title, button) { + min-width: 0; + flex-shrink: 10000; + .mat-mdc-slide-toggle .mdc-label { + white-space: normal; + } + } } .tb-entity-table-title { diff --git a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html index 773a9390b8..e9d8c52332 100644 --- a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html @@ -5,11 +5,19 @@ SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 --> - - {{ 'asset-profile.asset-profile' | translate }} + + @if (!inlineField) { + {{ 'asset-profile.asset-profile' | translate }} + } - @for (assetProfile of filteredAssetProfiles | async; track assetProfile) { + @let assetProfiles = filteredAssetProfiles | async; + @for (assetProfile of assetProfiles; track assetProfile) { } - @if (!(filteredAssetProfiles | async)?.length) { + @if (assetProfiles && !assetProfiles.length) {
@if (!textIsNotEmpty(searchText) || !addNewProfile) { diff --git a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts index 32f944bfe8..2f1caa0124 100644 --- a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts @@ -93,6 +93,10 @@ export class AssetProfileAutocompleteComponent implements ControlValueAccessor, @Input() appearance: MatFormFieldAppearance = 'fill'; + @Input() + @coerceBoolean() + inlineField: boolean; + @Output() assetProfileUpdated = new EventEmitter(); @@ -306,6 +310,7 @@ export class AssetProfileAutocompleteComponent implements ControlValueAccessor, setTimeout(() => { this.assetProfileInput.nativeElement.blur(); this.assetProfileInput.nativeElement.focus(); + this.ignoreClosedPanel = false; }, 0); } diff --git a/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html b/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html index 9989b6ddb5..6d1a5c47e0 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html @@ -17,6 +17,7 @@ - @for (deviceProfile of filteredDeviceProfiles | async; track deviceProfile) { + @let deviceProfiles = filteredDeviceProfiles | async; + @for (deviceProfile of deviceProfiles; track deviceProfile) { } - @if (!(filteredDeviceProfiles | async)?.length) { + @if (deviceProfiles && !deviceProfiles.length) {
@if (!textIsNotEmpty(searchText) || !addNewProfile) { diff --git a/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.ts b/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.ts index 6a871a0617..82251785c9 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.ts @@ -332,6 +332,7 @@ export class DeviceProfileAutocompleteComponent implements ControlValueAccessor, setTimeout(() => { this.deviceProfileInput.nativeElement.blur(); this.deviceProfileInput.nativeElement.focus(); + this.ignoreClosedPanel = false; }, 0); } diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.html b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.html index 4c74fb65cf..b25202ed9f 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.html @@ -1,21 +1,28 @@ - - javascript.script-type - - - {{ "javascript.all-types" | translate }} - - @for (jsResourceSubType of jsResourceSubTypes; track jsResourceSubType) { - - {{ resourceSubTypesTranslationMap.get(jsResourceSubType) | translate }} - - } - - + + +
+
javascript.script-type
+ + + {{ 'javascript.all-types' | translate }} + @for (jsResourceSubType of jsResourceSubTypes; track jsResourceSubType) { + + {{ resourceSubTypesTranslationMap.get(jsResourceSubType) | translate }} + + } + + +
+
+
diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.ts b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.ts index 3998f20875..c5a52e99bd 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.ts @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 -import { Component } from '@angular/core'; +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +import { Component, inject } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { EntityTableHeaderComponent } from '@home/components/entity/entity-table-header.component'; @@ -18,6 +20,11 @@ export class JsLibraryTableHeaderComponent extends EntityTableHeaderComponent + this.translate.instant(this.resourceSubTypesTranslationMap.get(resourceSubType) ?? resourceSubType); + constructor(protected store: Store) { super(store); } diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.html b/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.html index d1e0e6c139..9c7926c929 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.html @@ -1,21 +1,28 @@ - - resource.resource-type - - - {{ "resource.all-types" | translate }} - - @for (resourceType of resourceTypes; track resourceType) { - - {{ resourceTypesTranslationMap.get(resourceType) | translate }} - - } - - + + +
+
resource.resource-type
+ + + {{ 'resource.all-types' | translate }} + @for (resourceType of resourceTypes; track resourceType) { + + {{ resourceTypesTranslationMap.get(resourceType) | translate }} + + } + + +
+
+
diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.ts b/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.ts index 691e3bab06..c09a6d9e74 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.ts @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 -import { Component } from '@angular/core'; +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +import { Component, inject } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { EntityTableHeaderComponent } from '@home/components/entity/entity-table-header.component'; @@ -18,6 +20,11 @@ export class ResourcesTableHeaderComponent extends EntityTableHeaderComponent + this.translate.instant(this.resourceTypesTranslationMap.get(resourceType) ?? resourceType); + constructor(protected store: Store) { super(store); } diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.html b/ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.html index 3d875591ed..d40273db04 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.html +++ b/ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.html @@ -5,16 +5,25 @@ SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 --> -
- - +
+ + +
+
asset-profile.asset-profile
+ + +
+
+
implements OnInit { @@ -23,6 +24,12 @@ export class AssetTableHeaderComponent extends EntityTableHeaderComponent + this.assetProfileService.getAssetProfileInfo(assetProfileId.id, {ignoreLoading: true, ignoreErrors: true}) + .pipe(map(assetProfileInfo => assetProfileInfo.name)); + constructor(protected store: Store) { super(store); } diff --git a/ui-ngx/src/app/modules/home/pages/device/device-table-header.component.html b/ui-ngx/src/app/modules/home/pages/device/device-table-header.component.html index 9621854cb5..d2700e274c 100644 --- a/ui-ngx/src/app/modules/home/pages/device/device-table-header.component.html +++ b/ui-ngx/src/app/modules/home/pages/device/device-table-header.component.html @@ -5,10 +5,15 @@ SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 --> -
- - +
+ + + + + implements OnInit { @@ -23,6 +26,19 @@ export class DeviceTableHeaderComponent extends EntityTableHeaderComponent => { + const stateText = isDefinedAndNotNull(deviceInfoFilter.active) + ? this.translate.instant(deviceInfoFilter.active ? 'device.active' : 'device.inactive') : null; + const profileName$ = isDefinedAndNotNull(deviceInfoFilter.deviceProfileId) + ? this.deviceProfileService.getDeviceProfileInfo(deviceInfoFilter.deviceProfileId.id, {ignoreLoading: true, ignoreErrors: true}) + .pipe(map(deviceProfileInfo => deviceProfileInfo.name)) + : of(null); + return profileName$.pipe(map(profileName => [profileName, stateText].filter(Boolean).join(', '))); + }; + constructor(protected store: Store) { super(store); } @@ -34,7 +50,7 @@ export class DeviceTableHeaderComponent extends EntityTableHeaderComponent -
- - +
+ + +
+
edge.edge-type
+ + +
+
+
implements OnInit { diff --git a/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.html b/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.html index 97203126d0..b21476f69e 100644 --- a/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.html +++ b/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.html @@ -5,15 +5,23 @@ SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 --> -
- - +
+ + +
+
entity-view.entity-view-type
+ + +
+
+
implements OnInit { diff --git a/ui-ngx/src/app/shared/components/button/filter-button.component.html b/ui-ngx/src/app/shared/components/button/filter-button.component.html new file mode 100644 index 0000000000..3d240c5ea2 --- /dev/null +++ b/ui-ngx/src/app/shared/components/button/filter-button.component.html @@ -0,0 +1,41 @@ + + + +
+
+ +
+
+ + + + +
+
+
diff --git a/ui-ngx/src/app/shared/components/button/filter-button.component.ts b/ui-ngx/src/app/shared/components/button/filter-button.component.ts new file mode 100644 index 0000000000..22b43e928f --- /dev/null +++ b/ui-ngx/src/app/shared/components/button/filter-button.component.ts @@ -0,0 +1,204 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { + ChangeDetectionStrategy, + Component, + computed, + contentChild, + DestroyRef, + ElementRef, + forwardRef, + inject, + input, + signal, + TemplateRef, + viewChild, + ViewContainerRef +} from '@angular/core'; +import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; +import { TemplatePortal } from '@angular/cdk/portal'; +import { FocusMonitor, InputModalityDetector } from '@angular/cdk/a11y'; +import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes'; +import { MatButton } from '@angular/material/button'; +import { toObservable, toSignal } from '@angular/core/rxjs-interop'; +import { TranslateService } from '@ngx-translate/core'; +import { fromEvent, isObservable, Observable, of, Subscription } from 'rxjs'; +import { catchError, filter, switchMap } from 'rxjs/operators'; +import { POSITION_MAP } from '@shared/models/overlay.models'; +import { isDefinedAndNotNull, isEqual, isObject } from '@core/utils'; + +export type FilterButtonValueLabelFn = (value: T) => string | Observable; + +export interface FilterButtonPanelContext { + $implicit: FormControl; +} + +/** + * Filter button for entity table headers. Shows the current filter value on the button and + * opens an overlay panel with Reset/Cancel/Update actions. The panel control is supplied + * by the host as an bound to the provided FormControl. + */ +@Component({ + selector: 'tb-filter-button', + templateUrl: './filter-button.component.html', + styleUrls: ['../../../../scss/filter-button.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => FilterButtonComponent), + multi: true + } + ], + standalone: false +}) +export class FilterButtonComponent implements ControlValueAccessor { + + private translate = inject(TranslateService); + private overlay = inject(Overlay); + private elementRef = inject(ElementRef); + private viewContainerRef = inject(ViewContainerRef); + private destroyRef = inject(DestroyRef); + private focusMonitor = inject(FocusMonitor); + private inputModality = inject(InputModalityDetector); + + emptyLabel = input.required(); + valueLabel = input>(value => String(value)); + emptyValue = input(null); + + panelContent = contentChild.required>>(TemplateRef); + private panelTemplate = viewChild.required>('filterPanel'); + private filterButton = viewChild.required(MatButton, {read: ElementRef}); + + disabled = signal(false); + + filterControl = new FormControl(null); + + private value = signal(null); + + private valueText = toSignal( + toObservable(computed(() => ({value: this.value(), labelFn: this.valueLabel()}))).pipe( + switchMap(({value, labelFn}) => { + if (this.isEmpty(value)) { + return of(null); + } + const label = labelFn(value); + return (isObservable(label) ? label : of(label)).pipe(catchError(() => of(null))); + }) + ), + {initialValue: null} + ); + + buttonDisplayValue = computed(() => { + if (this.isEmpty(this.value())) { + return this.translate.instant(this.emptyLabel()); + } + const filterTitle = this.translate.instant('filter.filter'); + const valueText = this.valueText(); + return valueText ? `${filterTitle}: ${valueText}` : filterTitle; + }); + + private overlayRef: OverlayRef; + private resizeWindows: Subscription; + + private propagateChange = (_: any) => {}; + + constructor() { + this.destroyRef.onDestroy(() => this.closePanel(false)); + } + + registerOnChange(fn: any): void { + this.propagateChange = fn; + } + + registerOnTouched(_fn: any): void { + } + + setDisabledState(isDisabled: boolean): void { + this.disabled.set(isDisabled); + if (isDisabled) { + this.filterControl.disable({emitEvent: false}); + } else { + this.filterControl.enable({emitEvent: false}); + } + } + + writeValue(value?: T): void { + this.value.set(this.normalize(value)); + this.filterControl.setValue(this.value(), {emitEvent: false}); + } + + openPanel($event: Event) { + $event?.stopPropagation(); + const config = new OverlayConfig({ + panelClass: 'tb-filter-panel', + backdropClass: 'cdk-overlay-transparent-backdrop', + hasBackdrop: true, + maxHeight: '80vh', + height: 'min-content', + minWidth: '' + }); + config.positionStrategy = this.overlay.position() + .flexibleConnectedTo(this.elementRef) + .withPositions([POSITION_MAP.bottomLeft]); + + this.overlayRef = this.overlay.create(config); + this.overlayRef.backdropClick().subscribe(() => this.cancel()); + this.overlayRef.keydownEvents() + .pipe(filter(event => event.keyCode === ESCAPE && !hasModifierKey(event))) + .subscribe(event => { + event.preventDefault(); + this.cancel(); + }); + this.overlayRef.attach(new TemplatePortal(this.panelTemplate(), this.viewContainerRef)); + this.resizeWindows = fromEvent(window, 'resize').subscribe(() => this.overlayRef.updatePosition()); + } + + cancel() { + this.filterControl.setValue(this.value(), {emitEvent: false}); + this.filterControl.markAsPristine(); + this.closePanel(); + } + + update() { + this.value.set(this.normalize(this.filterControl.value)); + this.propagateChange(this.value()); + this.filterControl.markAsPristine(); + this.closePanel(); + } + + reset() { + if (!this.isEmpty(this.filterControl.value)) { + this.filterControl.setValue(this.emptyValue(), {emitEvent: false}); + this.filterControl.markAsDirty(); + } + } + + isChanged(): boolean { + return this.filterControl.dirty && !isEqual(this.normalize(this.filterControl.value), this.value()); + } + + private closePanel(restoreFocus = true) { + this.resizeWindows?.unsubscribe(); + this.resizeWindows = null; + if (this.overlayRef) { + this.overlayRef.dispose(); + this.overlayRef = null; + if (restoreFocus) { + this.focusMonitor.focusVia(this.filterButton(), this.inputModality.mostRecentModality ?? 'program'); + } + } + } + + private normalize(value: T): T { + return this.isEmpty(value) ? this.emptyValue() : value; + } + + private isEmpty(value: T): boolean { + if (!isDefinedAndNotNull(value) || value === '') { + return true; + } + return isObject(value) && Object.values(value).every(v => !isDefinedAndNotNull(v) || v === ''); + } +} diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.html b/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.html index 9e376a2071..48a547c60d 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.html +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.html @@ -1,14 +1,21 @@ - + @if (showLabel) { {{ entitySubtypeTitle | translate }} } - + @for (subType of subTypesOptions | async; track subType) { {{ displaySubTypeFn(subType) }} diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.ts index 21ea092b22..d337fefb85 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.ts @@ -12,6 +12,7 @@ import { EntityType } from '@app/shared/models/entity-type.models'; import { BroadcastService } from '@app/core/services/broadcast.service'; import { SubscriptSizing } from '@angular/material/form-field'; import { isNotEmptyStr } from '@core/utils'; +import { coerceBoolean } from '@shared/decorators/coercion'; import { EntityService } from '@core/http/entity.service'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @@ -50,6 +51,10 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni @Input() typeTranslatePrefix: string; + @Input() + @coerceBoolean() + inlineField: boolean; + entitySubtypeTitle: string; entitySubtypeRequiredText: string; @@ -152,9 +157,9 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni setDisabledState(isDisabled: boolean): void { this.disabled = isDisabled; if (this.disabled) { - this.subTypeFormGroup.disable(); + this.subTypeFormGroup.disable({emitEvent: false}); } else { - this.subTypeFormGroup.enable(); + this.subTypeFormGroup.enable({emitEvent: false}); } } diff --git a/ui-ngx/src/app/shared/components/time/timezone-select.component.ts b/ui-ngx/src/app/shared/components/time/timezone-select.component.ts index 7c62a97d79..ed75c69a97 100644 --- a/ui-ngx/src/app/shared/components/time/timezone-select.component.ts +++ b/ui-ngx/src/app/shared/components/time/timezone-select.component.ts @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { AfterViewInit, Component, forwardRef, Input, NgZone, OnInit, ViewChild } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field'; @@ -10,8 +11,7 @@ import { AppState } from '@app/core/core.state'; import { TranslateService } from '@ngx-translate/core'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { MatAutocompleteTrigger } from '@angular/material/autocomplete'; -import { getDefaultTimezoneInfo, getTimezoneInfo, getTimezones, TimezoneInfo } from '@shared/models/time/time.models'; -import { deepClone } from '@core/utils'; +import { getTimezoneInfo, getTimezones, TimezoneInfo } from '@shared/models/time/time.models'; import { coerceBoolean } from '@shared/decorators/coercion'; import { TimeService } from '@core/services/time.service'; @@ -222,6 +222,7 @@ export class TimezoneSelectComponent implements ControlValueAccessor, OnInit, Af this.selectTimezoneFormGroup.get('timezone').patchValue('', {emitEvent: true}); setTimeout(() => { this.timezoneInputTrigger.openPanel(); + this.ignoreClosePanel = false; }, 0); } diff --git a/ui-ngx/src/app/shared/shared.module.ts b/ui-ngx/src/app/shared/shared.module.ts index 8810e8a506..da7cb1a7ce 100644 --- a/ui-ngx/src/app/shared/shared.module.ts +++ b/ui-ngx/src/app/shared/shared.module.ts @@ -67,6 +67,7 @@ import { TbAnchorComponent } from '@shared/components/tb-anchor.component'; import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe'; import { TimewindowComponent } from '@shared/components/time/timewindow.component'; import { OverlayModule } from '@angular/cdk/overlay'; +import { A11yModule } from '@angular/cdk/a11y'; import { TimewindowPanelComponent } from '@shared/components/time/timewindow-panel.component'; import { TimeintervalComponent } from '@shared/components/time/timeinterval.component'; import { DatetimePeriodComponent } from '@shared/components/time/datetime-period.component'; @@ -160,6 +161,7 @@ import { EdgeEntityGroupListComponent } from '@shared/components/group/edge-enti import { OtaPackageAutocompleteComponent } from '@shared/components/ota-package/ota-package-autocomplete.component'; import { MAT_DATE_LOCALE } from '@angular/material/core'; import { CopyButtonComponent } from '@shared/components/button/copy-button.component'; +import { FilterButtonComponent } from '@shared/components/button/filter-button.component'; import { TogglePasswordComponent } from '@shared/components/button/toggle-password.component'; import { WidgetButtonToggleComponent } from '@shared/components/button/widget-button-toggle.component'; import { HelpPopupComponent } from '@shared/components/help-popup.component'; @@ -491,6 +493,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService) ShareEntityGroupComponent, OtaPackageAutocompleteComponent, CopyButtonComponent, + FilterButtonComponent, TogglePasswordComponent, WidgetButtonToggleComponent, ProtobufContentComponent, @@ -594,6 +597,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService) FormsModule, ReactiveFormsModule, OverlayModule, + A11yModule, ShareButtonDirective, HotkeyModule, ColorPickerModule, @@ -729,6 +733,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService) FormsModule, ReactiveFormsModule, OverlayModule, + A11yModule, HotkeyModule, ColorPickerModule, NgxHmCarouselComponent, @@ -805,6 +810,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService) ShareEntityGroupComponent, OtaPackageAutocompleteComponent, CopyButtonComponent, + FilterButtonComponent, TogglePasswordComponent, WidgetButtonToggleComponent, ProtobufContentComponent, diff --git a/ui-ngx/src/assets/locale/locale.constant-ar_AE.json b/ui-ngx/src/assets/locale/locale.constant-ar_AE.json index 5bfc4afc48..9d4a8f0645 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ar_AE.json +++ b/ui-ngx/src/assets/locale/locale.constant-ar_AE.json @@ -2863,7 +2863,6 @@ "is-gateway": "Gateway", "overwrite-activity-time": "استبدال وقت النشاط للجهاز المتصل", "device-filter-title": "فلتر الجهاز", - "filter-title": "الفلتر", "device-state": "حالة الجهاز", "state": "الحالة", "any": "أي", diff --git a/ui-ngx/src/assets/locale/locale.constant-da_DK.json b/ui-ngx/src/assets/locale/locale.constant-da_DK.json index 818260aba9..f00e849310 100644 --- a/ui-ngx/src/assets/locale/locale.constant-da_DK.json +++ b/ui-ngx/src/assets/locale/locale.constant-da_DK.json @@ -2837,7 +2837,6 @@ "is-gateway": "Er gateway", "overwrite-activity-time": "Overskriv aktivitetstid for tilsluttet enhed", "device-filter-title": "Enhedsfilter", - "filter-title": "Filter", "device-state": "Enhedstilstand", "state": "Tilstand", "any": "Enhver", @@ -7543,7 +7542,6 @@ "drop-file": "Slip en JavaScript-fil eller klik for at vælge en fil, der skal uploades.", "drop-resource-file-or": "Træk og slip en JavaScript-fil eller", "javascript-library": "JavaScript-bibliotek", - "javascript-type": "JavaScript-type", "scripts": "Scripts", "script-type": "Scripttype", "javascript-resource-details": "JavaScript-ressourcedetaljer", diff --git a/ui-ngx/src/assets/locale/locale.constant-de_DE.json b/ui-ngx/src/assets/locale/locale.constant-de_DE.json index 79f234c029..84a60ef4a3 100644 --- a/ui-ngx/src/assets/locale/locale.constant-de_DE.json +++ b/ui-ngx/src/assets/locale/locale.constant-de_DE.json @@ -2835,7 +2835,6 @@ "is-gateway": "Ist Gateway", "overwrite-activity-time": "Aktivitätszeit für verbundenes Gerät überschreiben", "device-filter-title": "Gerätefilter", - "filter-title": "Filter", "device-state": "Gerätestatus", "state": "Status", "any": "Beliebig", @@ -7541,7 +7540,6 @@ "drop-file": "Legen Sie eine JavaScript-Datei ab oder klicken Sie, um eine Datei auszuwählen.", "drop-resource-file-or": "JavaScript-Datei hierher ziehen oder", "javascript-library": "JavaScript-Bibliothek", - "javascript-type": "JavaScript-Typ", "scripts": "Skripte", "script-type": "Skripttyp", "javascript-resource-details": "Details der JavaScript-Ressource", diff --git a/ui-ngx/src/assets/locale/locale.constant-el_GR.json b/ui-ngx/src/assets/locale/locale.constant-el_GR.json index a78399fefc..6cb8c633e5 100644 --- a/ui-ngx/src/assets/locale/locale.constant-el_GR.json +++ b/ui-ngx/src/assets/locale/locale.constant-el_GR.json @@ -2837,7 +2837,6 @@ "is-gateway": "Είναι Gateway", "overwrite-activity-time": "Αντικατάσταση χρόνου δραστηριότητας για συνδεδεμένη συσκευή", "device-filter-title": "Φίλτρο συσκευής", - "filter-title": "Φίλτρο", "device-state": "Κατάσταση συσκευής", "state": "Κατάσταση", "any": "Οποιαδήποτε", @@ -7555,7 +7554,6 @@ "drop-file": "Σύρετε ένα αρχείο JavaScript ή κάντε κλικ για να επιλέξετε ένα αρχείο για μεταφόρτωση.", "drop-resource-file-or": "Σύρετε ένα αρχείο JavaScript ή", "javascript-library": "Βιβλιοθήκη JavaScript", - "javascript-type": "Τύπος JavaScript", "scripts": "Σενάρια", "script-type": "Τύπος σεναρίου", "javascript-resource-details": "Λεπτομέρειες πόρου JavaScript", 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 94a28be63e..1bb3ad848f 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -994,6 +994,7 @@ "delete": "Delete asset", "asset-public": "Asset is public", "asset-type": "Asset type", + "asset-filter-title": "Asset filter", "asset-type-required": "Asset type is required.", "select-asset-type": "Select asset type", "enter-asset-type": "Enter asset profile", @@ -2863,7 +2864,6 @@ "is-gateway": "Is gateway", "overwrite-activity-time": "Overwrite activity time for connected device", "device-filter-title": "Device filter", - "filter-title": "Filter", "device-state": "Device state", "state": "State", "any": "Any", @@ -3534,6 +3534,7 @@ "sync": "Sync Edge", "edge-required": "Edge required", "edge-type": "Edge type", + "edge-filter-title": "Edge filter", "edge-type-required": "Edge type is required.", "event-action": "Event action", "entity-id": "Entity ID", @@ -4872,6 +4873,7 @@ "unassign-entity-views-title": "Are you sure you want to unassign { count, plural, =1 {1 entity view} other {# entity views} }?", "unassign-entity-views-text": "After the confirmation all selected entity views will be unassigned and won't be accessible by the customer.", "entity-view-type": "Entity view type", + "entity-view-filter-title": "Entity view filter", "entity-view-type-required": "Entity view type is required.", "select-entity-view-type": "Select entity view type", "enter-entity-view-type": "Enter entity view type", @@ -7593,6 +7595,7 @@ "resource-files": "Resource files", "resource-library-details": "Resource details", "resource-type": "Resource type", + "resource-filter-title": "Resource filter", "resources-library": "Resources library", "files": "Files", "search": "Search resources", @@ -7636,9 +7639,9 @@ "drop-file": "Drop a JavaScript file or click to select a file to upload.", "drop-resource-file-or": "Drag and drop a JavaScript file or", "javascript-library": "JavaScript library", - "javascript-type": "JavaScript type", "scripts": "Scripts", "script-type": "Script type", + "script-filter-title": "Script filter", "javascript-resource-details": "JavaScript resource details", "javascript-resource-is-in-use": "JavaScript resource is used by other entities", "javascript-resources-are-in-use": "JavaScript resources are used by other entities", diff --git a/ui-ngx/src/assets/locale/locale.constant-es_ES.json b/ui-ngx/src/assets/locale/locale.constant-es_ES.json index d9e4242226..aa4741bd7a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-es_ES.json +++ b/ui-ngx/src/assets/locale/locale.constant-es_ES.json @@ -2835,7 +2835,6 @@ "is-gateway": "Es un Gateway", "overwrite-activity-time": "Sobrescribir tiempo de actividad del dispositivo conectado", "device-filter-title": "Filtro de dispositivo", - "filter-title": "Filtro", "device-state": "Estado del dispositivo", "state": "Estado", "any": "Cualquiera", @@ -7541,7 +7540,6 @@ "drop-file": "Suelta un archivo JavaScript o haz clic para seleccionar uno para subir.", "drop-resource-file-or": "Arrastra y suelta un archivo JavaScript o", "javascript-library": "Biblioteca JavaScript", - "javascript-type": "Tipo de JavaScript", "scripts": "Scripts", "script-type": "Tipo de script", "javascript-resource-details": "Detalles del recurso JavaScript", diff --git a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json index 588e0a9223..73528b2a47 100644 --- a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json +++ b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json @@ -2835,7 +2835,6 @@ "is-gateway": "Est une Gateway", "overwrite-activity-time": "Écraser l’heure d’activité de l’appareil connecté", "device-filter-title": "Filtre d’appareil", - "filter-title": "Filtre", "device-state": "État de l’appareil", "state": "État", "any": "N’importe quel", @@ -7541,7 +7540,6 @@ "drop-file": "Déposez un fichier JavaScript ou cliquez pour en sélectionner un à téléverser.", "drop-resource-file-or": "Glissez-déposez un fichier JavaScript ou", "javascript-library": "Bibliothèque JavaScript", - "javascript-type": "Type JavaScript", "scripts": "Scripts", "script-type": "Type de script", "javascript-resource-details": "Détails de la ressource JavaScript", diff --git a/ui-ngx/src/assets/locale/locale.constant-hi_IN.json b/ui-ngx/src/assets/locale/locale.constant-hi_IN.json index 0a5100aae8..720818d17d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-hi_IN.json +++ b/ui-ngx/src/assets/locale/locale.constant-hi_IN.json @@ -2863,7 +2863,6 @@ "is-gateway": "Gateway है", "overwrite-activity-time": "कनेक्टेड डिवाइस के गतिविधि समय को ओवरराइट करें", "device-filter-title": "डिवाइस फ़िल्टर", - "filter-title": "फ़िल्टर", "device-state": "डिवाइस स्थिति", "state": "स्थिति", "any": "कोई भी", @@ -7581,7 +7580,6 @@ "drop-file": "JavaScript फ़ाइल ड्रॉप करें या अपलोड करने के लिए क्लिक करके फ़ाइल चुनें।", "drop-resource-file-or": "JavaScript फ़ाइल को ड्रैग और ड्रॉप करें या", "javascript-library": "JavaScript लाइब्रेरी", - "javascript-type": "JavaScript प्रकार", "scripts": "स्क्रिप्ट", "script-type": "स्क्रिप्ट प्रकार", "javascript-resource-details": "JavaScript संसाधन विवरण", diff --git a/ui-ngx/src/assets/locale/locale.constant-it_IT.json b/ui-ngx/src/assets/locale/locale.constant-it_IT.json index f90bdb507c..8372c35279 100644 --- a/ui-ngx/src/assets/locale/locale.constant-it_IT.json +++ b/ui-ngx/src/assets/locale/locale.constant-it_IT.json @@ -2835,7 +2835,6 @@ "is-gateway": "È un gateway", "overwrite-activity-time": "Sovrascrivi tempo di attività per il dispositivo connesso", "device-filter-title": "Filtro dispositivo", - "filter-title": "Filtro", "device-state": "Stato dispositivo", "state": "Stato", "any": "Qualsiasi", @@ -7541,7 +7540,6 @@ "drop-file": "Trascina un file JavaScript o clicca per selezionarlo da caricare.", "drop-resource-file-or": "Trascina un file JavaScript o", "javascript-library": "Libreria JavaScript", - "javascript-type": "Tipo JavaScript", "scripts": "Script", "script-type": "Tipo di script", "javascript-resource-details": "Dettagli risorsa JavaScript", diff --git a/ui-ngx/src/assets/locale/locale.constant-ja_JP.json b/ui-ngx/src/assets/locale/locale.constant-ja_JP.json index 60a592b2db..1bfd8e7fe4 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ja_JP.json +++ b/ui-ngx/src/assets/locale/locale.constant-ja_JP.json @@ -2835,7 +2835,6 @@ "is-gateway": "Gateway", "overwrite-activity-time": "接続されたデバイスのアクティビティ時刻を上書き", "device-filter-title": "デバイスフィルター", - "filter-title": "フィルター", "device-state": "デバイス状態", "state": "状態", "any": "任意", @@ -7541,7 +7540,6 @@ "drop-file": "JavaScriptファイルをドラッグ&ドロップするか、クリックして選択してください。", "drop-resource-file-or": "JavaScriptファイルをドラッグ&ドロップするか", "javascript-library": "JavaScriptライブラリ", - "javascript-type": "JavaScriptタイプ", "scripts": "スクリプト", "script-type": "スクリプトタイプ", "javascript-resource-details": "JavaScriptリソースの詳細", diff --git a/ui-ngx/src/assets/locale/locale.constant-ko_KR.json b/ui-ngx/src/assets/locale/locale.constant-ko_KR.json index 8a36c6a18a..ef15b5a1fb 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ko_KR.json +++ b/ui-ngx/src/assets/locale/locale.constant-ko_KR.json @@ -2855,7 +2855,6 @@ "is-gateway": "Gateway 여부", "overwrite-activity-time": "연결된 장치의 활동 시간 덮어쓰기", "device-filter-title": "장치 필터", - "filter-title": "필터", "device-state": "장치 상태", "state": "상태", "any": "전체", @@ -7655,7 +7654,6 @@ "drop-file": "JavaScript 파일을 끌어다 놓거나 클릭하여 업로드할 파일을 선택하세요.", "drop-resource-file-or": "JavaScript 파일을 끌어다 놓거나", "javascript-library": "JavaScript 라이브러리", - "javascript-type": "JavaScript 유형", "scripts": "스크립트", "script-type": "스크립트 유형", "javascript-resource-details": "JavaScript 리소스 세부 정보", diff --git a/ui-ngx/src/assets/locale/locale.constant-lt_LT.json b/ui-ngx/src/assets/locale/locale.constant-lt_LT.json index 488d8e823a..a841c8ebde 100644 --- a/ui-ngx/src/assets/locale/locale.constant-lt_LT.json +++ b/ui-ngx/src/assets/locale/locale.constant-lt_LT.json @@ -2863,7 +2863,6 @@ "is-gateway": "Gateway", "overwrite-activity-time": "Perrašyti aktyvumo laiką prijungtam įrenginiui", "device-filter-title": "Įrenginių filtras", - "filter-title": "Filtras", "device-state": "Įrenginio būsena", "state": "Būsena", "any": "Visos", @@ -7581,7 +7580,6 @@ "drop-file": "Nuvilkite JavaScript failą arba spustelėkite, kad pasirinktumėte failą, kurį norite įkelti.", "drop-resource-file-or": "Nuvilkite JavaScript failą arba", "javascript-library": "JavaScript biblioteka", - "javascript-type": "JavaScript tipas", "scripts": "Skriptai", "script-type": "Skripto tipas", "javascript-resource-details": "JavaScript ištekliaus informacija", diff --git a/ui-ngx/src/assets/locale/locale.constant-nl_BE.json b/ui-ngx/src/assets/locale/locale.constant-nl_BE.json index 65e5fe4ea2..818c258f6b 100644 --- a/ui-ngx/src/assets/locale/locale.constant-nl_BE.json +++ b/ui-ngx/src/assets/locale/locale.constant-nl_BE.json @@ -2863,7 +2863,6 @@ "is-gateway": "Is gateway", "overwrite-activity-time": "Activiteitstijd voor verbonden apparaat overschrijven", "device-filter-title": "Apparaatfilter", - "filter-title": "Filter", "device-state": "Apparaatstatus", "state": "Status", "any": "Alles", @@ -7587,7 +7586,6 @@ "drop-file": "Sleep een JavaScript-bestand hierheen of klik om een bestand te selecteren om te uploaden.", "drop-resource-file-or": "Sleep een JavaScript-bestand hierheen of", "javascript-library": "JavaScript-bibliotheek", - "javascript-type": "JavaScript-type", "scripts": "Scripts", "script-type": "Scripttype", "javascript-resource-details": "Details van JavaScript-resource", diff --git a/ui-ngx/src/assets/locale/locale.constant-nl_NL.json b/ui-ngx/src/assets/locale/locale.constant-nl_NL.json index c371e04d72..a732821c84 100644 --- a/ui-ngx/src/assets/locale/locale.constant-nl_NL.json +++ b/ui-ngx/src/assets/locale/locale.constant-nl_NL.json @@ -2835,7 +2835,6 @@ "is-gateway": "Is gateway", "overwrite-activity-time": "Activiteitstijd voor verbonden apparaat overschrijven", "device-filter-title": "Apparaatfilter", - "filter-title": "Filter", "device-state": "Apparaatstatus", "state": "Status", "any": "Alles", @@ -7541,7 +7540,6 @@ "drop-file": "Sleep een JavaScript-bestand of klik om een bestand te selecteren om te uploaden.", "drop-resource-file-or": "Sleep een JavaScript-bestand of", "javascript-library": "JavaScript-bibliotheek", - "javascript-type": "JavaScript-type", "scripts": "Scripts", "script-type": "Scripttype", "javascript-resource-details": "Details van JavaScript-bron", diff --git a/ui-ngx/src/assets/locale/locale.constant-no_NO.json b/ui-ngx/src/assets/locale/locale.constant-no_NO.json index 5a3500b271..caa59dfb9b 100644 --- a/ui-ngx/src/assets/locale/locale.constant-no_NO.json +++ b/ui-ngx/src/assets/locale/locale.constant-no_NO.json @@ -2837,7 +2837,6 @@ "is-gateway": "Er gateway", "overwrite-activity-time": "Overstyr aktivitetstid for tilkoblet enhet", "device-filter-title": "Enhetsfilter", - "filter-title": "Filter", "device-state": "Enhetstilstand", "state": "Tilstand", "any": "Alle", @@ -7555,7 +7554,6 @@ "drop-file": "Slipp en JavaScript-fil eller klikk for å velge en fil for opplasting.", "drop-resource-file-or": "Dra og slipp en JavaScript-fil eller", "javascript-library": "JavaScript-bibliotek", - "javascript-type": "JavaScript-type", "scripts": "Skript", "script-type": "Skripttype", "javascript-resource-details": "JavaScript-ressursdetaljer", diff --git a/ui-ngx/src/assets/locale/locale.constant-pl_PL.json b/ui-ngx/src/assets/locale/locale.constant-pl_PL.json index c518eb3c44..ab805d2ea3 100644 --- a/ui-ngx/src/assets/locale/locale.constant-pl_PL.json +++ b/ui-ngx/src/assets/locale/locale.constant-pl_PL.json @@ -2863,7 +2863,6 @@ "is-gateway": "Gateway", "overwrite-activity-time": "Zastąp czas aktywności podłączonego urządzenia", "device-filter-title": "Filtr urządzeń", - "filter-title": "Filtr", "device-state": "Stan urządzenia", "state": "Stan", "any": "Dowolny", @@ -7581,7 +7580,6 @@ "drop-file": "Upuść plik JavaScript lub kliknij, aby wybrać plik do przesłania.", "drop-resource-file-or": "Przeciągnij i upuść plik JavaScript lub", "javascript-library": "Biblioteka JavaScript", - "javascript-type": "Typ JavaScript", "scripts": "Skrypty", "script-type": "Typ skryptu", "javascript-resource-details": "Szczegóły skryptu JavaScript", diff --git a/ui-ngx/src/assets/locale/locale.constant-pt_BR.json b/ui-ngx/src/assets/locale/locale.constant-pt_BR.json index 49202c8603..57a7bc2b4d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-pt_BR.json +++ b/ui-ngx/src/assets/locale/locale.constant-pt_BR.json @@ -2835,7 +2835,6 @@ "is-gateway": "É gateway", "overwrite-activity-time": "Sobrescrever tempo de atividade do dispositivo conectado", "device-filter-title": "Filtro de dispositivo", - "filter-title": "Filtro", "device-state": "Estado do dispositivo", "state": "Estado", "any": "Qualquer", @@ -7541,7 +7540,6 @@ "drop-file": "Solte um arquivo JavaScript ou clique para selecionar um arquivo para enviar.", "drop-resource-file-or": "Arraste e solte um arquivo JavaScript ou", "javascript-library": "Biblioteca JavaScript", - "javascript-type": "Tipo JavaScript", "scripts": "Scripts", "script-type": "Tipo de script", "javascript-resource-details": "Detalhes do recurso JavaScript", diff --git a/ui-ngx/src/assets/locale/locale.constant-sl_SI.json b/ui-ngx/src/assets/locale/locale.constant-sl_SI.json index 143d393917..8069af8f59 100644 --- a/ui-ngx/src/assets/locale/locale.constant-sl_SI.json +++ b/ui-ngx/src/assets/locale/locale.constant-sl_SI.json @@ -2853,7 +2853,6 @@ "is-gateway": "Je Gateway", "overwrite-activity-time": "Prepiši čas aktivnosti za povezano napravo", "device-filter-title": "Filter naprav", - "filter-title": "Filter", "device-state": "Stanje naprave", "state": "Stanje", "any": "Vse", @@ -7653,7 +7652,6 @@ "drop-file": "Spustite datoteko JavaScript ali kliknite in izberite datoteko za nalaganje.", "drop-resource-file-or": "Povlecite in spustite datoteko JavaScript ali", "javascript-library": "Knjižnica JavaScript", - "javascript-type": "Vrsta skripta JavaScript", "scripts": "Skripti", "script-type": "Vrsta skripta", "javascript-resource-details": "Podrobnosti vira JavaScript", diff --git a/ui-ngx/src/assets/locale/locale.constant-tr_TR.json b/ui-ngx/src/assets/locale/locale.constant-tr_TR.json index d4abdc5315..36484511dc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-tr_TR.json +++ b/ui-ngx/src/assets/locale/locale.constant-tr_TR.json @@ -2837,7 +2837,6 @@ "is-gateway": "Gateway mi", "overwrite-activity-time": "Bağlı cihaz için etkinlik zamanını üzerine yaz", "device-filter-title": "Cihaz Filtresi", - "filter-title": "Filtre", "device-state": "Cihaz durumu", "state": "Durum", "any": "Herhangi biri", @@ -7543,7 +7542,6 @@ "drop-file": "Bir JavaScript dosyasını bırakın veya yüklemek için tıklayın.", "drop-resource-file-or": "Bir JavaScript dosyasını sürükleyip bırakın ya da", "javascript-library": "JavaScript kütüphanesi", - "javascript-type": "JavaScript türü", "scripts": "Betikler", "script-type": "Betik türü", "javascript-resource-details": "JavaScript kaynağı ayrıntıları", diff --git a/ui-ngx/src/assets/locale/locale.constant-uk_UA.json b/ui-ngx/src/assets/locale/locale.constant-uk_UA.json index 4051e0f89d..602efa034b 100644 --- a/ui-ngx/src/assets/locale/locale.constant-uk_UA.json +++ b/ui-ngx/src/assets/locale/locale.constant-uk_UA.json @@ -2835,7 +2835,6 @@ "is-gateway": "Це Gateway", "overwrite-activity-time": "Перезаписати час активності для підключеного пристрою", "device-filter-title": "Фільтр пристроїв", - "filter-title": "Фільтр", "device-state": "Стан пристрою", "state": "Стан", "any": "Будь-який", @@ -7541,7 +7540,6 @@ "drop-file": "Перетягніть JavaScript файл або натисніть, щоб вибрати файл для завантаження.", "drop-resource-file-or": "Перетягніть JavaScript файл або", "javascript-library": "Бібліотека JavaScript", - "javascript-type": "Тип JavaScript", "scripts": "Скрипти", "script-type": "Тип скрипту", "javascript-resource-details": "Деталі JavaScript ресурсу", diff --git a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json index 5a85eb997d..c52ba1e0c1 100644 --- a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json +++ b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json @@ -2837,7 +2837,6 @@ "is-gateway": "Gateway", "overwrite-activity-time": "覆盖已连接设备的活动时间", "device-filter-title": "设备过滤器", - "filter-title": "过滤器", "device-state": "设备状态", "state": "状态", "any": "任意", @@ -7543,7 +7542,6 @@ "drop-file": "拖放 JavaScript 文件或点击选择要上传的文件。", "drop-resource-file-or": "拖放 JavaScript 文件或", "javascript-library": "JavaScript 库", - "javascript-type": "JavaScript 类型", "scripts": "脚本", "script-type": "脚本类型", "javascript-resource-details": "JavaScript 资源详情", diff --git a/ui-ngx/src/assets/locale/locale.constant-zh_TW.json b/ui-ngx/src/assets/locale/locale.constant-zh_TW.json index 9f9d2e3bab..d0abb60ed6 100644 --- a/ui-ngx/src/assets/locale/locale.constant-zh_TW.json +++ b/ui-ngx/src/assets/locale/locale.constant-zh_TW.json @@ -1656,7 +1656,6 @@ "generate-access-token": "產生存取權杖", "device-profile-type-list-empty": "至少應選擇一個裝置設定檔。", "device-filter-title": "裝置篩選器", - "filter-title": "篩選器", "device-state": "裝置狀態", "state": "狀態", "any": "任意", @@ -9921,7 +9920,6 @@ "drop-file": "拖放 JavaScript 檔案,或點選以選取要上傳的檔案。", "drop-resource-file-or": "拖放 JavaScript 檔案或", "javascript-library": "JavaScript 程式庫", - "javascript-type": "JavaScript 類型", "scripts": "指令碼", "script-type": "指令碼類型", "javascript-resource-details": "JavaScript 資源詳細資料", diff --git a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.scss b/ui-ngx/src/scss/filter-button.scss similarity index 73% rename from ui-ngx/src/app/modules/home/components/device/device-info-filter.component.scss rename to ui-ngx/src/scss/filter-button.scss index d5cdd4a5fd..db8930e9d1 100644 --- a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.scss +++ b/ui-ngx/src/scss/filter-button.scss @@ -1,5 +1,7 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 + :host { display: block; overflow: hidden; @@ -21,12 +23,11 @@ } } - ::ng-deep { - .tb-device-filter-config-component { + .tb-filter-button-panel-content { max-width: 100%; width: 500px; min-width: 100%; flex: 1; } -} \ No newline at end of file +} From c5097f52dc77975cef30e91a5abe1538c2cbc5e8 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 16 Nov 2026 12:14:01 +0100 Subject: [PATCH 06/16] Merge pull request #16698 from mtsymbarov-del/fix/dashboard-upload-version-conflict Fixed dashboard "Upload new version" repeatedly reporting a version conflict after "Discard changes" --- .../import-dashboard-file-dialog.component.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts index 1b76ca539f..ecad7891dd 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts @@ -11,6 +11,7 @@ import { DashboardInfo } from '@app/shared/models/dashboard.models'; import { ActionNotificationShow } from '@core/notification/notification.actions'; import { DialogComponent } from '@shared/components/dialog.component'; import { Router } from '@angular/router'; +import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http'; export interface DashboardInfoDialogData { dashboard: DashboardInfo; @@ -54,15 +55,22 @@ export class ImportDashboardFileDialogComponent extends DialogComponent { - this.dialogRef.close(true); - }) + this.dashboardService.saveDashboard(dashboard).subscribe({ + next: () => this.dialogRef.close(true), + error: (err: HttpErrorResponse) => { + if (err.status === HttpStatusCode.Conflict) { + this.dialogRef.close(true); + } + } + }); } loadDataFromJsonContent(content: string): any { From 9226ff5e0d5e4a5d345b21307877d8ccd1235f4c Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 16 Nov 2026 16:46:20 +0200 Subject: [PATCH 07/16] Fixed slow UI loading in monolith installations (#16706) * Serve pre-compressed UI files from the monolith again Spring Boot 2.4 renamed spring.resources.chain.* to spring.web.resources.chain.*, and Spring Boot 2.6 stopped binding the old keys. Since ThingsBoard 3.4 the monolith has silently ignored compressed: "true" and served every UI file uncompressed, although ui-ngx still builds the .gz copies. Use the current keys. The content version strategy is dropped rather than renamed: if enabled it rewrites url() references inside CSS files, which the UI never relied on (esbuild already hashes the file names). * Mention brotli copies in the resource chain description --- .../src/main/resources/thingsboard.yml | 8 +- .../config/StaticResourceCompressionTest.java | 108 ++++++++++++++++++ 2 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 application/src/test/java/org/thingsboard/server/config/StaticResourceCompressionTest.java diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 100d5a8e61..e1766fccb5 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -903,11 +903,9 @@ spring.main.allow-circular-references: "true" # Spring Boot configuration proper spring.freemarker.checkTemplateLocation: "false" # spring freemarker configuration spring.mvc.async.request-timeout: "${SPRING_MVC_ASYNC_REQUEST_TIMEOUT:30000}" # The default timeout for asynchronous requests in milliseconds spring.mvc.pathmatch.matching-strategy: "ANT_PATH_MATCHER" # For endpoints matching in Swagger -spring.resources.chain: - compressed: "true" # This property enables or disables support for serving pre-compressed resources (for example, a .gzip or .br file) - strategy: - content: - enabled: "true" # This property enables or disables the content Version Strategy. This strategy allows Spring to generate a unique version for static resources, which is based on the content of the resource +spring.web.resources.chain: + enabled: "true" # Enables the Spring resource chain explicitly instead of relying on a webjars locator being on the classpath + compressed: "true" # Serve the pre-compressed .br/.gz copies of the UI files built by ui-ngx when the client accepts them spring.servlet.multipart.max-file-size: "${SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE:50MB}" # Total file size cannot exceed 50MB when configuring file uploads spring.servlet.multipart.max-request-size: "${SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE:50MB}" # Total request size for a multipart/form-data cannot exceed 50MB diff --git a/application/src/test/java/org/thingsboard/server/config/StaticResourceCompressionTest.java b/application/src/test/java/org/thingsboard/server/config/StaticResourceCompressionTest.java new file mode 100644 index 0000000000..954b136c84 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/config/StaticResourceCompressionTest.java @@ -0,0 +1,108 @@ +// SPDX-FileCopyrightText: Copyright The Thingsboard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.config; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.ImportAutoConfiguration; +import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; +import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration; +import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.springframework.test.web.servlet.MockMvc; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.zip.GZIPOutputStream; + +import static org.hamcrest.Matchers.containsString; +import static org.springframework.http.HttpHeaders.ACCEPT_ENCODING; +import static org.springframework.http.HttpHeaders.CONTENT_ENCODING; +import static org.springframework.http.HttpHeaders.VARY; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * Loads the real thingsboard.yml, so the test fails if its static resource chain keys stop binding again. + */ +@SpringBootTest(classes = StaticResourceCompressionTest.WebMvcConfig.class, properties = "spring.config.name=thingsboard") +@AutoConfigureMockMvc(addFilters = false) +public class StaticResourceCompressionTest { + + private static final byte[] JS = "console.log('ThingsBoard');\n".repeat(100).getBytes(StandardCharsets.UTF_8); + private static final byte[] JS_GZ = gzip(JS); + private static final byte[] CSS = "@font-face { src: url(font.woff2); }\n".getBytes(StandardCharsets.UTF_8); + + @TempDir + static Path webRoot; + + @Autowired + private MockMvc mvc; + + @DynamicPropertySource + static void staticLocations(DynamicPropertyRegistry registry) { + registry.add("spring.web.resources.static-locations", () -> webRoot.toUri().toString()); + } + + @BeforeAll + static void createStaticFiles() throws IOException { + Files.write(webRoot.resolve("main.js"), JS); + Files.write(webRoot.resolve("main.js.gz"), JS_GZ); + Files.write(webRoot.resolve("styles.css"), CSS); + Files.write(webRoot.resolve("font.woff2"), new byte[]{1, 2, 3}); + } + + @Test + public void servesPrebuiltGzipWhenClientAcceptsIt() throws Exception { + mvc.perform(get("/main.js").header(ACCEPT_ENCODING, "gzip, deflate, br")) + .andExpect(status().isOk()) + .andExpect(header().string(CONTENT_ENCODING, "gzip")) + .andExpect(header().string(VARY, containsString(ACCEPT_ENCODING))) + .andExpect(content().contentTypeCompatibleWith("text/javascript")) + .andExpect(content().bytes(JS_GZ)); + } + + @Test + public void servesRawFileWhenClientDoesNotAcceptGzip() throws Exception { + mvc.perform(get("/main.js")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(CONTENT_ENCODING)) + .andExpect(content().bytes(JS)); + } + + @Test + public void servesStylesheetUnchanged() throws Exception { + // the content version strategy would rewrite url(font.woff2) to url(font-.woff2) + mvc.perform(get("/styles.css").header(ACCEPT_ENCODING, "gzip")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(CONTENT_ENCODING)) + .andExpect(content().bytes(CSS)); + } + + // not @Configuration: @ComponentScan("org.thingsboard.server") in other tests would pick it up + @ImportAutoConfiguration({DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class}) + static class WebMvcConfig { + } + + private static byte[] gzip(byte[] data) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try (GZIPOutputStream gzip = new GZIPOutputStream(out)) { + gzip.write(data); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + return out.toByteArray(); + } + +} From ab6e281017dad701f4bee7e2cff95303c6111a67 Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 16 Nov 2026 16:46:49 +0200 Subject: [PATCH 08/16] Fixed Web UI microservice running out of memory under load (#16722) * Serve pre-compressed UI files from web-ui instead of compressing per request compression 1.8 (pulled in by a CVE fix in 4.2.2.5 / 4.3.1.5) prefers brotli, and browsers always offer it over HTTPS. Brotli-compressing the 8.5 MB main chunk on every cache miss fragments native memory that glibc never returns, so web-ui RSS grows with each traffic burst until the container is OOMKilled. - ui-ngx: write .gz copies for every compressible file of the production build in a post-build step. The esbuild plugin it replaces missed global styles, scripts, polyfills, ace workers and assets/. - web-ui: serve those copies with Content-Encoding: gzip and drop the compression middleware and its dependency. * Run UI compression as a Maven step and ignore aborted downloads in web-ui - build:prod is a plain ng build again; "yarn run compress" runs as its own frontend-maven-plugin execution right after it. - web-ui: like express.static, ignore ECONNABORTED and socket write errors instead of logging a stack trace for every cancelled download, and fall back to the original file if its .gz copy is missing. * Serve pre-built brotli copies of UI files - compress-build.js also writes .br (brotli quality 10). It is 21.5% smaller than gzip -9 on the UI bundle (main chunk 0.96 MiB vs 1.47 MiB). Quality 11 saves only 2% more and takes 3x longer. - It now uses every available core and starts with the largest files: 7 s for .br and .gz together on 6 cores, against 25 s for quality 11 on the default 4 libuv threads. - web-ui serves .br when the client accepts it and .gz otherwise. The server's order wins, because browsers list gzip before br. * Ignore stale pre-compressed copies and warn when there are none - web-ui skips a .br/.gz copy that is older than its original or has no original. Otherwise a file edited after the build, such as a customized locale, would keep being served from its old copy. - Log a warning when the web folder has no pre-compressed files at all, for example a UI built without "yarn run compress". - compress-build.js runs at most 8 threads. - Shorter comments; the pom comment duplicated the script header. * Respect Accept-Encoding q-values and detect edited originals by size - Pick the encoding with negotiator (already in the tree through express, now a direct dependency). The highest q wins as RFC 9110 says, and the server's br-first order only breaks ties. Before, "gzip;q=1, br;q=0.1" still got br. - Check a copy against the uncompressed size gzip stores in its trailer instead of comparing mtimes. Touching or copying the build without preserving timestamps no longer disables compression, and a customized file of a different size still gets served fresh. * Trust pre-compressed copies as built, like nginx, Caddy and Fastify do The web folder is a build artifact that is not edited by hand, so checking copies against their originals at startup only added code. * Load negotiator.d.ts in yarn start and start-prod ts-node only compiles files that are imported, so it ignored the ambient declaration and failed with TS7016. tsc, the Docker image and production were not affected. --- msa/web-ui/negotiator.d.ts | 12 ++++ msa/web-ui/package.json | 3 +- msa/web-ui/server.ts | 76 +++++++++++++++++++++++++- msa/web-ui/tsconfig.json | 5 +- msa/web-ui/yarn.lock | 68 ++--------------------- ui-ngx/compress-build.js | 82 ++++++++++++++++++++++++++++ ui-ngx/esbuild/tb-esbuild-plugins.ts | 47 +--------------- ui-ngx/package.json | 1 + ui-ngx/pom.xml | 9 +++ 9 files changed, 191 insertions(+), 112 deletions(-) create mode 100644 msa/web-ui/negotiator.d.ts create mode 100644 ui-ngx/compress-build.js diff --git a/msa/web-ui/negotiator.d.ts b/msa/web-ui/negotiator.d.ts new file mode 100644 index 0000000000..ffbc4fbf39 --- /dev/null +++ b/msa/web-ui/negotiator.d.ts @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright The Thingsboard Authors +// SPDX-License-Identifier: Apache-2.0 + +// negotiator 1.x ships no types, and @types/negotiator (0.6) lacks the `preferred` option +declare module 'negotiator' { + import { IncomingMessage } from 'http'; + + export default class Negotiator { + constructor(request: IncomingMessage); + encoding(available: string[], options?: { preferred?: string[] }): string | undefined; + } +} diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index b29f93d68c..51df2e9de3 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -13,17 +13,16 @@ "build": "tsc" }, "dependencies": { - "compression": "^1.8.2", "config": "^4.4.2", "connect-history-api-fallback": "^2.0.0", "express": "^5.3.0", "http-proxy": "^1.18.1", "js-yaml": "^4.3.2", + "negotiator": "^1.1.0", "winston": "^3.19.0", "winston-daily-rotate-file": "^5.0.0" }, "devDependencies": { - "@types/compression": "^1.8.1", "@types/connect-history-api-fallback": "1.5.4", "@types/express": "~5.0.6", "@types/http-proxy": "^1.17.17", diff --git a/msa/web-ui/server.ts b/msa/web-ui/server.ts index 4a84a03907..ee856b6a0e 100644 --- a/msa/web-ui/server.ts +++ b/msa/web-ui/server.ts @@ -6,9 +6,10 @@ import { _logger} from './config/logger'; import path from 'path'; import http, { ServerResponse } from 'http'; import httpProxy from 'http-proxy'; -import compression from 'compression'; +import fs from 'fs'; import historyApiFallback from 'connect-history-api-fallback'; import { Socket } from 'net'; +import Negotiator from 'negotiator'; import { RequestHandler } from 'express'; const logger = _logger('main'); @@ -16,6 +17,18 @@ const logger = _logger('main'); let server: http.Server | null; let connections: Socket[] = []; +// in server preference order; must match the encoders in ui-ngx/compress-build.js +const precompressedEncodings = [ + {encoding: 'br', ext: '.br'}, + {encoding: 'gzip', ext: '.gz'} +]; + +interface PrecompressedVariant { + encoding: string; + ext: string; + files: Set; +} + (async() => { try { logger.info('Starting ThingsBoard Web UI Microservice...'); @@ -112,10 +125,18 @@ let connections: Socket[] = []; } app.use(historyApiFallback()); - app.use(compression()); const root = path.join(webDir, 'public'); + // No per-request compression: zlib/brotli fragment native memory that glibc never returns, until OOM + const variants = listPrecompressedFiles(root); + if (variants.some(({files}) => files.size)) { + logger.info('Pre-compressed files: %s', variants.map(({encoding, files}) => `${encoding} ${files.size}`).join(', ')); + } else { + logger.warn('No pre-compressed (.br/.gz) UI files in %s: UI files are served uncompressed', root); + } + app.use(precompressedStatic(root, variants)); + const staticServe = express.static(root); const indexHtmlFallback: RequestHandler = (req, res, next) => { @@ -162,6 +183,57 @@ process.on('exit', async (code: number) => { logger.info(`ThingsBoard Web UI Microservice has been stopped. Exit code: ${code}.`); }); +function listPrecompressedFiles(root: string): PrecompressedVariant[] { + const variants = precompressedEncodings.map(encoding => ({...encoding, files: new Set()})); + if (fs.existsSync(root)) { + for (const file of fs.readdirSync(root, {recursive: true, encoding: 'utf8'})) { + const variant = variants.find(({ext}) => file.endsWith(ext)); + variant?.files.add('/' + file.slice(0, -variant.ext.length).split(path.sep).join('/')); + } + } + return variants; +} + +function precompressedStatic(root: string, variants: PrecompressedVariant[]): RequestHandler { + return (req, res, next) => { + if (req.method !== 'GET' && req.method !== 'HEAD') { + return next(); + } + let filePath: string; + try { + filePath = decodeURIComponent(req.path); + } catch { + return next(); + } + const available = variants.filter(({files}) => files.has(filePath)); + if (!available.length) { + return next(); + } + res.vary('Accept-Encoding'); + // highest q wins; on a tie the server's order does, as browsers list gzip before br + const encodings = available.map(({encoding}) => encoding); + const best = new Negotiator(req).encoding([...encodings, 'identity'], {preferred: encodings}); + const variant = available.find(({encoding}) => encoding === best); + if (!variant) { + return next(); + } + res.setHeader('Content-Encoding', variant.encoding); + res.type(path.extname(filePath)); + res.sendFile(filePath + variant.ext, {root}, (err?: NodeJS.ErrnoException & { status?: number }) => { + // the client went away; express.static ignores these too + if (!err || err.code === 'ECONNABORTED' || err.syscall === 'write') { + return; + } + if (res.headersSent) { + return next(err); + } + res.removeHeader('Content-Encoding'); + // the copy was removed after startup: fall through to the original + next(err.status === 404 ? undefined : err); + }); + }; +} + async function exit(status: number) { logger.info('Exiting with status: %d ...', status); if (server) { diff --git a/msa/web-ui/tsconfig.json b/msa/web-ui/tsconfig.json index b633ffc768..2b3cfdf7e5 100644 --- a/msa/web-ui/tsconfig.json +++ b/msa/web-ui/tsconfig.json @@ -9,5 +9,8 @@ "skipLibCheck": true, "strictPropertyInitialization": false }, - "exclude": ["node_modules", "target"] + "exclude": ["node_modules", "target"], + "ts-node": { + "files": true + } } diff --git a/msa/web-ui/yarn.lock b/msa/web-ui/yarn.lock index b438733025..7be1378496 100644 --- a/msa/web-ui/yarn.lock +++ b/msa/web-ui/yarn.lock @@ -312,14 +312,6 @@ "@types/connect" "*" "@types/node" "*" -"@types/compression@^1.8.1": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@types/compression/-/compression-1.8.1.tgz#57cd1a5c0c585aca56124ab4daef1d254d6f5a7d" - integrity sha512-kCFuWS0ebDbmxs0AXYn6e2r2nrGAb5KwQhknjSPSPgJcGd8+HVSILlUyFhGqML2gk39HcG7D1ydW9/qpYkN00Q== - dependencies: - "@types/express" "*" - "@types/node" "*" - "@types/connect-history-api-fallback@1.5.4": version "1.5.4" resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz#7de71645a103056b48ac3ce07b3520b819c1d5b3" @@ -345,7 +337,7 @@ "@types/range-parser" "*" "@types/send" "*" -"@types/express@*", "@types/express@~5.0.6": +"@types/express@~5.0.6": version "5.0.6" resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.6.tgz#2d724b2c990dcb8c8444063f3580a903f6d500cc" integrity sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA== @@ -578,7 +570,7 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" -bytes@3.1.2, bytes@^3.1.2, bytes@~3.1.2: +bytes@^3.1.2, bytes@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== @@ -662,27 +654,6 @@ commander@^9.4.0: resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== -compressible@~2.0.18: - version "2.0.18" - resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" - integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg== - dependencies: - mime-db ">= 1.43.0 < 2" - -compression@^1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/compression/-/compression-1.8.2.tgz#781397127ae2da00c0c5f7c76bda5b2a9b32a49f" - integrity sha512-o8vI5RE5A6EVVOd9o41jKp41aJom+QTEO/Bx8MYNjexMo/Bv2WOjUfZr+aL0WnYSgymUy6zeguqLTsIhV0gMvQ== - dependencies: - bytes "3.1.2" - compressible "~2.0.18" - debug "2.6.9" - destroy "1.2.0" - negotiator "~0.6.4" - on-headers "~1.1.0" - safe-buffer "5.2.1" - vary "~1.1.2" - config@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/config/-/config-4.4.2.tgz#adab67a87fcb5f84edcacb3f159ccdb31ad8b901" @@ -725,13 +696,6 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -debug@2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@^4.3.1, debug@^4.4.0, debug@^4.4.3: version "4.4.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" @@ -756,11 +720,6 @@ depd@^2.0.0, depd@~2.0.0: resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - detect-libc@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad" @@ -1214,7 +1173,7 @@ merge-descriptors@^2.0.0: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz#ea922f660635a2249ee565e0449f951e6b603808" integrity sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g== -"mime-db@>= 1.43.0 < 2", mime-db@^1.54.0: +mime-db@^1.54.0: version "1.54.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== @@ -1258,11 +1217,6 @@ moment@^2.29.1: resolved "https://registry.yarnpkg.com/moment/-/moment-2.31.0.tgz#6e19184e8005a9dfc61c9351263d4d6ea2ace7aa" integrity sha512-0acOTfMiWOheYS4eoWb80yYMb/JLvVv9SHbs2PehaDzfUG0Bw855SKyk0IKTnPGa5+U2bmi3W68l1+sGLX/pvw== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" @@ -1281,18 +1235,13 @@ napi-build-utils@^2.0.0: resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-2.0.0.tgz#13c22c0187fcfccce1461844136372a47ddc027e" integrity sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA== -negotiator@^1.0.0: +negotiator@^1.0.0, negotiator@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.1.0.tgz#16e003d0db4ac24fd9df168edf871625deeae3df" integrity sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg== dependencies: content-type "^2.1.0" -negotiator@~0.6.4: - version "0.6.4" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.4.tgz#777948e2452651c570b712dd01c23e262713fff7" - integrity sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w== - node-abi@^3.3.0: version "3.100.0" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.100.0.tgz#31aa9623841051d14f52415557e18101bc0de7ca" @@ -1322,11 +1271,6 @@ on-finished@^2.4.1: dependencies: ee-first "1.1.1" -on-headers@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.1.0.tgz#59da4f91c45f5f989c6e4bcedc5a3b0aed70ff65" - integrity sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A== - once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -1508,7 +1452,7 @@ router@^2.2.0: parseurl "^1.3.3" path-to-regexp "^8.0.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -1861,7 +1805,7 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== -vary@^1.1.2, vary@~1.1.2: +vary@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== diff --git a/ui-ngx/compress-build.js b/ui-ngx/compress-build.js new file mode 100644 index 0000000000..526a214b41 --- /dev/null +++ b/ui-ngx/compress-build.js @@ -0,0 +1,82 @@ +// SPDX-FileCopyrightText: Copyright The Thingsboard Authors +// SPDX-License-Identifier: Apache-2.0 + +// Writes .br and .gz copies of the production build's files, served as-is by the monolith and msa/web-ui. +// Not an esbuild plugin: Angular gives custom plugins only the browser code bundle, not polyfills, +// global styles/scripts or copied assets. + +const os = require('node:os'); + +// zlib runs on the libuv thread pool (4 threads by default), which must be sized before its first use. +// More than 8 threads gains nothing: the largest chunk alone takes ~5 s. +const concurrency = Math.min(os.availableParallelism(), 8); +process.env.UV_THREADPOOL_SIZE = String(concurrency); + +const fs = require('node:fs'); +const path = require('node:path'); +const { promisify } = require('node:util'); +const zlib = require('node:zlib'); + +const gzip = promisify(zlib.gzip); +const brotliCompress = promisify(zlib.brotliCompress); + +const buildDir = path.join(__dirname, 'target', 'generated-resources', 'public'); +// already-compressed formats (png, webp, woff2, ...) are left out +const compressibleExtensions = new Set(['.js', '.mjs', '.css', '.html', '.json', '.svg', '.txt', '.md', '.ttf', '.otf', '.eot']); +const minSize = 10240; + +// brotli quality 11 is only ~2% smaller than 10 but 3x slower; must match precompressedEncodings in msa/web-ui +const encoders = [ + { + ext: '.br', + encode: content => brotliCompress(content, { + params: { + [zlib.constants.BROTLI_PARAM_QUALITY]: 10, + [zlib.constants.BROTLI_PARAM_SIZE_HINT]: content.length + } + }) + }, + { + ext: '.gz', + encode: content => gzip(content, { level: zlib.constants.Z_BEST_COMPRESSION }) + } +]; + +function listFiles(dir) { + return fs.readdirSync(dir, { recursive: true, withFileTypes: true }) + .filter(entry => entry.isFile()) + .map(entry => path.join(entry.parentPath, entry.name)); +} + +async function compress(file, { ext, encode }) { + const content = await fs.promises.readFile(file); + const compressed = await encode(content); + if (compressed.length < content.length) { + await fs.promises.writeFile(file + ext, compressed); + } +} + +async function main() { + // largest first, so the main chunk does not start last + const files = listFiles(buildDir) + .map(file => ({ file, size: fs.statSync(file).size })) + .filter(({ file, size }) => compressibleExtensions.has(path.extname(file).toLowerCase()) && size >= minSize) + .sort((a, b) => b.size - a.size) + .map(({ file }) => file); + const jobs = files.flatMap(file => encoders.map(encoder => () => compress(file, encoder))); + let next = 0; + const worker = async () => { + while (next < jobs.length) { + await jobs[next++](); + } + }; + const start = Date.now(); + await Promise.all(Array.from({ length: concurrency }, worker)); + console.log(`Compressed ${files.length} files (${encoders.map(e => e.ext).join(', ')}) in ${path.relative(__dirname, buildDir)} ` + + `in ${((Date.now() - start) / 1000).toFixed(1)} s on ${concurrency} threads`); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/ui-ngx/esbuild/tb-esbuild-plugins.ts b/ui-ngx/esbuild/tb-esbuild-plugins.ts index cacd2db7d7..db0f448d69 100644 --- a/ui-ngx/esbuild/tb-esbuild-plugins.ts +++ b/ui-ngx/esbuild/tb-esbuild-plugins.ts @@ -1,10 +1,8 @@ // SPDX-FileCopyrightText: Copyright The Thingsboard Authors // SPDX-License-Identifier: Apache-2.0 -import type { Plugin, PluginBuild, OutputFile } from 'esbuild'; +import type { Plugin, PluginBuild } from 'esbuild'; import dirTree from 'directory-tree'; import * as packageJson from '../package.json'; -import { gzip } from 'node:zlib'; -import * as path from 'node:path'; const defineTbVariablesPlugin: Plugin = { name: 'tb-define-variables', @@ -36,47 +34,6 @@ const resolveJQueryPlugin: Plugin = { } }; -const compressFileTypes = ['.js', '.css', '.html', '.svg', '.png', '.jpg', '.ttf', '.gif', '.woff', '.woff2', '.eot', '.json']; -const compressThreshold = 10240; - -const compressorPlugin: Plugin = { - name: 'tb-compressor-plugin', - setup(build) { - build.onEnd(async result => { - if (!result.outputFiles || !isProduction()) return; - const outputExt = '.gz'; - const gzippedFiles: OutputFile[] = []; - for (const file of result.outputFiles) { - if (!compressFileTypes.some((ext) => ext === path.extname(file.path))) continue; - if (file.contents.byteLength <= compressThreshold) continue; - const compressedContent = await gzipContent(file.contents); - const compressedFilePath = `${file.path}${outputExt}`; - gzippedFiles.push( - { - path: compressedFilePath, - hash: file.hash, - contents: new Uint8Array(compressedContent), - text: '', - } - ); - } - result.outputFiles.push(...gzippedFiles); - }); - }, -}; - -async function gzipContent(content): Promise { - return new Promise((resolve, reject) => { - gzip(content, (error, result) => { - if (error) { - reject(error); - } else { - resolve(result); - } - }); - }); -} - function isProduction(): boolean { const configurationIndex = process.argv.indexOf('--configuration'); let production = false; @@ -87,4 +44,4 @@ function isProduction(): boolean { return production; } -export default [defineTbVariablesPlugin, resolveJQueryPlugin, compressorPlugin]; +export default [defineTbVariablesPlugin, resolveJQueryPlugin]; diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 796daa00f9..7a823281b8 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -6,6 +6,7 @@ "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --configuration development --host 0.0.0.0 --open", "build": "ng build", "build:prod": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production", + "compress": "node compress-build.js", "build:types": "node generate-types.js", "build:icon-metadata": "node generate-icon-metadata.js", "lint": "ng lint", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index d0d5487d9a..a4ba316651 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -109,6 +109,15 @@ --mutex network run build:prod + + yarn compress + + yarn + + + run compress + + From b8570c4fff1c6fa7ec3da3cb4a6b6d78c5419512 Mon Sep 17 00:00:00 2001 From: Shvaika Dmytro Date: Mon, 16 Nov 2026 16:58:55 +0200 Subject: [PATCH 09/16] IoT Hub install form: a field with a hint grows with it, so a long hint does not overflow its section (#16689) --- .../install-form-renderer.component.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html index 3d4b515a28..fcf1625c81 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html @@ -93,7 +93,7 @@
} @case (FormFieldType.SELECT) { - {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} @@ -110,7 +110,7 @@ } @case (FormFieldType.STRING_AUTOCOMPLETE) { - {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} } @case (FormFieldType.PASSWORD) { - {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} } @case (FormFieldType.INTEGER) { - {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} } @default { - {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} Date: Mon, 16 Nov 2026 16:44:05 +0100 Subject: [PATCH 10/16] Fixed dashboard "Upload new version" accepting invalid files and losing images and entity aliases (#16700) * Fixed dashboard "Upload new version" silently ignoring invalid dashboard file * PR comments fixes * Additional fix * Standardized Cancel and Discard --- .../home/dialogs/home-dialogs.service.ts | 19 ---- .../dashboard-group-config.factory.ts | 5 +- .../home/pages/dashboard/dashboard.module.ts | 4 +- .../dashboards-table-config.resolver.ts | 5 +- ...mport-dashboard-file-dialog.component.html | 50 --------- .../import-dashboard-file-dialog.component.ts | 85 --------------- .../import-export/import-export.service.ts | 102 ++++++++++-------- 7 files changed, 68 insertions(+), 202 deletions(-) delete mode 100644 ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.html delete mode 100644 ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts diff --git a/ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts b/ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts index dfeb9a9669..b9e968bc0b 100644 --- a/ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts +++ b/ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts @@ -36,11 +36,6 @@ import { EntityGroupWizardDialogData, EntityGroupWizardDialogResult } from '@home/components/wizard/entity-group-wizard-dialog.component'; -import { DashboardInfo } from '@shared/models/dashboard.models'; -import { - DashboardInfoDialogData, - ImportDashboardFileDialogComponent -} from '@home/pages/dashboard/import-dashboard-file-dialog.component'; @Injectable() export class HomeDialogsService { @@ -141,20 +136,6 @@ export class HomeDialogsService { }).afterClosed(); } - public importDashboardFile($event: Event, dashboard: DashboardInfo): Observable { - if ($event) { - $event.stopPropagation(); - } - return this.dialog.open(ImportDashboardFileDialogComponent, { - disableClose: true, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], - data: { - dashboard - } - }).afterClosed(); - } - public selectOwner($event: Event, selectOwnerTitle: string, confirmSelectTitle: string, placeholderText: string, notFoundText: string, requiredText: string, onOwnerSelected?: (targetOwnerId: EntityId) => Observable, diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-group-config.factory.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-group-config.factory.ts index ec56f4b220..4b6e7a93f0 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-group-config.factory.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-group-config.factory.ts @@ -254,7 +254,10 @@ export class DashboardGroupConfigFactory implements EntityGroupStateConfigFactor } importDashboardFile($event: Event, dashboard: DashboardInfo, config: GroupEntityTableConfig) { - this.homeDialogs.importDashboardFile($event, dashboard).subscribe( + if ($event) { + $event.stopPropagation(); + } + this.importExport.importDashboardVersion(dashboard, this.editMissingAliases.bind(this)).subscribe( (res) => { if (res) { config.updateData(); diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard.module.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard.module.ts index 10c0b1b2f5..4388b15cf5 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard.module.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard.module.ts @@ -12,14 +12,12 @@ import { DASHBOARD_GROUP_CONFIG_FACTORY } from '@home/models/group/group-entitie import { DashboardGroupConfigFactory } from '@home/pages/dashboard/dashboard-group-config.factory'; import { DashboardRoutingModule } from '@home/pages/dashboard/dashboard-routing.module'; import { DashboardTableHeaderComponent } from '@home/pages/dashboard/dashboard-table-header.component'; -import { ImportDashboardFileDialogComponent } from "@home/pages/dashboard/import-dashboard-file-dialog.component"; @NgModule({ declarations: [ DashboardFormComponent, DashboardTableHeaderComponent, - PublicDashboardLinkDialogComponent, - ImportDashboardFileDialogComponent + PublicDashboardLinkDialogComponent ], imports: [ CommonModule, diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts index 2432a7bbea..c63b23a9ce 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts @@ -286,7 +286,10 @@ export class DashboardsTableConfigResolver { } importDashboardFile($event: Event, dashboard: DashboardInfo, config: EntityTableConfig) { - this.homeDialogs.importDashboardFile($event, dashboard).subscribe( + if ($event) { + $event.stopPropagation(); + } + this.importExport.importDashboardVersion(dashboard, this.editMissingAliases.bind(this)).subscribe( (res) => { if (res) { config.updateData(); diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.html deleted file mode 100644 index 298014fa74..0000000000 --- a/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.html +++ /dev/null @@ -1,50 +0,0 @@ - -
- -

{{ 'dashboard.update-new-version' | translate }}

- - -
- @if (isLoading$ | async) { - - - } @else { -
- } -
- - -
- -
- - -
-
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts deleted file mode 100644 index ecad7891dd..0000000000 --- a/ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. -// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 -import { Component, Inject, OnInit } from '@angular/core'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { Store } from '@ngrx/store'; -import { AppState } from '@core/core.state'; -import { FormBuilder, FormGroup } from '@angular/forms'; -import { DashboardService } from '@core/http/dashboard.service'; -import { DashboardInfo } from '@app/shared/models/dashboard.models'; -import { ActionNotificationShow } from '@core/notification/notification.actions'; -import { DialogComponent } from '@shared/components/dialog.component'; -import { Router } from '@angular/router'; -import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http'; - -export interface DashboardInfoDialogData { - dashboard: DashboardInfo; -} - -@Component({ - selector: 'tb-import-dashboard-file-dialog', - templateUrl: './import-dashboard-file-dialog.component.html', - styleUrls: [], - standalone: false -}) -export class ImportDashboardFileDialogComponent extends DialogComponent implements OnInit { - - private dashboard: DashboardInfo; - currentFileName: string = ''; - uploadFileFormGroup: FormGroup; - - constructor(protected store: Store, - protected router: Router, - @Inject(MAT_DIALOG_DATA) public data: DashboardInfoDialogData, - private dashboardService: DashboardService, - protected dialogRef: MatDialogRef, - private fb: FormBuilder) { - super(store, router, dialogRef); - this.dashboard = data.dashboard; - } - - ngOnInit(): void { - this.uploadFileFormGroup = this.fb.group({ - file: [null] - }); - } - - cancel(): void { - this.dialogRef.close(); - } - - save() { - const fileControl = this.uploadFileFormGroup.get('file'); - if (!fileControl || !fileControl.value) { - return; - } - - const dashboard: DashboardInfo = { - ...this.dashboard, - configuration: { - ...fileControl.value, - description: this.dashboard.configuration.description - } - }; - - this.dashboardService.saveDashboard(dashboard).subscribe({ - next: () => this.dialogRef.close(true), - error: (err: HttpErrorResponse) => { - if (err.status === HttpStatusCode.Conflict) { - this.dialogRef.close(true); - } - } - }); - } - - loadDataFromJsonContent(content: string): any { - try { - const importData = JSON.parse(content); - return importData ? importData['configuration'] : importData; - } catch (err) { - this.store.dispatch(new ActionNotificationShow({message: err.message, type: 'error'})); - return null; - } - } -} diff --git a/ui-ngx/src/app/shared/import-export/import-export.service.ts b/ui-ngx/src/app/shared/import-export/import-export.service.ts index 38b4ab0ce4..888a267071 100644 --- a/ui-ngx/src/app/shared/import-export/import-export.service.ts +++ b/ui-ngx/src/app/shared/import-export/import-export.service.ts @@ -7,9 +7,9 @@ import { TranslateService } from '@ngx-translate/core'; import { select, Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { ActionNotificationShow } from '@core/notification/notification.actions'; -import { BreakpointId, Dashboard, DashboardLayoutId } from '@shared/models/dashboard.models'; +import { BreakpointId, Dashboard, DashboardInfo, DashboardLayoutId } from '@shared/models/dashboard.models'; import { DatePipe } from '@angular/common'; -import { deepClone, guid, isDate, isDefined, isNotEmptyStr, isNumber, isObject, isString, isUndefined, unwrapModule } from '@core/utils'; +import { deepClone, guid, isDate, isDefined, isNotEmptyStr, isObject, isString, isUndefined, unwrapModule } from '@core/utils'; import { AliasesInfo, @@ -22,7 +22,8 @@ import { import { MatDialog } from '@angular/material/dialog'; import { ImportDialogComponent, ImportDialogData } from '@shared/import-export/import-dialog.component'; import { forkJoin, Observable, of, Subject } from 'rxjs'; -import { catchError, map, mergeMap, switchMap, take, tap } from 'rxjs/operators'; +import { catchError, defaultIfEmpty, map, mergeMap, switchMap, take, tap } from 'rxjs/operators'; +import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http'; import { DashboardUtilsService } from '@core/services/dashboard-utils.service'; import { EntityService } from '@core/http/entity.service'; import { ExportRow, Widget, WidgetActionsMap, WidgetActionType, WidgetSize, WidgetTypeDetails } from '@shared/models/widget.models'; @@ -266,48 +267,33 @@ export class ImportExportService { onEditMissingAliases: editMissingAliasesFunction, entityGroupId?: string): Observable { return this.openImportDialog('dashboard.import', 'dashboard.dashboard-file').pipe( mergeMap((dashboard: Dashboard) => { - if (!this.validateImportedDashboard(dashboard)) { - this.store.dispatch(new ActionNotificationShow( - {message: this.translate.instant('dashboard.invalid-dashboard-file-error'), - type: 'error'})); - throw new Error('Invalid dashboard file'); - } else { - dashboard = this.prepareImport(dashboard); - dashboard = this.dashboardUtils.validateAndUpdateDashboard(dashboard); - dashboard.customerId = customerId; - let aliasIds = null; - const entityAliases = dashboard.configuration.entityAliases; - if (entityAliases) { - aliasIds = Object.keys(entityAliases); - } - if (aliasIds && aliasIds.length > 0) { - return this.processEntityAliases(entityAliases, aliasIds).pipe( - mergeMap((missingEntityAliases) => { - if (Object.keys(missingEntityAliases).length > 0) { - return onEditMissingAliases(this.dashboardUtils.getWidgetsArray(dashboard), - false, 'dashboard.dashboard-import-missing-aliases-title', - missingEntityAliases).pipe( - mergeMap((updatedEntityAliases) => { - for (const aliasId of Object.keys(updatedEntityAliases)) { - entityAliases[aliasId] = updatedEntityAliases[aliasId]; - } - return this.saveImportedDashboard(dashboard, entityGroupId); - }) - ); - } else { - return this.saveImportedDashboard(dashboard, entityGroupId); - } - } - )); - } else { - return this.saveImportedDashboard(dashboard, entityGroupId); - } - } + dashboard = this.prepareImportedDashboard(dashboard); + dashboard.customerId = customerId; + return this.resolveMissingAliases(dashboard, onEditMissingAliases); }), + mergeMap((dashboard) => this.saveImportedDashboard(dashboard, entityGroupId)), catchError(() => of(null)) ); } + public importDashboardVersion(dashboard: DashboardInfo, + onEditMissingAliases: editMissingAliasesFunction): Observable { + return this.openImportDialog('dashboard.update-new-version', 'dashboard.upload-file-to-update').pipe( + mergeMap((imported: Dashboard) => + this.resolveMissingAliases(this.prepareImportedDashboard(imported), onEditMissingAliases)), + mergeMap((imported) => this.dashboardService.saveDashboard({ + ...dashboard, + configuration: {...imported.configuration, description: dashboard.configuration?.description}, + resources: imported.resources + }).pipe( + map(() => true), + defaultIfEmpty(true), + catchError((err) => of(err instanceof HttpErrorResponse && err.status === HttpStatusCode.Conflict)) + )), + catchError(() => of(false)) + ); + } + public exportWidget(dashboard: Dashboard, sourceState: string, sourceLayout: DashboardLayoutId, widget: Widget, widgetTitle: string, breakpoint: BreakpointId) { const widgetItem = this.itembuffer.prepareWidgetItem(dashboard, sourceState, sourceLayout, widget, breakpoint); @@ -1315,10 +1301,40 @@ export class ImportExportService { } private validateImportedDashboard(dashboard: Dashboard): boolean { - if (isUndefined(dashboard.title) || isUndefined(dashboard.configuration)) { - return false; + return isObject(dashboard) && !Array.isArray(dashboard) && isDefined(dashboard.title) + && isObject(dashboard.configuration) && !Array.isArray(dashboard.configuration); + } + + private prepareImportedDashboard(dashboard: Dashboard): Dashboard { + if (!this.validateImportedDashboard(dashboard)) { + this.store.dispatch(new ActionNotificationShow( + {message: this.translate.instant('dashboard.invalid-dashboard-file-error'), + type: 'error'})); + throw new Error('Invalid dashboard file'); } - return true; + return this.dashboardUtils.validateAndUpdateDashboard(this.prepareImport(dashboard)); + } + + private resolveMissingAliases(dashboard: Dashboard, onEditMissingAliases: editMissingAliasesFunction): Observable { + const entityAliases = dashboard.configuration.entityAliases; + const aliasIds = entityAliases ? Object.keys(entityAliases) : []; + if (!aliasIds.length) { + return of(dashboard); + } + return this.processEntityAliases(entityAliases, aliasIds).pipe( + mergeMap((missingEntityAliases) => { + if (!Object.keys(missingEntityAliases).length) { + return of(dashboard); + } + return onEditMissingAliases(this.dashboardUtils.getWidgetsArray(dashboard), + false, 'dashboard.dashboard-import-missing-aliases-title', missingEntityAliases).pipe( + map((updatedEntityAliases) => { + Object.assign(entityAliases, updatedEntityAliases); + return dashboard; + }) + ); + }) + ); } private validateImportedWidget(widgetItem: WidgetItem): boolean { From fa41056a7bba0ade6909b1202ee4c562c285c884 Mon Sep 17 00:00:00 2001 From: dshvaika Date: Tue, 17 Nov 2026 10:45:27 +0200 Subject: [PATCH 11/16] IoT Hub tests: converters in the fixtures belong to the tenant Real converters always have a tenant id. The converter fixtures of DefaultIotHubServiceTest now set it, as the integration fixture already does. --- .../server/service/iot_hub/DefaultIotHubServiceTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java index a81368450c..27a75dbcd4 100644 --- a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java @@ -467,6 +467,7 @@ class DefaultIotHubServiceTest { profile.setDefaultDashboardId(dashboard.getId()); Integration integration = new Integration(new IntegrationId(UUID.randomUUID())); Converter converter = new Converter(new ConverterId(UUID.randomUUID())); + converter.setTenantId(tenantId); // The profile and the integration listed first: in reverse order of creation, the dashboard would go before the // profile that refers to it, and the converter before the integration that uses it. IotHubInstalledItem deleted = devicePackage(profile.getId(), dashboard.getId(), integration.getId(), converter.getId()); @@ -604,6 +605,7 @@ class DefaultIotHubServiceTest { mockTenant(); IntegrationId integrationId = new IntegrationId(UUID.randomUUID()); Converter converter = new Converter(new ConverterId(UUID.randomUUID())); + converter.setTenantId(tenantId); when(converterService.findConverterById(tenantId, converter.getId())).thenReturn(converter); IotHubInstalledItem deleted = devicePackage(converter.getId(), integrationId); // The converter and the integration steps shared the name: the integration's state replaced the converter's From 0a6814176c06c3b4bf4021ad0d21452b975b1833 Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Tue, 17 Nov 2026 10:09:15 +0100 Subject: [PATCH 12/16] Merge pull request #16661 from dskarzh/fix/web-report-chromium-snapshot Updated web report to use open source Chromium instead of Chrome for Testing --- msa/web-report/chromium.js | 36 +++++ msa/web-report/docker/Dockerfile | 13 +- msa/web-report/docker/start-web-report.sh | 2 - msa/web-report/install.js | 147 +++++++++++++++--- msa/web-report/package.json | 1 - msa/web-report/pom.xml | 64 ++------ msa/web-report/sbom-check.js | 19 +-- msa/web-report/server.ts | 3 +- msa/web-report/yarn.lock | 9 +- .../python/license-headers/curations.json | 2 +- 10 files changed, 182 insertions(+), 114 deletions(-) create mode 100644 msa/web-report/chromium.js diff --git a/msa/web-report/chromium.js b/msa/web-report/chromium.js new file mode 100644 index 0000000000..cd9acc9f14 --- /dev/null +++ b/msa/web-report/chromium.js @@ -0,0 +1,36 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// The Chromium builds shipped with the packages. They must be the Chromium release that playwright-core is released with, +// which install.js checks, so a Playwright upgrade needs new builds here. The Docker image has the chromium package of +// Debian instead: see docker/Dockerfile. +// +// The Chromium project publishes builds of the main branch only, so these are the builds from where the release was +// branched off, without the fixes made on the release branch later. The Debian package of the image has those fixes. +// +// To update after a Playwright upgrade, for the version that the error of install.js names: +// 1. Find where the release was branched off: chromium_main_branch_position in +// https://chromiumdash.appspot.com/fetch_version?version= +// 2. For Linux_x64 and for Win_x64, take the highest snapshot build that is not above that position. Builds are listed by +// the start of their number, so shorten the start until one appears: +// https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o?delimiter=/&fields=prefixes&prefix=Linux_x64/ +// 3. Set the version (the release from the error, ending in .0) and the two paths, and build the module. It fails with +// the SHA-256 of an archive: put it in the sha256 of that platform and build again, until both pass. +// install.js also fails if an unpacked build is not the version set here. +module.exports = { + // The packages: snapshot builds of the open source code, published by the Chromium project. + // exclude: glob patterns of the files that are not packaged + // strip: glob patterns of the executables to strip of their symbols, when GNU strip is installed + snapshot: { + version: '156.0.8078.0', + baseUrl: 'https://commondatastorage.googleapis.com/chromium-browser-snapshots', + // The .pak.info files, 70 MB, are left from the build of the translations; the browser does not read them + linux: { path: 'Linux_x64/1706520/chrome-linux.zip', sha256: '6b62846a868ea3ee675f77600790877a428dfb2428c940f8eff99db1038f9815', + exclude: ['locales/*.pak.info'], + // The Linux builds come with their symbols, 180 MB + strip: ['chrome', 'chrome_crashpad_handler', 'chrome_sandbox', '*.so*'] }, + // interactive_ui_tests.exe is a test program of 348 MB that the service does not need + windows: { path: 'Win_x64/1706509/chrome-win.zip', sha256: '6bdfecb33dbfa7159e5666798bdc28c76347bef913573e899cb43930b78d26cc', + exclude: ['interactive_ui_tests.exe'] } + } +}; diff --git a/msa/web-report/docker/Dockerfile b/msa/web-report/docker/Dockerfile index 9e1d9404e3..17457c153c 100644 --- a/msa/web-report/docker/Dockerfile +++ b/msa/web-report/docker/Dockerfile @@ -10,7 +10,8 @@ ARG DEBIAN_FRONTEND=noninteractive ENV NODE_ENV production ENV DOCKER_MODE true -ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright +# The browser is the chromium package of Debian, installed below +ENV CHROME_EXECUTABLE=/usr/bin/chromium COPY start-web-report.sh /tmp/ @@ -26,17 +27,13 @@ COPY src/config ./config COPY src/inspectorShim.js src/server.js ./ RUN apt-get update \ - && apt-get install -yq --no-install-recommends fonts-noto-cjk-extra fonts-roboto fonts-noto-color-emoji fonts-unifont libfreetype6 xfonts-scalable fonts-liberation \ - fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf fonts-freefont-ttf fontconfig libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 \ - libcairo2 libcups2 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libwayland-client0 libx11-6 libxcb1 libxcomposite1 \ - libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 \ + && apt-get install -yq --no-install-recommends chromium fontconfig fonts-noto-cjk-extra fonts-roboto fonts-noto-color-emoji fonts-unifont \ + xfonts-scalable fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf fonts-freefont-ttf \ && rm -rf /var/lib/apt/lists/* \ && chmod a+x /tmp/*.sh \ && mv /tmp/start-web-report.sh /usr/bin \ && chown -R node:node ${pkg.installFolder} \ - && mkdir /ms-playwright \ - && yarn install --production --non-interactive --network-concurrency 4 --network-timeout 100000 --mutex network && yarn cache clean --all \ - && chmod -R 777 /ms-playwright + && yarn install --production --non-interactive --network-concurrency 4 --network-timeout 100000 --mutex network && yarn cache clean --all USER node diff --git a/msa/web-report/docker/start-web-report.sh b/msa/web-report/docker/start-web-report.sh index 390c77e2d7..6b2a050558 100755 --- a/msa/web-report/docker/start-web-report.sh +++ b/msa/web-report/docker/start-web-report.sh @@ -14,7 +14,5 @@ source "${CONF_FOLDER}/${configfile}" cd ${pkg.installFolder} -export CHROME_EXECUTABLE=$(node -e "console.log(require('playwright-chromium').chromium.executablePath());") - # This will forward this PID 1 to the node.js and forward SIGTERM for graceful shutdown as well exec node server.js diff --git a/msa/web-report/install.js b/msa/web-report/install.js index 842978aaec..64312b6333 100644 --- a/msa/web-report/install.js +++ b/msa/web-report/install.js @@ -1,46 +1,149 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +const fs = require('fs'); const fse = require('fs-extra'); const path = require('path'); -const { execFileSync } = require('child_process'); +const crypto = require('crypto'); +const { execFile, execFileSync } = require('child_process'); +const { promisify } = require('util'); +const { Transform } = require('stream'); +const { pipeline } = require('stream/promises'); +// The helpers that Playwright downloads its browsers with: httpRequest follows HTTPS_PROXY and redirects, extractZip needs no unzip tool +const { httpRequest, extractZip } = require('playwright-core/lib/coreBundle').utils; +const { snapshot } = require('./chromium'); + +const DOWNLOAD_ATTEMPTS = 3; -// Chromium builds packaged with the service, downloaded by the Playwright CLI as if it ran on the target platform. const PLATFORMS = { - linux: { hostPlatform: 'ubuntu24.04-x64', downloadDir: 'chromiumLinux', chromeDir: 'chrome-linux64', binary: 'tb-web-report', pkgOutput: 'thingsboard-web-report-linux' }, - windows: { hostPlatform: 'win64', downloadDir: 'chromiumWin', chromeDir: 'chrome-win64', binary: 'tb-web-report.exe', pkgOutput: 'thingsboard-web-report-win.exe' } + linux: { + ...snapshot.linux, binary: 'tb-web-report', pkgOutput: 'thingsboard-web-report-linux', + // The version is written into the executable + hasVersion: dir => fileContains(path.join(dir, 'chrome'), snapshot.version) + }, + windows: { + ...snapshot.windows, binary: 'tb-web-report.exe', pkgOutput: 'thingsboard-web-report-win.exe', + hasVersion: dir => fse.pathExists(path.join(dir, `${snapshot.version}.manifest`)) + } }; (async() => { - for (const [targetDir, platform] of Object.entries(PLATFORMS)) { - const downloadDir = path.join(projectRoot(), 'target', platform.downloadDir); - installChromium(platform.hostPlatform, downloadDir); - const chromiumDir = path.join(targetPackageDir(targetDir), 'chromium'); - await fse.emptyDir(chromiumDir); - await fse.copy(path.join(downloadDir, chromiumRevisionDir(), platform.chromeDir), chromiumDir); + checkPlaywrightVersion(); + await Promise.all(Object.entries(PLATFORMS).map(async ([targetDir, platform]) => { + await installChromium(platform, path.join(projectRoot(), 'target', 'chromium-' + targetDir), + path.join(targetPackageDir(targetDir), 'chromium')); await fse.move(path.join(projectRoot(), 'target', platform.pkgOutput), path.join(targetPackageDir(targetDir), 'bin', platform.binary), {overwrite: true}); - } + })); })().catch(e => { console.error(e); process.exit(1); }); -function installChromium(hostPlatform, downloadDir) { - execFileSync(process.execPath, [path.join(path.dirname(require.resolve('playwright-core/package.json')), 'cli.js'), 'install', '--no-shell', 'chromium'], { - stdio: 'inherit', - env: { - ...process.env, - PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: hostPlatform, - PLAYWRIGHT_BROWSERS_PATH: downloadDir, - PLAYWRIGHT_SKIP_BROWSER_GC: '1' +function checkPlaywrightVersion() { + const browsers = fse.readJsonSync(path.join(path.dirname(require.resolve('playwright-core/package.json')), 'browsers.json')).browsers; + const chromium = browsers.find(browser => browser.name === 'chromium'); + if (!chromium) { + throw new Error('playwright-core/browsers.json does not list chromium'); + } + // The release is the first three numbers; the last one counts the fixes on its branch and differs between builds + const build = version => version.split('.').slice(0, 3).join('.'); + if (build(chromium.browserVersion) !== build(snapshot.version)) { + throw new Error(`playwright-core expects Chromium ${chromium.browserVersion}, the snapshot build in chromium.js is ${snapshot.version}`); + } +} + +async function installChromium(platform, downloadDir, chromiumDir) { + await fse.emptyDir(downloadDir); + const archive = path.join(downloadDir, 'chromium.zip'); + await download(`${snapshot.baseUrl}/${platform.path}`, archive, platform.sha256); + await extractZip(archive, { dir: downloadDir }); + const unpacked = path.join(downloadDir, path.basename(platform.path, '.zip')); + for await (const excluded of fs.promises.glob(platform.exclude || [], { cwd: unpacked })) { + await fse.remove(path.join(unpacked, excluded)); + } + if (platform.strip) { + await stripExecutables(unpacked, platform.strip); + } + if (!await platform.hasVersion(unpacked)) { + throw new Error(`${platform.path} is not Chromium ${snapshot.version}; check the build number in chromium.js`); + } + await fse.move(unpacked, chromiumDir, { overwrite: true }); + await fse.remove(downloadDir); +} + +// Fails unless the SHA-256 of the downloaded file is the expected one. Tries again when the connection or the server +// fails, but not for an answer such as 404, which would be the same again. +async function download(url, file, sha256) { + let actual; + for (let attempt = 1; actual === undefined; attempt++) { + try { + actual = await downloadOnce(url, file); + } catch (e) { + if (e.statusCode < 500 || attempt === DOWNLOAD_ATTEMPTS) { + throw e; + } + console.warn(`${e.message}; trying again`); } + } + if (actual !== sha256) { + throw new Error(`${url} has SHA-256 ${actual}, expected ${sha256}`); + } +} + +// Writes the file while it is downloaded, and gives its SHA-256 +function downloadOnce(url, file) { + return new Promise((resolve, reject) => { + const fail = (reason, statusCode) => reject(Object.assign(new Error(`Cannot download ${url}: ${reason}`), { statusCode })); + httpRequest({ url, socketTimeout: 60000 }, response => { + if (response.statusCode !== 200) { + response.resume(); + fail(`HTTP ${response.statusCode}`, response.statusCode); + return; + } + const hash = crypto.createHash('sha256'); + const hashing = new Transform({ + transform(chunk, encoding, callback) { + hash.update(chunk); + callback(null, chunk); + } + }); + pipeline(response, hashing, fs.createWriteStream(file)).then(() => resolve(hash.digest('hex')), e => fail(e.message)); + }, e => fail(e.message)); }); } -function chromiumRevisionDir() { - const browsers = fse.readJsonSync(path.join(projectRoot(), 'node_modules', 'playwright-core', 'browsers.json')).browsers; - return 'chromium-' + browsers.find(b => b.name === 'chromium').revision; +// Strips the symbols with GNU strip, which reads the Linux executables on any build machine. Without it, as on macOS +// or where binutils is not installed, the executables are packaged as they are. +async function stripExecutables(dir, patterns) { + if (!hasGnuStrip()) { + console.warn('strip not found, Linux Chromium left unstripped (+~180 MB); install GNU binutils to strip it'); + return; + } + for await (const file of fs.promises.glob(patterns, { cwd: dir })) { + await promisify(execFile)('strip', ['--strip-unneeded', path.join(dir, file)]); + } +} + +function hasGnuStrip() { + try { + return execFileSync('strip', ['--version'], { encoding: 'utf8' }).includes('GNU strip'); + } catch { + return false; + } +} + +async function fileContains(file, text) { + const needle = Buffer.from(text); + let tail = Buffer.alloc(0); + for await (const chunk of fs.createReadStream(file)) { + const data = Buffer.concat([tail, chunk]); + if (data.includes(needle)) { + return true; + } + tail = data.subarray(data.length - needle.length + 1); + } + return false; } function projectRoot() { diff --git a/msa/web-report/package.json b/msa/web-report/package.json index 169548ffc0..e247cdde62 100644 --- a/msa/web-report/package.json +++ b/msa/web-report/package.json @@ -18,7 +18,6 @@ "config": "~4.4.2", "express": "~5.3.0", "js-yaml": "^4.3.2", - "playwright-chromium": "~1.64.1", "playwright-core": "~1.64.1", "winston": "~3.19.0", "winston-daily-rotate-file": "~5.0.0" diff --git a/msa/web-report/pom.xml b/msa/web-report/pom.xml index 7bba753b18..fc1264adb9 100644 --- a/msa/web-report/pom.xml +++ b/msa/web-report/pom.xml @@ -321,15 +321,16 @@ application - chrome-for-testing + chromium ${chromium.version} - Chrome for Testing build downloaded by Playwright, used to render reports. - pkg:generic/google/chrome-for-testing@${chromium.version}?os=linux + Chromium snapshot build of the Chromium project, used to render reports. + pkg:generic/chromium/chromium@${chromium.version}?os=linux cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:* + BSD-3-Clause - Google LLC + The Chromium Authors - https://googlechromelabs.github.io/chrome-for-testing/ + https://www.chromium.org ${pkg.linux.dist}/chromium/chrome @@ -340,15 +341,16 @@ application - chrome-for-testing + chromium ${chromium.version} - Chrome for Testing build downloaded by Playwright, used to render reports. - pkg:generic/google/chrome-for-testing@${chromium.version}?os=windows + Chromium snapshot build of the Chromium project, used to render reports. + pkg:generic/chromium/chromium@${chromium.version}?os=windows cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:* + BSD-3-Clause - Google LLC + The Chromium Authors - https://googlechromelabs.github.io/chrome-for-testing/ + https://www.chromium.org ${pkg.win.dist}/chromium/chrome.exe @@ -367,48 +369,6 @@ ${project.build.directory}/sbom/tb-web-report.cdx.json ${pkg.installFolder} - - application - chrome-for-testing - ${chromium.version} - Chrome for Testing build downloaded by Playwright to /ms-playwright, used to render reports. - pkg:generic/google/chrome-for-testing@${chromium.version}?os=linux&arch=@{architecture} - cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:* - - Google LLC - - https://googlechromelabs.github.io/chrome-for-testing/ - - - - - application - chrome-headless-shell - ${chromium-headless-shell.version} - Chrome Headless Shell build downloaded by Playwright to /ms-playwright. - pkg:generic/google/chrome-headless-shell@${chromium-headless-shell.version}?os=linux&arch=@{architecture} - cpe:2.3:a:google:chrome:${chromium-headless-shell.version}:*:*:*:*:*:*:* - - Google LLC - - https://googlechromelabs.github.io/chrome-for-testing/ - - - - - application - playwright-ffmpeg - ${ffmpeg.revision} - FFmpeg build by Playwright (revision ${ffmpeg.revision}), downloaded to /ms-playwright. - pkg:generic/microsoft/playwright-ffmpeg@${ffmpeg.revision}?os=linux&arch=@{architecture} - LGPL-2.1-or-later - - Microsoft Corporation - - https://playwright.dev - - - diff --git a/msa/web-report/sbom-check.js b/msa/web-report/sbom-check.js index cd4d3f76df..3f2723cea6 100644 --- a/msa/web-report/sbom-check.js +++ b/msa/web-report/sbom-check.js @@ -12,7 +12,7 @@ const BASE_BINARY = /fetched-v(\d+\.\d+\.\d+)-/; (() => { const listed = listedPackages(JSON.parse(fs.readFileSync(SBOM_FILE, 'utf8'))); - const versions = playwrightVersions(); + const versions = { 'chromium.version': require('./chromium').snapshot.version }; for (const [os, log] of Object.entries(PKG_LOGS)) { const output = fs.readFileSync(path.join(TARGET_DIR, log), 'utf8').replace(/\x1b\[[0-9;]*m/g, ''); const baseBinary = BASE_BINARY.exec(output); @@ -74,20 +74,3 @@ function packageDir(file) { } return parts.slice(0, index + (scoped ? 3 : 2)).join(path.sep); } - -function playwrightVersions() { - const browsers = JSON.parse(fs.readFileSync(path.join(path.dirname(require.resolve('playwright-core/package.json')), 'browsers.json'), 'utf8')).browsers; - const browser = name => { - const found = browsers.find(candidate => candidate.name === name); - if (!found) { - throw new Error(`playwright-core/browsers.json does not list ${name}`); - } - return found; - }; - return { - 'chromium.version': browser('chromium').browserVersion, - 'chromium-headless-shell.version': browser('chromium-headless-shell').browserVersion, - 'ffmpeg.revision': browser('ffmpeg').revision - }; -} - diff --git a/msa/web-report/server.ts b/msa/web-report/server.ts index e000c860c4..758f016cb2 100644 --- a/msa/web-report/server.ts +++ b/msa/web-report/server.ts @@ -5,8 +5,7 @@ import express from 'express'; import bodyParser from 'body-parser'; import config from 'config'; import { _logger } from './config/logger'; -import { chromium } from 'playwright-chromium'; -import { Browser, LaunchOptions } from 'playwright-core'; +import { Browser, chromium, LaunchOptions } from 'playwright-core'; import { route } from './api/routes/tbWebReportRoutes'; import { TbWebReportPageQueue } from './api/controllers/tbWebReportPageQueue'; diff --git a/msa/web-report/yarn.lock b/msa/web-report/yarn.lock index 82f160bb5d..61a026c6d0 100644 --- a/msa/web-report/yarn.lock +++ b/msa/web-report/yarn.lock @@ -1307,14 +1307,7 @@ picomatch@^4.0.2, picomatch@^4.0.4: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.7.tgz#6313360034ccb36b3dc61ecbdff78121f90fe21f" integrity sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA== -playwright-chromium@~1.64.1: - version "1.64.1" - resolved "https://registry.yarnpkg.com/playwright-chromium/-/playwright-chromium-1.64.1.tgz#81aec8925514050c0ac5bc08fa231ed189ab0e86" - integrity sha512-lvAzvvIRtbHaeLwl7XoUkhSNuWHKshbrYv2sjqYgLQS4SsTTwgSTlg9BwU5LeGxYkHxBXTnKtNDEQdZSOj/01g== - dependencies: - playwright-core "1.64.1" - -playwright-core@1.64.1, playwright-core@~1.64.1: +playwright-core@~1.64.1: version "1.64.1" resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.64.1.tgz#ca9ec82d7da6ced1b2326ec59ef097aaa9a29f94" integrity sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ== diff --git a/tools/src/main/python/license-headers/curations.json b/tools/src/main/python/license-headers/curations.json index 1087d63225..d199bfb4dd 100644 --- a/tools/src/main/python/license-headers/curations.json +++ b/tools/src/main/python/license-headers/curations.json @@ -1199,7 +1199,7 @@ "path": "msa/web-report/pom.xml", "header": "busl", "reason": "Build descriptor of the PE-only web-report module; CE has no web-report module. The only CE version is an empty file (blob e69de29bb2d) added by stray commit 2b1c5d92f3a, pushed to fix/maven-node-lts-4.3 after #16417 merged and carried into lts-4.4 via #16419; it never reached CE lts-4.3 and is not the origin of this file.", - "contentHash": "sha256:48ee3956937386c95ebb2b95a4981506203c00ce276aa6003fecfc0ddaf04218" + "contentHash": "sha256:9ddddeec7898c7232abc7b16c696fdad4f3825d15d3810369f621609f2678f65" }, { "path": "report/src/main/conf/logback.xml", From 2c09739dc15602334bb6ae599d6ca5a74a5799d5 Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 17 Nov 2026 11:12:39 +0200 Subject: [PATCH 13/16] Bump jackson-bom from 2.21.7 to 2.21.8 to fix CVE-2026-106554 and CVE-2026-110879 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7533f293f6..91ef78d2ea 100755 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ 10.1.61 5.4.3 1.5.38 - 2.21.7 + 2.21.8 42.7.14 5.34.0 5.6.4 From c4f9c6f62ff4503e7c10355af6ce765ec0656b50 Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 17 Nov 2026 11:12:48 +0200 Subject: [PATCH 14/16] Bump org.json from 20250107 to 20260719 to fix CVE-2026-59171 --- pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pom.xml b/pom.xml index 91ef78d2ea..6fc75718ff 100755 --- a/pom.xml +++ b/pom.xml @@ -80,6 +80,7 @@ 1.5.7-14 2.3.35 1.11.4 + 20260719 2.4.0-b180830.0359 0.12.5 0.10 @@ -1139,6 +1140,13 @@ ${lz4-java.version} + + + org.json + json + ${org.json.version} + + org.springframework.boot spring-boot-dependencies From e9f90dc3580c097bda34bacc37439f6295b720aa Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 17 Nov 2026 11:14:46 +0200 Subject: [PATCH 15/16] Bump jackson-bom from 2.21.7 to 2.21.8 to fix CVE-2026-106554 and CVE-2026-110879 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 334d0f4696..29189cab71 100755 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 10.1.61 5.4.3 1.5.38 - 2.21.7 + 2.21.8 42.7.14 1.11.4 5.34.0 From b126628116af8b487db1b88562044f3bfc2862ab Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 17 Nov 2026 11:14:46 +0200 Subject: [PATCH 16/16] Bump org.json from 20250517 to 20260719 to fix CVE-2026-59171 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 29189cab71..6ad01e442d 100755 --- a/pom.xml +++ b/pom.xml @@ -158,7 +158,7 @@ 8.10.1 3.5.3 0.15.12 - 20250517 + 20260719 3.1.2 1.11.4 1.12.701