|
|
@ -118,34 +118,24 @@ export class IotHubActionsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
installDevice(item: MpItemVersionView): Observable<string> { |
|
|
installDevice(item: MpItemVersionView): Observable<string> { |
|
|
return this.fetchZipData(item).pipe( |
|
|
return this.openDeviceInstallDialog(item); |
|
|
mergeMap((zipData: ArrayBuffer) => this.openDeviceInstallDialog(item, zipData)) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
reviewDevice(item: MpItemVersionView, deviceDescriptor: DeviceInstalledItemDescriptor): Observable<any> { |
|
|
reviewDevice(item: MpItemVersionView, deviceDescriptor: DeviceInstalledItemDescriptor): Observable<any> { |
|
|
return this.fetchZipData(item).pipe( |
|
|
return this.openDeviceInstallDialog(item, { |
|
|
mergeMap((zipData: ArrayBuffer) => this.openDeviceInstallDialog(item, zipData, { |
|
|
|
|
|
reviewMode: true, |
|
|
reviewMode: true, |
|
|
selectedInstallMethod: deviceDescriptor.selectedInstallMethod, |
|
|
selectedInstallMethod: deviceDescriptor.selectedInstallMethod, |
|
|
installState: deviceDescriptor.installState |
|
|
installState: deviceDescriptor.installState |
|
|
})) |
|
|
}); |
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fetchZipData(item: MpItemVersionView): Observable<ArrayBuffer> { |
|
|
|
|
|
return this.iotHubApiService.getVersionFileData(item.id as string, { ignoreLoading: true }).pipe( |
|
|
|
|
|
mergeMap((blob: Blob) => blob.arrayBuffer()) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private openDeviceInstallDialog(item: MpItemVersionView, zipData: ArrayBuffer, |
|
|
private openDeviceInstallDialog(item: MpItemVersionView, |
|
|
options?: { reviewMode?: boolean; selectedInstallMethod?: string; installState?: any }): Observable<any> { |
|
|
options?: { reviewMode?: boolean; selectedInstallMethod?: string; installState?: any }): Observable<any> { |
|
|
return this.dialog.open(TbDeviceInstallDialogComponent, { |
|
|
return this.dialog.open<TbDeviceInstallDialogComponent, DeviceInstallDialogData>(TbDeviceInstallDialogComponent, { |
|
|
panelClass: ['tb-dialog', 'tb-fullscreen-dialog-lt-md'], |
|
|
panelClass: ['tb-dialog', 'tb-fullscreen-dialog-lt-md'], |
|
|
disableClose: true, |
|
|
disableClose: true, |
|
|
autoFocus: false, |
|
|
autoFocus: false, |
|
|
data: { item, zipData, ...options } as DeviceInstallDialogData |
|
|
data: { item, ...options } |
|
|
}).afterClosed(); |
|
|
}).afterClosed(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|