From 3e55d66b20bd00a5574fb1ed98a7d8d4e5a0fc3f Mon Sep 17 00:00:00 2001 From: jliddev Date: Fri, 27 Jan 2023 01:24:21 -0600 Subject: [PATCH] Fix import/export installation label Fix protocol dialog installation label --- .../addon-manage-dialog.component.ts | 18 +++++++++++++----- .../install-from-protocol-dialog.component.ts | 2 ++ .../wow-client-options.component.ts | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/wowup-electron/src/app/components/addons/addon-manage-dialog/addon-manage-dialog.component.ts b/wowup-electron/src/app/components/addons/addon-manage-dialog/addon-manage-dialog.component.ts index ef390941..35195a29 100644 --- a/wowup-electron/src/app/components/addons/addon-manage-dialog/addon-manage-dialog.component.ts +++ b/wowup-electron/src/app/components/addons/addon-manage-dialog/addon-manage-dialog.component.ts @@ -13,6 +13,7 @@ import { SessionService } from "../../../services/session/session.service"; import { SnackbarService } from "../../../services/snackbar/snackbar.service"; import { ElectronService } from "../../../services"; import { WowInstallation } from "wowup-lib-core/lib/models"; +import { WarcraftInstallationService } from "../../../services/warcraft/warcraft-installation.service"; interface ImportComparisonViewModel extends ImportComparison { isInstalling?: boolean; @@ -37,8 +38,8 @@ export class AddonManageDialogComponent implements OnInit, OnDestroy { public readonly TAB_IDX_EXPORT = 0; public readonly TAB_IDX_IMPORT = 1; - public readonly selectedInstallation: WowInstallation; + public selectedInstallation: WowInstallation; public exportSummary: ExportSummary | undefined; public exportPayload!: string; public importData = ""; @@ -65,10 +66,9 @@ export class AddonManageDialogComponent implements OnInit, OnDestroy { private _electronService: ElectronService, private _addonBrokerService: AddonBrokerService, private _sessionService: SessionService, - private _snackbarService: SnackbarService - ) { - this.selectedInstallation = this._sessionService.getSelectedWowInstallation(); - } + private _snackbarService: SnackbarService, + private _warcraftInstallationService: WarcraftInstallationService + ) {} public ngOnInit(): void { this.initAsync().catch((e) => console.error(e)); @@ -144,6 +144,14 @@ export class AddonManageDialogComponent implements OnInit, OnDestroy { private async initAsync() { try { + const installation = this._sessionService.getSelectedWowInstallation(); + if (installation !== undefined) { + this.selectedInstallation = { ...installation }; + this.selectedInstallation.label = await this._warcraftInstallationService.getInstallationDisplayName( + this.selectedInstallation + ); + } + this.exportSummary = await this._addonBrokerService.getExportSummary(this.selectedInstallation); const payload = await this._addonBrokerService.getExportPayload(this.selectedInstallation); diff --git a/wowup-electron/src/app/components/addons/install-from-protocol-dialog/install-from-protocol-dialog.component.ts b/wowup-electron/src/app/components/addons/install-from-protocol-dialog/install-from-protocol-dialog.component.ts index 7baf0582..013f1d58 100644 --- a/wowup-electron/src/app/components/addons/install-from-protocol-dialog/install-from-protocol-dialog.component.ts +++ b/wowup-electron/src/app/components/addons/install-from-protocol-dialog/install-from-protocol-dialog.component.ts @@ -157,6 +157,8 @@ export class InstallFromProtocolDialogComponent implements OnInit, AfterViewInit this.addon.providerName, installation ); + + installation.label = await this._warcraftInstallationService.getInstallationDisplayName(installation); } if (this.validWowInstallations.length === 0) { diff --git a/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.ts b/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.ts index 5e3cd19c..890a7157 100644 --- a/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.ts +++ b/wowup-electron/src/app/components/options/wow-client-options/wow-client-options.component.ts @@ -220,7 +220,7 @@ export class WowClientOptionsComponent implements OnInit, OnDestroy { .afterClosed() .pipe( switchMap((result) => { - if (!result) { + if (result === undefined) { return of(undefined); }