Browse Source

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)
pull/15347/head
Andrii Shvaika 4 months ago
parent
commit
68e7151e78
  1. 10
      ui-ngx/src/app/modules/home/pages/iot-hub/device-install-dialog/device-install-dialog.component.ts
  2. 3
      ui-ngx/src/assets/locale/locale.constant-en_US.json

10
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<EntityStepOutput | null> {
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;
}
}

3
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",

Loading…
Cancel
Save