From 68e7151e7845a89178eb365686fdfbab021dee6f Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Wed, 1 Apr 2026 17:05:02 +0300 Subject: [PATCH] fix(iot-hub): reuse existing device profiles and add missing retry translation - Find device profile by name before creating; reuse if exists - Add action.retry translation key (was showing raw key) --- .../device-install-dialog.component.ts | 10 ++++++++++ ui-ngx/src/assets/locale/locale.constant-en_US.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/pages/iot-hub/device-install-dialog/device-install-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/iot-hub/device-install-dialog/device-install-dialog.component.ts index 286a861e35..e622b8ccba 100644 --- a/ui-ngx/src/app/modules/home/pages/iot-hub/device-install-dialog/device-install-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/iot-hub/device-install-dialog/device-install-dialog.component.ts @@ -337,6 +337,10 @@ export class TbDeviceInstallDialogComponent implements OnInit { switch (step.type) { case InstallStepType.DEVICE_PROFILE: { + const existing = await this.findDeviceProfileByName(template.name); + if (existing) { + return existing; + } const result = await firstValueFrom(this.deviceProfileService.saveDeviceProfile(template)); return { id: result.id.id, name: result.name }; } @@ -363,4 +367,10 @@ export class TbDeviceInstallDialogComponent implements OnInit { throw new Error(`Unsupported entity step type: ${step.type}`); } } + + private async findDeviceProfileByName(name: string): Promise { + const profiles = await firstValueFrom(this.deviceProfileService.getDeviceProfileNames()); + const match = profiles.find(p => p.name === name); + return match ? { id: match.id.id, name: match.name } : null; + } } 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 7f037f2a1e..092fef2d08 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -82,7 +82,8 @@ "upload": "Upload", "delete-anyway": "Delete anyway", "delete-selected": "Delete selected", - "set": "Set" + "set": "Set", + "retry": "Retry" }, "aggregation": { "aggregation": "Aggregation",