Browse Source

fix(iot-hub): fix review mode initialization order in device install dialog

The review mode check ran after the single-connectivity auto-start,
so the wizard was already built with empty state before review mode
could restore form values and entity outputs.

Fix: move connectivity selection logic after the review mode check.
Review mode sets its own connectivity from stored state; normal mode
falls through to the existing single/multi connectivity logic.
pull/15508/head
Andrii Shvaika 6 months ago
parent
commit
6eea76f854
  1. 15
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts

15
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts

@ -145,13 +145,6 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
this.availableConnectivityTypes = this.packageInfo.connectivityTypes.filter( this.availableConnectivityTypes = this.packageInfo.connectivityTypes.filter(
ct => this.packageInfo.installSteps[ct]?.length > 0 ct => this.packageInfo.installSteps[ct]?.length > 0
); );
if (this.availableConnectivityTypes.length === 1) {
this.selectedConnectivity = this.availableConnectivityTypes[0];
this.showConnectivitySelector = false;
this.startWizard();
} else {
this.showConnectivitySelector = true;
}
} catch (e) { } catch (e) {
console.error('Failed to parse device package ZIP', e); console.error('Failed to parse device package ZIP', e);
} }
@ -169,13 +162,19 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
} catch (_e) { } catch (_e) {
console.error('Failed to fetch connectivity settings', _e); console.error('Failed to fetch connectivity settings', _e);
} }
// Review mode: restore state from stored installState // Review mode: restore state and start wizard with stored values
if (this.data.reviewMode && this.data.installState && this.data.selectedConnectivity) { if (this.data.reviewMode && this.data.installState && this.data.selectedConnectivity) {
this.reviewMode = true; this.reviewMode = true;
this.selectedConnectivity = this.data.selectedConnectivity; this.selectedConnectivity = this.data.selectedConnectivity;
this.showConnectivitySelector = false; this.showConnectivitySelector = false;
this.restoreInstallState(this.data.installState); this.restoreInstallState(this.data.installState);
this.startWizard(); this.startWizard();
} else if (this.availableConnectivityTypes.length === 1) {
this.selectedConnectivity = this.availableConnectivityTypes[0];
this.showConnectivitySelector = false;
this.startWizard();
} else {
this.showConnectivitySelector = true;
} }
this.loading = false; this.loading = false;
this.cdr.detectChanges(); this.cdr.detectChanges();

Loading…
Cancel
Save