mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
pw modal
This commit is contained in:
committed by
Aiden McClelland
parent
1311f473f9
commit
fbcf4cacdb
@@ -1,7 +1,8 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { AlertController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { AlertController, ModalController } from '@ionic/angular'
|
||||
import { ApiService, EmbassyDrive } from 'src/app/services/api/api.service'
|
||||
import { StateService } from 'src/app/services/state.service'
|
||||
import { PasswordPage } from '../password/password.page'
|
||||
|
||||
@Component({
|
||||
selector: 'recover',
|
||||
@@ -11,11 +12,13 @@ import { StateService } from 'src/app/services/state.service'
|
||||
export class RecoverPage {
|
||||
dataDrives = []
|
||||
selectedDrive = null
|
||||
selectedVersion = null
|
||||
|
||||
constructor(
|
||||
private readonly apiService: ApiService,
|
||||
private readonly stateService: StateService,
|
||||
public alertController: AlertController,
|
||||
private modalController: ModalController,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -26,11 +29,15 @@ export class RecoverPage {
|
||||
}
|
||||
}
|
||||
|
||||
selectDrive(name: string) {
|
||||
selectDrive(disk: EmbassyDrive) {
|
||||
const name = disk['logical-name']
|
||||
const version = disk.version
|
||||
if (name === this.selectedDrive) {
|
||||
this.selectedDrive = null
|
||||
this.selectedVersion = null
|
||||
} else {
|
||||
this.selectedDrive = name
|
||||
this.selectedVersion = version
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +67,33 @@ export class RecoverPage {
|
||||
}
|
||||
|
||||
async chooseDisk() {
|
||||
await this.apiService.selectEmbassyDrive({logicalName: this.selectedDrive})
|
||||
this.presentPasswordModal()
|
||||
}
|
||||
|
||||
async presentPasswordModal() {
|
||||
const modal = await this.modalController.create({
|
||||
component: PasswordPage,
|
||||
backdropDismiss: false,
|
||||
componentProps: {
|
||||
'version': this.selectedVersion,
|
||||
}
|
||||
})
|
||||
modal.onDidDismiss().then(ret => {
|
||||
if(ret.data.pwValid) {
|
||||
this.submitPWAndDisk(ret.data.password)
|
||||
}
|
||||
})
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
async submitPWAndDisk(pw: string) {
|
||||
await this.apiService.selectEmbassyDrive({logicalName: this.selectedDrive}, pw)
|
||||
this.stateService.recoveryDrive = this.selectedDrive
|
||||
this.stateService.pollDataTransferProgress()
|
||||
}
|
||||
|
||||
async navToEmbassy() {
|
||||
// @TODO nav to embassy
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user