diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 3862ef698..3eaac95df 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -307,7 +307,7 @@ export class AppComponent { this.updateToast = await this.toastCtrl.create({ header: 'EOS download complete!', - message: `Restart Embassy for changes to take effect.`, + message: 'Restart your Embassy for these updates to take effect. It can take several minutes to come back online.', position: 'bottom', duration: 0, cssClass: 'success-toast', diff --git a/ui/src/app/pages/apps-routes/app-show/app-show.page.html b/ui/src/app/pages/apps-routes/app-show/app-show.page.html index ad2a4404f..44b720e74 100644 --- a/ui/src/app/pages/apps-routes/app-show/app-show.page.html +++ b/ui/src/app/pages/apps-routes/app-show/app-show.page.html @@ -52,7 +52,7 @@ - + Health Checks @@ -67,7 +67,7 @@ - + @@ -79,6 +79,13 @@

{{ $any(health.value).error }}

+ + + +

{{ health.key }}

+

Awaiting result...

+
+
diff --git a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index e3ea77fa7..ce3cd1104 100644 --- a/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -42,7 +42,7 @@ export class AppShowPage { } = { } as any connectionFailure: boolean loading = true - healthChecks: { [id: string]: HealthCheckResult } = { } + healthChecks: { [id: string]: HealthCheckResult | null } installProgress: ProgressData @ViewChild(IonContent) content: IonContent @@ -66,6 +66,11 @@ export class AppShowPage { async ngOnInit () { this.pkgId = this.route.snapshot.paramMap.get('pkgId') this.pkg = this.patch.data['package-data'][this.pkgId] + this.statuses = renderPkgStatus(this.pkg) + this.healthChecks = Object.keys(this.pkg.manifest['health-checks']).reduce((obj, key) => { + obj[key] = null + return obj + }, { }) this.subs = [ // 1 @@ -105,9 +110,13 @@ export class AppShowPage { ) .subscribe(main => { if (main.status === PackageMainStatus.Running) { - this.healthChecks = { ...main.health } + Object.keys(this.healthChecks).forEach(key => { + this.healthChecks[key] = main.health[key] + }) } else { - this.healthChecks = { } + Object.keys(this.healthChecks).forEach(key => { + this.healthChecks[key] = null + }) } }), diff --git a/ui/src/app/pages/notifications/notifications.page.html b/ui/src/app/pages/notifications/notifications.page.html index b87dc2c89..54337b3b0 100644 --- a/ui/src/app/pages/notifications/notifications.page.html +++ b/ui/src/app/pages/notifications/notifications.page.html @@ -65,7 +65,7 @@

{{ not.message }} - + View Report

diff --git a/ui/src/app/pages/notifications/notifications.page.ts b/ui/src/app/pages/notifications/notifications.page.ts index abfa1c7d2..1fac97c0a 100644 --- a/ui/src/app/pages/notifications/notifications.page.ts +++ b/ui/src/app/pages/notifications/notifications.page.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { ApiService } from 'src/app/services/api/embassy-api.service' import { ServerNotification, ServerNotifications } from 'src/app/services/api/api.types' -import { AlertController, LoadingController } from '@ionic/angular' +import { AlertController, LoadingController, AlertButton } from '@ionic/angular' import { ActivatedRoute } from '@angular/router' import { ErrorToastService } from 'src/app/services/error-toast.service' @@ -93,7 +93,7 @@ export class NotificationsPage { const data = notification.data const embassyFailed = !!data.server.error - const packagesFailed = Object.entries(data.packages).some(([_, val]) => val.error) + const packagesFailed = Object.values(data.packages).some(val => val.error) let message: string @@ -103,7 +103,7 @@ export class NotificationsPage { message = 'All items were successfully backed up' } - const buttons: any[] = [ // why can't I import AlertButton? + const buttons: AlertButton[] = [ { text: 'Dismiss', role: 'cancel', 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 a61d0ad7d..860dd4f07 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 @@ -30,7 +30,7 @@ export class ServerShowPage { async presentAlertRestart () { const alert = await this.alertCtrl.create({ header: 'Confirm', - message: `Are you sure you want to restart your Embassy?`, + message: 'Are you sure you want to restart your Embassy? It can take several minutes to come back online.', buttons: [ { text: 'Cancel', @@ -51,7 +51,7 @@ export class ServerShowPage { async presentAlertShutdown () { const alert = await this.alertCtrl.create({ header: 'Warning', - message: `Embassy will remain off. To power back on, you will need to unplug the device and plug it back in.`, + message: 'Are you sure you want to power down your Embassy? This can take several minutes, and your Embassy will not come back online automatically. To power on again, You will need to physically unplug your Embassy and plug it back in.', buttons: [ { text: 'Cancel', 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 709546acf..831b75c02 100644 --- a/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/ui/src/app/services/api/embassy-mock-api.service.ts @@ -445,7 +445,7 @@ export class MockApiService extends ApiService { async startPackageRaw (params: RR.StartPackageReq): Promise { await pauseFor(2000) const path = `/package-data/${params.id}/installed/status/main` - const patch = [ + const patch1 = [ { op: PatchOp.REPLACE, path: path + '/status', @@ -457,7 +457,58 @@ export class MockApiService extends ApiService { value: new Date().toISOString(), }, ] - return this.http.rpcRequest>({ method: 'db.patch', params: { patch } }) + const res = await this.http.rpcRequest>({ method: 'db.patch', params: { patch: patch1 } }) + + setTimeout(async () => { + const patch2 = [ + { + op: PatchOp.REPLACE, + path: path + '/health', + value: { + 'ephemeral-health-check': { + result: 'starting', + }, + 'unnecessary-health-check': { + result: 'disabled', + }, + }, + }, + ] + + await this.http.rpcRequest>({ method: 'db.patch', params: { patch: patch2 } }) + + await pauseFor(2000) + + const patch3 = [ + { + op: PatchOp.REPLACE, + path: path + '/health', + value: { + 'ephemeral-health-check': { + result: 'starting', + }, + 'unnecessary-health-check': { + result: 'disabled', + }, + 'chain-state': { + result: 'loading', + message: 'Bitcoin is syncing from genesis', + }, + 'p2p-interface': { + result: 'success', + }, + 'rpc-interface': { + result: 'failure', + error: 'RPC interface unreachable.', + }, + }, + }, + ] + + await this.http.rpcRequest>({ method: 'db.patch', params: { patch: patch3 } }) + }, 4000) + + return res } async dryStopPackage (params: RR.DryStopPackageReq): Promise { @@ -474,20 +525,25 @@ export class MockApiService extends ApiService { async stopPackageRaw (params: RR.StopPackageReq): Promise { await pauseFor(2000) - const path = `/package-data/${params.id}/installed/status/main/status` + const path = `/package-data/${params.id}/installed/status/main` const patch = [ { op: PatchOp.REPLACE, - path, + path: path + '/status', value: PackageMainStatus.Stopping, }, + { + op: PatchOp.REPLACE, + path: path + '/health', + value: { }, + }, ] const res = await this.http.rpcRequest>({ method: 'db.patch', params: { patch } }) setTimeout(() => { const patch = [ { op: PatchOp.REPLACE, - path, + path: path + '/status', value: PackageMainStatus.Stopped, }, ]