mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
start alerts
This commit is contained in:
committed by
Aiden McClelland
parent
e1200c2991
commit
8ce43d808e
@@ -46,6 +46,7 @@ export interface AppInstalledFull extends AppInstalledPreview {
|
||||
lastBackup: string | null
|
||||
configuredRequirements: AppDependency[] | null // null if not yet configured
|
||||
hasFetchedFull: boolean
|
||||
startAlert?: string
|
||||
uninstallAlert?: string
|
||||
restoreAlert?: string
|
||||
actions: Actions
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<ion-button *ngIf="vars.status === AppStatus.BROKEN_DEPENDENCIES" expand="block" fill="outline" (click)="scrollToRequirements()">
|
||||
Fix
|
||||
</ion-button>
|
||||
<ion-button *ngIf="vars.status === AppStatus.STOPPED" expand="block" fill="outline" (click)="start()">
|
||||
<ion-button *ngIf="vars.status === AppStatus.STOPPED" expand="block" fill="outline" (click)="tryStart()">
|
||||
Start
|
||||
</ion-button>
|
||||
</ion-label>
|
||||
|
||||
@@ -286,15 +286,13 @@ export class AppInstalledShowPage extends Cleanup {
|
||||
}).catch(e => this.setError(e))
|
||||
}
|
||||
|
||||
async start (): Promise<void> {
|
||||
async tryStart (): Promise<void> {
|
||||
const app = peekProperties(this.app)
|
||||
this.loader.of({
|
||||
message: `Starting ${app.title}...`,
|
||||
spinner: 'lines',
|
||||
cssClass: 'loader',
|
||||
}).displayDuringP(
|
||||
this.apiService.startApp(this.appId),
|
||||
).catch(e => this.setError(e))
|
||||
if (app.startAlert) {
|
||||
this.presentAlertStart(app)
|
||||
} else {
|
||||
this.start(app)
|
||||
}
|
||||
}
|
||||
|
||||
async presentModalBackup (type: 'create' | 'restore') {
|
||||
@@ -387,6 +385,36 @@ export class AppInstalledShowPage extends Cleanup {
|
||||
return await popover.present()
|
||||
}
|
||||
|
||||
private async presentAlertStart (app: AppInstalledFull): Promise<void> {
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'Warning',
|
||||
message: app.startAlert,
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
{
|
||||
text: 'Start',
|
||||
handler: () => {
|
||||
this.start(app)
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
await alert.present()
|
||||
}
|
||||
|
||||
private async start (app: AppInstalledFull): Promise<void> {
|
||||
this.loader.of({
|
||||
message: `Starting ${app.title}...`,
|
||||
spinner: 'lines',
|
||||
cssClass: 'loader',
|
||||
}).displayDuringP(
|
||||
this.apiService.startApp(this.appId),
|
||||
).catch(e => this.setError(e))
|
||||
}
|
||||
|
||||
private setError (e: Error): Observable<void> {
|
||||
this.$error$.next(e.message)
|
||||
return of()
|
||||
|
||||
@@ -53,6 +53,7 @@ export const bitcoinI: AppInstalledFull = {
|
||||
lanEnabled: true,
|
||||
title: 'Bitcoin Core',
|
||||
torAddress: '4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion',
|
||||
startAlert: 'Bitcoind could take a loooooong time to start. Please be patient.',
|
||||
status: AppStatus.STOPPED,
|
||||
iconURL: 'assets/img/service-icons/bitcoind.png',
|
||||
instructions: 'some instructions',
|
||||
|
||||
Reference in New Issue
Block a user