From 8fffa40502cd87c76a0d94d7da7fc9a4d26667e9 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 1 Dec 2022 08:04:21 -0700 Subject: [PATCH] fix bug with showing embassy drives and center error text (#2006) * fix bug with showing embassy drives and center error text * cleaner * even more cleaner --- .../src/app/pages/embassy/embassy.page.html | 10 +++--- .../src/app/pages/embassy/embassy.page.ts | 35 +++++++++++-------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.html b/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.html index b6d10aff0..8fd808292 100644 --- a/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.html +++ b/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.html @@ -21,10 +21,12 @@ style="padding-bottom: 8px" > No drives found - Please connect an external storage drive to your Embassy, if - applicable. Next, click "Refresh". +
+ + Please connect an external storage drive to your Embassy, if + applicable. Next, click "Refresh". + +
diff --git a/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.ts b/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.ts index cbfc0dad5..6be587ce6 100644 --- a/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.ts +++ b/frontend/projects/setup-wizard/src/app/pages/embassy/embassy.page.ts @@ -53,24 +53,29 @@ export class EmbassyPage { this.loading = true try { const disks = await this.apiService.getDrives() - this.storageDrives = disks.filter(d => { - if (this.stateService.setupType === 'restore') { - return !d.partitions - .map(p => p.logicalname) - .includes( - ( - (this.stateService.recoverySource as BackupRecoverySource) - ?.target as DiskRecoverySource - )?.logicalname, - ) - } else if (this.stateService.setupType === 'transfer') { - const guid = (this.stateService.recoverySource as DiskMigrateSource) - .guid + if (this.stateService.setupType === 'fresh') { + this.storageDrives = disks + } else if (this.stateService.setupType === 'restore') { + this.storageDrives = disks.filter( + d => + !d.partitions + .map(p => p.logicalname) + .includes( + ( + (this.stateService.recoverySource as BackupRecoverySource) + ?.target as DiskRecoverySource + )?.logicalname, + ), + ) + } else if (this.stateService.setupType === 'transfer') { + const guid = (this.stateService.recoverySource as DiskMigrateSource) + .guid + this.storageDrives = disks.filter(d => { return ( d.guid !== guid && !d.partitions.map(p => p.guid).includes(guid) ) - } - }) + }) + } } catch (e: any) { this.errorToastService.present(e) } finally {