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
This commit is contained in:
Matt Hill
2022-12-01 08:04:21 -07:00
committed by GitHub
parent 6680b32579
commit 8fffa40502
2 changed files with 26 additions and 19 deletions

View File

@@ -21,10 +21,12 @@
style="padding-bottom: 8px"
>
<ion-card-title>No drives found</ion-card-title>
<ion-card-subtitle
>Please connect an external storage drive to your Embassy, if
applicable. Next, click "Refresh".</ion-card-subtitle
>
<div class="center-wrapper">
<ion-card-subtitle>
Please connect an external storage drive to your Embassy, if
applicable. Next, click "Refresh".
</ion-card-subtitle>
</div>
</ion-card-header>
</ng-template>

View File

@@ -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 {