mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
disable ws for Consulate and better messaging for 0.2.x update
This commit is contained in:
committed by
Aiden McClelland
parent
45f0adde18
commit
cfa4055053
@@ -25,13 +25,13 @@
|
||||
</ng-container>
|
||||
|
||||
<ion-item-group *ngIf="storageDrives.length">
|
||||
<ion-item (click)="chooseDrive(drive)" class="ion-margin-bottom" button lines="none" *ngFor="let drive of storageDrives">
|
||||
<ion-item (click)="chooseDrive(drive)" class="ion-margin-bottom" [disabled]="tooSmall(drive)" button lines="none" *ngFor="let drive of storageDrives">
|
||||
<ion-icon slot="start" name="save-outline" size="large" color="light"></ion-icon>
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h1>{{ drive.vendor || 'Unknown Vendor' }} - {{ drive.model || 'Unknown Model' }}</h1>
|
||||
<h2>{{ drive.logicalname }} - {{ drive.capacity | convertBytes }}</h2>
|
||||
<p *ngIf="drive.capacity < 34359738368">
|
||||
<ion-text>
|
||||
<p *ngIf=tooSmall(drive)>
|
||||
<ion-text color="danger">
|
||||
Drive capacity too small.
|
||||
</ion-text>
|
||||
</p>
|
||||
|
||||
@@ -28,6 +28,10 @@ export class EmbassyPage {
|
||||
await this.getDrives()
|
||||
}
|
||||
|
||||
tooSmall (drive: DiskInfo) {
|
||||
return drive.capacity < 34359738368
|
||||
}
|
||||
|
||||
async refresh () {
|
||||
this.loading = true
|
||||
await this.getDrives()
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<div class="inline">
|
||||
<h2 *ngIf="hasValidBackup">
|
||||
<!-- has backup -->
|
||||
<h2 *ngIf="hasValidBackup; else noBackup">
|
||||
<ion-icon name="cloud-done" color="success"></ion-icon>
|
||||
Embassy backup detected
|
||||
</h2>
|
||||
<h2 *ngIf="!hasValidBackup">
|
||||
<ion-icon name="cloud-offline" color="danger"></ion-icon>
|
||||
No Embassy backup
|
||||
{{ is02x ? 'Embassy 0.2.x backup detected' : 'Embassy backup detected' }}
|
||||
</h2>
|
||||
<!-- no backup -->
|
||||
<ng-template #noBackup>
|
||||
<h2>
|
||||
<ion-icon name="cloud-offline" color="danger"></ion-icon>
|
||||
No Embassy backup
|
||||
</h2>
|
||||
</ng-template>
|
||||
</div>
|
||||
@@ -45,12 +45,12 @@
|
||||
To restore from a physical drive, please follow the <a href="https://docs.start9.com/user-manual/general/backups.html" target="blank" noreferrer>instructions</a>.
|
||||
</p>
|
||||
|
||||
<ng-container *ngFor="let target of driveTargets">
|
||||
<ion-item button *ngIf="target.drive as drive" [disabled]="!driveClickable(drive)" (click)="select(drive)">
|
||||
<ng-container *ngFor="let mapped of mappedDrives">
|
||||
<ion-item button *ngIf="mapped.drive as drive" [disabled]="!driveClickable(mapped)" (click)="select(drive)">
|
||||
<ion-icon slot="start" name="save-outline" size="large" color="light"></ion-icon>
|
||||
<ion-label>
|
||||
<h1>{{ drive.label || drive.logicalname }}</h1>
|
||||
<drive-status [hasValidBackup]="target.hasValidBackup"></drive-status>
|
||||
<drive-status [hasValidBackup]="mapped.hasValidBackup" [is02x]="mapped.is02x"></drive-status>
|
||||
<p>{{ drive.vendor || 'Unknown Vendor' }} - {{ drive.model || 'Unknown Model' }}</p>
|
||||
<p>Capacity: {{ drive.capacity | convertBytes }}</p>
|
||||
</ion-label>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { AlertController, LoadingController, ModalController, NavController } from '@ionic/angular'
|
||||
import { CifsModal } from 'src/app/modals/cifs-modal/cifs-modal.page'
|
||||
import { ApiService, CifsBackupTarget, DiskBackupTarget, DiskRecoverySource, RecoverySource } from 'src/app/services/api/api.service'
|
||||
import { ApiService, DiskBackupTarget } from 'src/app/services/api/api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
import { MappedDisk } from 'src/app/util/misc.util'
|
||||
import { PasswordPage } from '../../modals/password/password.page'
|
||||
import { ProdKeyModal } from '../../modals/prod-key-modal/prod-key-modal.page'
|
||||
|
||||
@@ -15,7 +14,7 @@ import { ProdKeyModal } from '../../modals/prod-key-modal/prod-key-modal.page'
|
||||
})
|
||||
export class RecoverPage {
|
||||
loading = true
|
||||
driveTargets: MappedDisk[] = []
|
||||
mappedDrives: MappedDisk[] = []
|
||||
hasShownGuidAlert = false
|
||||
|
||||
constructor (
|
||||
@@ -38,29 +37,30 @@ export class RecoverPage {
|
||||
await this.getDrives()
|
||||
}
|
||||
|
||||
driveClickable (drive: DiskBackupTarget) {
|
||||
return drive['embassy-os']?.full && (this.stateService.hasProductKey || this.is02x(drive))
|
||||
driveClickable (mapped: MappedDisk) {
|
||||
return mapped.drive['embassy-os']?.full && (this.stateService.hasProductKey || mapped.is02x)
|
||||
}
|
||||
|
||||
async getDrives () {
|
||||
this.driveTargets = []
|
||||
this.mappedDrives = []
|
||||
try {
|
||||
const drives = await this.apiService.getDrives()
|
||||
drives.filter(d => d.partitions.length).forEach(d => {
|
||||
d.partitions.forEach(p => {
|
||||
this.driveTargets.push(
|
||||
const drive: DiskBackupTarget = {
|
||||
vendor: d.vendor,
|
||||
model: d.model,
|
||||
logicalname: p.logicalname,
|
||||
label: p.label,
|
||||
capacity: p.capacity,
|
||||
used: p.used,
|
||||
'embassy-os': p['embassy-os'],
|
||||
}
|
||||
this.mappedDrives.push(
|
||||
{
|
||||
hasValidBackup: p['embassy-os']?.full,
|
||||
drive: {
|
||||
type: 'disk',
|
||||
vendor: d.vendor,
|
||||
model: d.model,
|
||||
logicalname: p.logicalname,
|
||||
label: p.label,
|
||||
capacity: p.capacity,
|
||||
used: p.used,
|
||||
'embassy-os': p['embassy-os'],
|
||||
},
|
||||
is02x: drive['embassy-os']?.version.startsWith('0.2'),
|
||||
drive,
|
||||
},
|
||||
)
|
||||
})
|
||||
@@ -102,7 +102,6 @@ export class RecoverPage {
|
||||
if (res.role === 'success') {
|
||||
const { hostname, path, username, password } = res.data.cifs
|
||||
this.stateService.recoverySource = {
|
||||
type: 'cifs',
|
||||
hostname,
|
||||
path,
|
||||
username,
|
||||
@@ -166,16 +165,11 @@ export class RecoverPage {
|
||||
|
||||
private async selectRecoverySource (logicalname: string, password?: string) {
|
||||
this.stateService.recoverySource = {
|
||||
type: 'disk',
|
||||
logicalname,
|
||||
}
|
||||
this.stateService.recoveryPassword = password
|
||||
this.navCtrl.navigateForward(`/embassy`)
|
||||
}
|
||||
|
||||
private is02x (drive: DiskBackupTarget): boolean {
|
||||
return !this.stateService.hasProductKey && drive['embassy-os']?.version.startsWith('0.2')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,4 +180,12 @@ export class RecoverPage {
|
||||
})
|
||||
export class DriveStatusComponent {
|
||||
@Input() hasValidBackup: boolean
|
||||
@Input() is02x: boolean
|
||||
}
|
||||
|
||||
|
||||
interface MappedDisk {
|
||||
is02x: boolean
|
||||
hasValidBackup: boolean
|
||||
drive: DiskBackupTarget
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user