mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
error handling and refresh
This commit is contained in:
committed by
Aiden McClelland
parent
5610ab135b
commit
bf9c046cd2
@@ -19,7 +19,7 @@
|
|||||||
<h2 color="light">No recovery drives found</h2>
|
<h2 color="light">No recovery drives found</h2>
|
||||||
<p color="light">Please connect a recovery drive to your Embassy and refresh the page.</p>
|
<p color="light">Please connect a recovery drive to your Embassy and refresh the page.</p>
|
||||||
<ion-button
|
<ion-button
|
||||||
(click)="window.location.reload()"
|
(click)="refresh()"
|
||||||
style="text-align:center"
|
style="text-align:center"
|
||||||
class="claim-button"
|
class="claim-button"
|
||||||
>
|
>
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
color="light"
|
color="light"
|
||||||
[disabled]="!selectedDrive || (!passwords[selectedDrive.logicalname] && !selectedDrive['embassy_os'].version.startsWith('0.2'))"
|
[disabled]="!selectedDrive || (!passwords[selectedDrive.logicalname] && !selectedDrive['embassy_os'].version.startsWith('0.2'))"
|
||||||
class="claim-button"
|
class="claim-button"
|
||||||
|
*ngIf="recoveryDrives.length"
|
||||||
>
|
>
|
||||||
Next
|
Next
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component } from '@angular/core'
|
import { Component } from '@angular/core'
|
||||||
import { iosTransitionAnimation, ModalController, NavController } from '@ionic/angular'
|
import { iosTransitionAnimation, ModalController, NavController } from '@ionic/angular'
|
||||||
import { ApiService, DiskInfo } from 'src/app/services/api/api.service'
|
import { ApiService, DiskInfo } 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 { StateService } from 'src/app/services/state.service'
|
||||||
import { PasswordPage } from '../password/password.page'
|
import { PasswordPage } from '../password/password.page'
|
||||||
|
|
||||||
@@ -20,12 +21,30 @@ export class RecoverPage {
|
|||||||
private readonly apiService: ApiService,
|
private readonly apiService: ApiService,
|
||||||
private readonly navCtrl: NavController,
|
private readonly navCtrl: NavController,
|
||||||
private readonly modalController: ModalController,
|
private readonly modalController: ModalController,
|
||||||
private readonly stateService: StateService
|
private readonly stateService: StateService,
|
||||||
|
private readonly errorToastService: ErrorToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit () {
|
||||||
this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy_os'])
|
await this.getDrives()
|
||||||
this.loading = false
|
}
|
||||||
|
|
||||||
|
async refresh () {
|
||||||
|
this.recoveryDrives = []
|
||||||
|
this.selectedDrive = null
|
||||||
|
this.loading = true
|
||||||
|
await this.getDrives()
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDrives () {
|
||||||
|
try {
|
||||||
|
this.recoveryDrives = (await this.apiService.getDrives()).filter(d => !!d['embassy_os'])
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
this.errorToastService.present(e.message)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async chooseDrive(drive: DiskInfo) {
|
async chooseDrive(drive: DiskInfo) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export class ErrorToastService {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
position: 'top',
|
position: 'top',
|
||||||
cssClass: 'error-toast',
|
cssClass: 'error-toast',
|
||||||
|
animated: true,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
side: 'end',
|
side: 'end',
|
||||||
|
|||||||
@@ -53,6 +53,14 @@ ion-item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ion-toast {
|
||||||
|
--background: var(--ion-color-light);
|
||||||
|
--button-color: var(--ion-color-dark);
|
||||||
|
--border-style: solid;
|
||||||
|
--border-width: 1px;
|
||||||
|
--color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.error-toast {
|
.error-toast {
|
||||||
--border-color: var(--ion-color-danger);
|
--border-color: var(--ion-color-danger);
|
||||||
width: 40%;
|
width: 40%;
|
||||||
|
|||||||
Reference in New Issue
Block a user