ability to shutdown after install

This commit is contained in:
Matt Hill
2026-01-20 17:08:40 -07:00
parent 99727e132c
commit 2e5cd4b8ca
10 changed files with 81 additions and 20 deletions

View File

@@ -336,12 +336,46 @@ export default class DrivesPage {
this.stateService.dataDriveGuid = result.guid
this.stateService.attach = result.attach
if (result.attach) {
this.stateService.setupType = 'attach'
await this.router.navigate(['/password'])
} else {
await this.router.navigate(['/home'])
}
loader.unsubscribe()
// Show success dialog
this.dialogs
.openConfirm({
label: 'Installation Complete!',
size: 's',
data: {
content: 'StartOS has been installed successfully.',
yes: 'Continue to Setup',
no: 'Shutdown',
},
})
.subscribe(continueSetup => {
if (continueSetup) {
this.navigateToNextStep(result.attach)
} else {
this.shutdownServer()
}
})
} catch (e: any) {
loader.unsubscribe()
this.errorService.handleError(e)
}
}
private async navigateToNextStep(attach: boolean) {
if (attach) {
this.stateService.setupType = 'attach'
await this.router.navigate(['/password'])
} else {
await this.router.navigate(['/home'])
}
}
private async shutdownServer() {
const loader = this.loader.open('Beginning shutdown').subscribe()
try {
await this.api.shutdown()
} catch (e: any) {
this.errorService.handleError(e)
} finally {

View File

@@ -73,7 +73,7 @@ import { SetupCompleteRes } from '../types'
>
<tui-avatar appearance="secondary" src="@tui.usb" />
<div tuiTitle>
{{ 'Remove USB Media' | i18n }}
{{ 'USB Removed' | i18n }}
<div tuiSubtitle>
{{
'Remove the USB installation media from your server' | i18n

View File

@@ -46,6 +46,7 @@ export abstract class ApiService {
// Completion
abstract complete(): Promise<SetupCompleteRes> // setup.complete
abstract exit(): Promise<void> // setup.exit
abstract shutdown(): Promise<void> // setup.shutdown
// Logs & Progress
abstract initFollowLogs(): Promise<FollowLogsRes> // setup.logs.follow

View File

@@ -149,6 +149,13 @@ export class LiveApiService extends ApiService {
})
}
async shutdown() {
await this.rpcRequest<void>({
method: 'setup.shutdown',
params: {},
})
}
async restart() {
await this.rpcRequest<void>({
method: 'setup.restart',

View File

@@ -70,13 +70,13 @@ export class MockApiService extends ApiService {
this.statusIndex++
if (this.statusIndex === 1) {
// return { status: 'needs-install', keyboard: null }
return {
status: 'incomplete',
attach: false,
guid: 'mock-data-guid',
keyboard: null,
}
return { status: 'needs-install', keyboard: null }
// return {
// status: 'incomplete',
// attach: false,
// guid: 'mock-data-guid',
// keyboard: null,
// }
}
if (this.statusIndex > 3) {
@@ -187,6 +187,10 @@ export class MockApiService extends ApiService {
await pauseFor(500)
}
async shutdown(): Promise<void> {
await pauseFor(500)
}
async restart(): Promise<void> {
await pauseFor(500)
}