From 4bfa5d91153ae83dd9c7f4faede9f4a7593cdf0f Mon Sep 17 00:00:00 2001 From: dpinkevych Date: Mon, 2 Nov 2026 10:20:54 +0200 Subject: [PATCH] fix(iot-hub): keep the package's own entity on use-existing, find a step that gained an id by its name --- .../device-install-dialog.component.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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 ca88fa519e..327590d41c 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 @@ -2086,7 +2086,10 @@ export class TbDeviceInstallDialogComponent extends DialogComponent field.key).filter(key => !previousKeys.has(key))); } + /** Update: true when the entity is one the installed package created. */ + private isPackageEntity(id: string): boolean { + return !!this.data.update?.descriptor.createdEntityIds?.some(created => created.id === id); + } + /** The keys the install state may keep a step under: its id, or else its name, as written or resolved. */ private stateKeysOf(step: DeviceInstallStep): string[] { return step.id ? [step.id] : [step.name, this.resolveVariables(step.name)]; } - /** Update: the install state of a step of the new version, under the key of the installed step it replaces. */ + /** + * Update: the install state of a step of the new version, under the key of the installed step it replaces. + * Without the installed version's steps (e.g. it can't be downloaded any more), a step that has gained an id + * is also looked up under its own name, which the installed version keyed it by. + */ private storedStateOf(step: DeviceInstallStep): { key: string; state: any } | undefined { const installState = this.data.update?.descriptor.installState ?? {}; const previousStep = this.findPreviousStep(step); const keys = [...(previousStep ? this.stateKeysOf(previousStep) : []), ...this.stateKeysOf(step)]; + if (!previousStep && step.id) { + keys.push(step.name, this.resolveVariables(step.name)); + } const key = keys.find(k => k && installState[k]); return key ? { key, state: installState[key] } : undefined; }