refactor app wizards completely (#1537)

* refactor app wizards completely

* display new and new options in config

Co-authored-by: Matt Hill <matthill@Matt-M1.start9.dev>
This commit is contained in:
Matt Hill
2022-06-14 18:25:43 -06:00
committed by Lucy C
parent 8e9d2b5314
commit 4ad9886517
52 changed files with 850 additions and 1126 deletions

View File

@@ -0,0 +1,34 @@
import { Component, EventEmitter, Input, Output } from '@angular/core'
import { capitalizeFirstLetter } from '@start9labs/shared'
import { BaseSlide } from '../wizard-types'
@Component({
selector: 'complete',
templateUrl: './complete.component.html',
styleUrls: ['../app-wizard.component.scss'],
})
export class CompleteComponent implements BaseSlide {
@Input() params: {
verb: string // loader verb: '*stopping* ...'
title: string
Fn: () => Promise<any>
}
@Output() onSuccess: EventEmitter<void> = new EventEmitter()
@Output() onError: EventEmitter<string> = new EventEmitter()
message: string
loading = true
async load() {
this.message =
capitalizeFirstLetter(this.params.verb) + ' ' + this.params.title
try {
await this.params.Fn()
this.onSuccess.emit()
} catch (e: any) {
this.onError.emit(`Error: ${e.message || e}`)
}
}
}