mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
refactor setup wizard (#1937)
* refactor setup backend * rework setup wizard according to new scheme * fix bug with partitions in SW and warning message in IW * treat localhost as LAN for launching services * misc backend fixes Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
This commit is contained in:
@@ -47,27 +47,24 @@ export class HomePage {
|
||||
}
|
||||
|
||||
async tryInstall(overwrite: boolean) {
|
||||
if (!this.selectedDisk) return
|
||||
|
||||
const { logicalname, guid } = this.selectedDisk
|
||||
|
||||
const hasEmbassyData = !!guid
|
||||
|
||||
if (hasEmbassyData && !overwrite) {
|
||||
return this.install(logicalname, overwrite)
|
||||
if (overwrite) {
|
||||
return this.presentAlertDanger()
|
||||
}
|
||||
|
||||
await this.presentAlertDanger(logicalname, hasEmbassyData)
|
||||
this.install(false)
|
||||
}
|
||||
|
||||
private async install(logicalname: string, overwrite: boolean) {
|
||||
private async install(overwrite: boolean) {
|
||||
const loader = await this.loadingCtrl.create({
|
||||
message: 'Installing embassyOS...',
|
||||
})
|
||||
await loader.present()
|
||||
|
||||
try {
|
||||
await this.api.install({ logicalname, overwrite })
|
||||
await this.api.install({
|
||||
logicalname: this.selectedDisk!.logicalname,
|
||||
overwrite,
|
||||
})
|
||||
this.presentAlertReboot()
|
||||
} catch (e: any) {
|
||||
this.error = e.message
|
||||
@@ -76,17 +73,14 @@ export class HomePage {
|
||||
}
|
||||
}
|
||||
|
||||
private async presentAlertDanger(
|
||||
logicalname: string,
|
||||
hasEmbassyData: boolean,
|
||||
) {
|
||||
const message = hasEmbassyData
|
||||
? 'This action COMPLETELY erases your existing Embassy data'
|
||||
: `This action COMPLETELY erases the disk ${logicalname} and installs embassyOS`
|
||||
private async presentAlertDanger() {
|
||||
const { vendor, model } = this.selectedDisk!
|
||||
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'Warning',
|
||||
message,
|
||||
message: `This action will COMPLETELY erase the disk ${
|
||||
vendor || 'Unknown Vendor'
|
||||
} - ${model || 'Unknown Model'} and install embassyOS in its place`,
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
@@ -95,7 +89,7 @@ export class HomePage {
|
||||
{
|
||||
text: 'Continue',
|
||||
handler: () => {
|
||||
this.install(logicalname, true)
|
||||
this.install(true)
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user