hard restart feature

This commit is contained in:
Drew Ansbacher
2022-01-19 13:26:41 -07:00
committed by Aiden McClelland
parent 1dccde4923
commit 0809ff9f57
5 changed files with 62 additions and 0 deletions

View File

@@ -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),
},
],
}

View File

@@ -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

View File

@@ -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>

View File

@@ -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> {

View File

@@ -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> {