messaging for restart, shutdown, rebuild (#1691)

* messaging for restart, shutdown, rebuild

* fix typo

* better messaging
This commit is contained in:
Matt Hill
2022-07-25 15:28:53 -06:00
committed by GitHub
parent a7cd1e0ce6
commit 61864d082f

View File

@@ -172,13 +172,16 @@ export class ServerShowPage {
} }
private async restart() { private async restart() {
const action = 'Restart'
const loader = await this.loadingCtrl.create({ const loader = await this.loadingCtrl.create({
message: 'Restarting...', message: `Beginning ${action}...`,
}) })
await loader.present() await loader.present()
try { try {
await this.embassyApi.restartServer({}) await this.embassyApi.restartServer({})
this.presentAlertInProgress(action, ` until ${action} completes.`)
} catch (e: any) { } catch (e: any) {
this.errToast.present(e) this.errToast.present(e)
} finally { } finally {
@@ -187,13 +190,19 @@ export class ServerShowPage {
} }
private async shutdown() { private async shutdown() {
const action = 'Shutdown'
const loader = await this.loadingCtrl.create({ const loader = await this.loadingCtrl.create({
message: 'Shutting down...', message: `Beginning ${action}...`,
}) })
await loader.present() await loader.present()
try { try {
await this.embassyApi.shutdownServer({}) await this.embassyApi.shutdownServer({})
this.presentAlertInProgress(
action,
'.<br /><br /><b>You will need to physcally power cycle the device to regain connectivity.</b>',
)
} catch (e: any) { } catch (e: any) {
this.errToast.present(e) this.errToast.present(e)
} finally { } finally {
@@ -202,13 +211,16 @@ export class ServerShowPage {
} }
private async systemRebuild() { private async systemRebuild() {
const action = 'System Rebuild'
const loader = await this.loadingCtrl.create({ const loader = await this.loadingCtrl.create({
message: 'Hard Restarting...', message: `Beginning ${action}...`,
}) })
await loader.present() await loader.present()
try { try {
await this.embassyApi.systemRebuild({}) await this.embassyApi.systemRebuild({})
this.presentAlertInProgress(action, ` until ${action} completes.`)
} catch (e: any) { } catch (e: any) {
this.errToast.present(e) this.errToast.present(e)
} finally { } finally {
@@ -238,7 +250,7 @@ export class ServerShowPage {
} }
} }
async presentAlertLatest() { private async presentAlertLatest() {
const alert = await this.alertCtrl.create({ const alert = await this.alertCtrl.create({
header: 'Up to date!', header: 'Up to date!',
message: 'You are on the latest version of EmbassyOS.', message: 'You are on the latest version of EmbassyOS.',
@@ -254,6 +266,21 @@ export class ServerShowPage {
alert.present() alert.present()
} }
private async presentAlertInProgress(verb: string, message: string) {
const alert = await this.alertCtrl.create({
header: `${verb} In Progress...`,
message: `Stopping all services gracefully. This can take a while.<br /><br />Your Embassy will then <b>♫ play a melody ♫</b> and become unreachable${message}`,
buttons: [
{
text: 'OK',
role: 'cancel',
cssClass: 'enter-click',
},
],
})
alert.present()
}
settings: ServerSettings = { settings: ServerSettings = {
Backups: [ Backups: [
{ {