web/admin: show policy binding form when creating policy in bound list

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-12-25 14:59:45 +01:00
parent ae13fc3b92
commit bfa0360764
5 changed files with 65 additions and 26 deletions

View File

@ -11,9 +11,15 @@ import { customElement } from "lit/decorators.js";
*/
@customElement("ak-wizard-page-form")
export class FormWizardPage extends WizardPage {
activePageCallback: (context: FormWizardPage) => Promise<void> = async () => {
return Promise.resolve();
};
activeCallback = async () => {
this.host.isValid = true;
this.activePageCallback(this);
};
nextCallback = async () => {
const form = this.querySelector<Form<unknown>>("*");
if (!form) {
@ -24,7 +30,9 @@ export class FormWizardPage extends WizardPage {
return Promise.reject(t`Form didn't return a promise for submitting`);
}
return formPromise
.then(() => {
.then((data) => {
this.host.state[this.slot] = data;
this.host.canBack = false;
return true;
})
.catch(() => {

View File

@ -22,9 +22,8 @@ export class WizardPage extends AKElement {
return this.parentElement as Wizard;
}
activeCallback: () => Promise<void> = () => {
activeCallback: () => Promise<void> = async () => {
this.host.isValid = false;
return Promise.resolve();
};
nextCallback: () => Promise<boolean> = async () => {