diff --git a/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/ui/src/app/pages/server-routes/server-show/server-show.page.ts index 2186d3cd0..e75b63895 100644 --- a/ui/src/app/pages/server-routes/server-show/server-show.page.ts +++ b/ui/src/app/pages/server-routes/server-show/server-show.page.ts @@ -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), + }, ], } diff --git a/ui/src/app/services/api/api.types.ts b/ui/src/app/services/api/api.types.ts index 90979e095..46a21469b 100644 --- a/ui/src/app/services/api/api.types.ts +++ b/ui/src/app/services/api/api.types.ts @@ -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 diff --git a/ui/src/app/services/api/embassy-api.service.ts b/ui/src/app/services/api/embassy-api.service.ts index 101cc2e4a..5ed3f7bbc 100644 --- a/ui/src/app/services/api/embassy-api.service.ts +++ b/ui/src/app/services/api/embassy-api.service.ts @@ -68,6 +68,8 @@ export abstract class ApiService implements Source, Http { abstract shutdownServer (params: RR.ShutdownServerReq): Promise + abstract hardRestartServer (params: RR.HardRestartServerReq): Promise + // marketplace URLs abstract getEos (params: RR.GetMarketplaceEOSReq): Promise diff --git a/ui/src/app/services/api/embassy-live-api.service.ts b/ui/src/app/services/api/embassy-live-api.service.ts index 3055b3453..505371346 100644 --- a/ui/src/app/services/api/embassy-live-api.service.ts +++ b/ui/src/app/services/api/embassy-live-api.service.ts @@ -80,6 +80,10 @@ export class LiveApiService extends ApiService { return this.http.rpcRequest({ method: 'server.shutdown', params }) } + async hardRestartServer (params: RR.RestartServerReq): Promise { + return this.http.rpcRequest({ method: 'server.hard-restart', params }) + } + // marketplace URLs async getEos (params: RR.GetMarketplaceEOSReq): Promise { diff --git a/ui/src/app/services/api/embassy-mock-api.service.ts b/ui/src/app/services/api/embassy-mock-api.service.ts index 92c5b8ff4..428d9acd9 100644 --- a/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/ui/src/app/services/api/embassy-mock-api.service.ts @@ -160,6 +160,11 @@ export class MockApiService extends ApiService { return null } + async hardRestartServer (params: RR.RestartServerReq): Promise { + await pauseFor(2000) + return null + } + // marketplace URLs async getEos (params: RR.GetMarketplaceEOSReq): Promise {