From 2f579273b584bc04b2b840b477dbea43a11ddda4 Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Thu, 9 Apr 2026 17:21:22 +0300 Subject: [PATCH] refactor(iot-hub): rename connectivityTypes to installMethods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sync with IoT Hub field rename: - Enum: ConnectivityType → InstallMethod - Map: connectivityTypeTranslations → installMethodLabels - Model: DevicePackageInfo.connectivityTypes → installMethods - Descriptor: selectedConnectivity → selectedInstallMethod - All component/template/service references updated - Java descriptor and test updated --- .../DeviceInstalledItemDescriptor.java | 2 +- .../DeviceInstalledItemDescriptorTest.java | 6 ++-- .../src/app/core/http/iot-hub-api.service.ts | 2 +- .../device-install-dialog.component.html | 12 +++---- .../device-install-dialog.component.ts | 32 +++++++++---------- .../iot-hub-installed-items.component.ts | 8 ++--- .../models/iot-hub/device-package.models.ts | 30 ++++++++--------- .../iot-hub/iot-hub-installed-item.models.ts | 2 +- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java b/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java index b3bb9b7e14..e10eb65b25 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java @@ -28,7 +28,7 @@ public class DeviceInstalledItemDescriptor implements IotHubInstalledItemDescrip private List createdEntityIds; private DashboardId dashboardId; - private String selectedConnectivity; + private String selectedInstallMethod; private Map installState; } diff --git a/common/data/src/test/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptorTest.java b/common/data/src/test/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptorTest.java index 0787156fc4..a6b59995a8 100644 --- a/common/data/src/test/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptorTest.java +++ b/common/data/src/test/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptorTest.java @@ -84,7 +84,7 @@ class DeviceInstalledItemDescriptorTest { {"entityType": "DASHBOARD", "id": "8bc229f0-2e5d-11f1-a802-c35a9af2ebde"} ], "dashboardId": {"entityType": "DASHBOARD", "id": "8bc229f0-2e5d-11f1-a802-c35a9af2ebde"}, - "selectedConnectivity": "DIRECT_MQTT", + "selectedInstallMethod": "DIRECT_MQTT", "installState": { "Configuration": { "formValues": {"deviceName": "ESP32 Dev Kit", "wifiSsid": "MyWiFi", "wifiPassword": "secret"} @@ -103,7 +103,7 @@ class DeviceInstalledItemDescriptorTest { DeviceInstalledItemDescriptor descriptor = mapper.treeToValue(node, DeviceInstalledItemDescriptor.class); assertThat(descriptor).isNotNull(); - assertThat(descriptor.getSelectedConnectivity()).isEqualTo("DIRECT_MQTT"); + assertThat(descriptor.getSelectedInstallMethod()).isEqualTo("DIRECT_MQTT"); assertThat(descriptor.getInstallState()).isNotNull(); assertThat(descriptor.getInstallState()).hasSize(3); @@ -122,7 +122,7 @@ class DeviceInstalledItemDescriptorTest { String serialized = mapper.writeValueAsString(descriptor); JsonNode roundTripped = mapper.readTree(serialized); DeviceInstalledItemDescriptor deserialized = mapper.treeToValue(roundTripped, DeviceInstalledItemDescriptor.class); - assertThat(deserialized.getSelectedConnectivity()).isEqualTo("DIRECT_MQTT"); + assertThat(deserialized.getSelectedInstallMethod()).isEqualTo("DIRECT_MQTT"); assertThat(deserialized.getInstallState()).hasSize(3); assertThat(deserialized.getInstallState().get("Configuration").get("formValues").get("deviceName").asText()).isEqualTo("ESP32 Dev Kit"); } diff --git a/ui-ngx/src/app/core/http/iot-hub-api.service.ts b/ui-ngx/src/app/core/http/iot-hub-api.service.ts index c9a2c053bb..26e897eea5 100644 --- a/ui-ngx/src/app/core/http/iot-hub-api.service.ts +++ b/ui-ngx/src/app/core/http/iot-hub-api.service.ts @@ -122,7 +122,7 @@ export class IotHubApiService { public registerDeviceInstall( versionId: string, - descriptor: { type?: string; createdEntityIds: { entityType: string; id: string }[]; dashboardId?: { entityType: string; id: string }; selectedConnectivity?: string; installState?: Record }, + descriptor: { type?: string; createdEntityIds: { entityType: string; id: string }[]; dashboardId?: { entityType: string; id: string }; selectedInstallMethod?: string; installState?: Record }, config?: IotHubRequestConfig ): Observable { return this.http.post( diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html index 6e34f99e35..8d1aad37bc 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html @@ -178,8 +178,8 @@ } @else {

{{ 'iot-hub.device-install-title' | translate:{ name: packageInfo?.name || data.item.name } }}

- @if (selectedConnectivity && wizardStarted) { - {{ connectivityLabels.get(selectedConnectivity) }} + @if (selectedInstallMethod && wizardStarted) { + {{ installMethodLabels.get(selectedInstallMethod) }} } }
@@ -207,7 +207,7 @@ diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts index 9db5975469..788aab343a 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts @@ -34,7 +34,7 @@ import { AttributeService } from '@core/http/attribute.service'; import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; import { EntityId } from '@shared/models/id/entity-id'; import { - connectivityTypeTranslations, + installMethodLabels as INSTALL_METHOD_LABELS, DeviceInstallStep, DevicePackageInfo, ENTITY_STEP_TYPES, @@ -50,7 +50,7 @@ export interface DeviceInstallDialogData { item: MpItemVersionView; zipData: ArrayBuffer; reviewMode?: boolean; - selectedConnectivity?: string; + selectedInstallMethod?: string; installState?: Record; } @@ -91,9 +91,9 @@ export class TbDeviceInstallDialogComponent extends DialogComponent this.packageInfo.installSteps[ct]?.length > 0 ); } catch (e) { @@ -163,14 +163,14 @@ export class TbDeviceInstallDialogComponent extends DialogComponent s.name === stepName || this.resolveVariables(s.name) === stepName); if (matchingStep) { const alias = stepTypeAliasMap[matchingStep.type]; @@ -470,7 +470,7 @@ export class TbDeviceInstallDialogComponent extends DialogComponent s.type === 'GATEWAY'); + const gatewayStep = (this.packageInfo.installSteps[this.selectedInstallMethod] || []).find(s => s.type === 'GATEWAY'); if (gatewayStep?.dockerCompose) { const raw = this.zipFiles.get(gatewayStep.dockerCompose); if (raw) { @@ -505,7 +505,7 @@ export class TbDeviceInstallDialogComponent extends DialogComponent { this.dialog.open(TbIotHubItemDetailDialogComponent, { @@ -265,10 +265,10 @@ export class TbIotHubInstalledItemsComponent implements OnInit, AfterViewInit, O }); return; } - this.iotHubApiService.getVersionFileData(item.itemVersionId, { ignoreLoading: true }).subscribe({ + this.iotHubApiService.getVersionFileData(item.itemVersionId, { ignoreLoading: true, ignoreErrors: true }).subscribe({ next: async (blob: Blob) => { const zipData = await blob.arrayBuffer(); - this.iotHubApiService.getVersionInfo(item.itemVersionId, {ignoreLoading: true}).subscribe(versionView => { + this.iotHubApiService.getVersionInfo(item.itemVersionId, {ignoreLoading: true, ignoreErrors: true}).subscribe(versionView => { this.dialog.open(TbDeviceInstallDialogComponent, { panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], disableClose: false, @@ -277,7 +277,7 @@ export class TbIotHubInstalledItemsComponent implements OnInit, AfterViewInit, O item: versionView, zipData, reviewMode: true, - selectedConnectivity: descriptor.selectedConnectivity, + selectedInstallMethod: descriptor.selectedInstallMethod, installState: descriptor.installState } as DeviceInstallDialogData }); diff --git a/ui-ngx/src/app/shared/models/iot-hub/device-package.models.ts b/ui-ngx/src/app/shared/models/iot-hub/device-package.models.ts index 3e859b8c61..be1ac58384 100644 --- a/ui-ngx/src/app/shared/models/iot-hub/device-package.models.ts +++ b/ui-ngx/src/app/shared/models/iot-hub/device-package.models.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -export enum ConnectivityType { +export enum InstallMethod { DIRECT_HTTP = 'DIRECT_HTTP', DIRECT_MQTT = 'DIRECT_MQTT', DIRECT_COAP = 'DIRECT_COAP', @@ -29,20 +29,20 @@ export enum ConnectivityType { INTEGRATION_LORIOT = 'INTEGRATION_LORIOT' } -export const connectivityTypeTranslations = new Map( +export const installMethodLabels = new Map( [ - [ConnectivityType.DIRECT_HTTP, 'HTTP'], - [ConnectivityType.DIRECT_MQTT, 'MQTT'], - [ConnectivityType.DIRECT_COAP, 'CoAP'], - [ConnectivityType.DIRECT_LWM2M, 'LwM2M'], - [ConnectivityType.DIRECT_SNMP, 'SNMP'], - [ConnectivityType.GATEWAY_MQTT, 'MQTT Gateway'], - [ConnectivityType.GATEWAY_MODBUS, 'Modbus Gateway'], - [ConnectivityType.GATEWAY_OPCUA, 'OPC-UA Gateway'], - [ConnectivityType.CHIRPSTACK, 'ChirpStack'], - [ConnectivityType.INTEGRATION_CHIRPSTACK, 'ChirpStack (PE)'], - [ConnectivityType.INTEGRATION_TTN, 'The Things Stack'], - [ConnectivityType.INTEGRATION_LORIOT, 'LORIOT'] + [InstallMethod.DIRECT_HTTP, 'HTTP'], + [InstallMethod.DIRECT_MQTT, 'MQTT'], + [InstallMethod.DIRECT_COAP, 'CoAP'], + [InstallMethod.DIRECT_LWM2M, 'LwM2M'], + [InstallMethod.DIRECT_SNMP, 'SNMP'], + [InstallMethod.GATEWAY_MQTT, 'MQTT Gateway'], + [InstallMethod.GATEWAY_MODBUS, 'Modbus Gateway'], + [InstallMethod.GATEWAY_OPCUA, 'OPC-UA Gateway'], + [InstallMethod.CHIRPSTACK, 'ChirpStack'], + [InstallMethod.INTEGRATION_CHIRPSTACK, 'ChirpStack (PE)'], + [InstallMethod.INTEGRATION_TTN, 'The Things Stack'], + [InstallMethod.INTEGRATION_LORIOT, 'LORIOT'] ] ); @@ -93,7 +93,7 @@ export interface DevicePackageInfo { description: string; vendor: string; hardwareType: string; - connectivityTypes: string[]; + installMethods: string[]; installSteps: Record; } diff --git a/ui-ngx/src/app/shared/models/iot-hub/iot-hub-installed-item.models.ts b/ui-ngx/src/app/shared/models/iot-hub/iot-hub-installed-item.models.ts index 21eafca533..9b30377ceb 100644 --- a/ui-ngx/src/app/shared/models/iot-hub/iot-hub-installed-item.models.ts +++ b/ui-ngx/src/app/shared/models/iot-hub/iot-hub-installed-item.models.ts @@ -41,7 +41,7 @@ export interface DeviceInstalledItemDescriptor { type: 'DEVICE'; createdEntityIds?: { entityType: string; id: string }[]; dashboardId?: { id: string }; - selectedConnectivity?: string; + selectedInstallMethod?: string; installState?: Record; }