mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
* begin subnav implementation * implement subnav AND angular forms for comparison * unions working-ish, list of enums working * new form approach almost complete * finish new forms approach for action inputs and config * expandable list items and handlebars display * Config animation (#394) * config cammel * config animation Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com> * improve server settings inputs, still needs work * delete all notifications, styling, and bugs * contracted by default Co-authored-by: Drew Ansbacher <drew.ansbacher@gmail.com> Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Component, Input } from '@angular/core'
|
|
import { FormGroup } from '@angular/forms'
|
|
import { ModalController } from '@ionic/angular'
|
|
import { Action } from 'src/app/services/patch-db/data-model'
|
|
import { FormService } from 'src/app/services/form.service'
|
|
|
|
@Component({
|
|
selector: 'app-action-input',
|
|
templateUrl: './app-action-input.page.html',
|
|
styleUrls: ['./app-action-input.page.scss'],
|
|
})
|
|
export class AppActionInputPage {
|
|
@Input() action: Action
|
|
actionForm: FormGroup
|
|
|
|
constructor (
|
|
private readonly modalCtrl: ModalController,
|
|
private readonly formService: FormService,
|
|
) { }
|
|
|
|
ngOnInit () {
|
|
this.actionForm = this.formService.createForm(this.action['input-spec'])
|
|
}
|
|
|
|
async dismiss (): Promise<void> {
|
|
this.modalCtrl.dismiss()
|
|
}
|
|
|
|
async save (): Promise<void> {
|
|
if (this.actionForm.invalid) {
|
|
this.actionForm.markAllAsTouched()
|
|
document.getElementsByClassName('validation-error')[0].parentElement.parentElement.scrollIntoView({ behavior: 'smooth' })
|
|
return
|
|
}
|
|
this.modalCtrl.dismiss(this.actionForm.value)
|
|
}
|
|
|
|
asIsOrder () {
|
|
return 0
|
|
}
|
|
}
|