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