mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
hard restart feature
This commit is contained in:
committed by
Aiden McClelland
parent
1dccde4923
commit
0809ff9f57
@@ -69,6 +69,29 @@ export class ServerShowPage {
|
||||
await alert.present()
|
||||
}
|
||||
|
||||
async presentAlertHardRestart () {
|
||||
const minutes = Object.keys(this.patch.data['package-data']).length
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'Warning',
|
||||
message: `Do not hard restart unless your Embassy is in a corrupt state or you have been instructed by a Start9 support representitive. This process may take up to ${minutes} minutes.`,
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
{
|
||||
text: 'Hard Restart',
|
||||
handler: () => {
|
||||
this.hardRestart()
|
||||
},
|
||||
cssClass: 'enter-click',
|
||||
},
|
||||
],
|
||||
cssClass: 'alert-error-message',
|
||||
})
|
||||
await alert.present()
|
||||
}
|
||||
|
||||
private async restart () {
|
||||
const loader = await this.loadingCtrl.create({
|
||||
spinner: 'lines',
|
||||
@@ -103,6 +126,23 @@ export class ServerShowPage {
|
||||
}
|
||||
}
|
||||
|
||||
private async hardRestart () {
|
||||
const loader = await this.loadingCtrl.create({
|
||||
spinner: 'lines',
|
||||
message: 'Hard Restarting...',
|
||||
cssClass: 'loader',
|
||||
})
|
||||
await loader.present()
|
||||
|
||||
try {
|
||||
await this.embassyApi.hardRestartServer({ })
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
} finally {
|
||||
loader.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
settings: ServerSettings = {
|
||||
'Backups': [
|
||||
{
|
||||
@@ -208,6 +248,14 @@ export class ServerShowPage {
|
||||
detail: false,
|
||||
disabled: of(false),
|
||||
},
|
||||
{
|
||||
title: 'Hard Restart',
|
||||
description: '',
|
||||
icon: 'alert-circle-outline',
|
||||
action: () => this.presentAlertHardRestart(),
|
||||
detail: false,
|
||||
disabled: of(false),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ export module RR {
|
||||
export type ShutdownServerReq = { } // server.shutdown
|
||||
export type ShutdownServerRes = null
|
||||
|
||||
export type HardRestartServerReq = { } // server.hard-restart
|
||||
export type HardRestartServerRes = null
|
||||
|
||||
// sessions
|
||||
|
||||
export type GetSessionsReq = { } // sessions.list
|
||||
|
||||
@@ -68,6 +68,8 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
|
||||
|
||||
abstract shutdownServer (params: RR.ShutdownServerReq): Promise<RR.ShutdownServerRes>
|
||||
|
||||
abstract hardRestartServer (params: RR.HardRestartServerReq): Promise<RR.HardRestartServerRes>
|
||||
|
||||
// marketplace URLs
|
||||
|
||||
abstract getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes>
|
||||
|
||||
@@ -80,6 +80,10 @@ export class LiveApiService extends ApiService {
|
||||
return this.http.rpcRequest({ method: 'server.shutdown', params })
|
||||
}
|
||||
|
||||
async hardRestartServer (params: RR.RestartServerReq): Promise<RR.RestartServerRes> {
|
||||
return this.http.rpcRequest({ method: 'server.hard-restart', params })
|
||||
}
|
||||
|
||||
// marketplace URLs
|
||||
|
||||
async getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes> {
|
||||
|
||||
@@ -160,6 +160,11 @@ export class MockApiService extends ApiService {
|
||||
return null
|
||||
}
|
||||
|
||||
async hardRestartServer (params: RR.RestartServerReq): Promise<RR.RestartServerRes> {
|
||||
await pauseFor(2000)
|
||||
return null
|
||||
}
|
||||
|
||||
// marketplace URLs
|
||||
|
||||
async getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes> {
|
||||
|
||||
Reference in New Issue
Block a user