combine install and setup and refactor all

This commit is contained in:
Matt Hill
2026-01-13 13:11:10 -07:00
committed by Aiden McClelland
parent 645083913c
commit 42ef2bdf7e
52 changed files with 2156 additions and 2023 deletions

View File

@@ -1,7 +1,7 @@
import { Component, inject, DOCUMENT } from '@angular/core'
import { Router } from '@angular/router'
import { ErrorService } from '@start9labs/shared'
import { ApiService } from 'src/app/services/api.service'
import { ApiService } from './services/api.service'
import { StateService } from './services/state.service'
@Component({
@@ -18,19 +18,41 @@ export class AppComponent {
async ngOnInit() {
try {
// Determine if we're in kiosk mode
this.stateService.kiosk = ['localhost', '127.0.0.1'].includes(
this.document.location.hostname,
)
const inProgress = await this.api.getStatus()
// Get pubkey for encryption
await this.api.getPubKey()
let route = 'home'
// Check setup status to determine initial route
const status = await this.api.getStatus()
if (inProgress) {
route = inProgress.status === 'complete' ? '/success' : '/loading'
switch (status.status) {
case 'needs-install':
// Start the install flow
await this.router.navigate(['/language'])
break
case 'incomplete':
// Store the data drive info from status
this.stateService.dataDriveGuid = status.guid
this.stateService.attach = status.attach
await this.router.navigate(['/language'])
break
case 'running':
// Setup is in progress, show loading page
await this.router.navigate(['/loading'])
break
case 'complete':
// Setup execution finished, show success page
await this.router.navigate(['/success'])
break
}
await this.router.navigate([route])
} catch (e: any) {
this.errorService.handleError(e)
}