mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 06:19:44 +00:00
refactor loaders, better err toasts, rework Embassy tab organization
This commit is contained in:
committed by
Aiden McClelland
parent
b19bde96cd
commit
1d777b18b3
@@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core'
|
||||
import { LoadingController, ModalController } from '@ionic/angular'
|
||||
import { ConfigCursor } from 'src/app/pkg-config/config-cursor'
|
||||
import { ValueSpecObject } from 'src/app/pkg-config/config-types'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { Action } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
@Component({
|
||||
@@ -20,8 +20,8 @@ export class AppActionInputPage {
|
||||
|
||||
constructor (
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly loadingCtrl: LoadingController,
|
||||
private loaderService: LoaderService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
@@ -35,18 +35,21 @@ export class AppActionInputPage {
|
||||
}
|
||||
|
||||
async save (): Promise<void> {
|
||||
this.loaderService.of({
|
||||
const loader = await this.loadingCtrl.create({
|
||||
spinner: 'lines',
|
||||
message: 'Executing action',
|
||||
cssClass: 'loader-ontop-of-all',
|
||||
}).displayDuringAsync(async () => {
|
||||
try {
|
||||
await this.execute()
|
||||
this.modalCtrl.dismiss()
|
||||
} catch (e) {
|
||||
this.error = e.message
|
||||
}
|
||||
})
|
||||
await loader.present()
|
||||
|
||||
try {
|
||||
await this.execute()
|
||||
this.modalCtrl.dismiss()
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
} finally {
|
||||
loader.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
handleObjectEdit (): void {
|
||||
|
||||
Reference in New Issue
Block a user