web/admin: trigger update when provider wizard finishes

closes #2599

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-04-04 10:38:26 +02:00
parent 31546da796
commit fc6742a17e
6 changed files with 1907 additions and 2336 deletions

View file

@ -45,7 +45,10 @@ export class Wizard extends ModalButton {
this.requestUpdate();
}
finalHandler?: () => Promise<void>;
@property({ attribute: false })
finalHandler: () => Promise<void> = () => {
return Promise.resolve();
};
renderModalInner(): TemplateResult {
const firstPage = this.querySelector<WizardPage>(`[slot=${this.steps[0]}]`);
@ -116,9 +119,7 @@ export class Wizard extends ModalButton {
return;
}
if (currentIndex === this.steps.length - 1) {
if (this.finalHandler) {
await this.finalHandler();
}
await this.finalHandler();
this.open = false;
} else {
const nextPage = this.querySelector<WizardPage>(

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -146,7 +146,13 @@ export class ApplicationForm extends ModelForm<Application, string> {
<p class="pf-c-form__helper-text">
${t`Select a provider that this application should use. Alternatively, create a new provider.`}
</p>
<ak-provider-wizard createText=${t`Create provider`}> </ak-provider-wizard>
<ak-provider-wizard
.finalHandler=${async () => {
this.requestUpdate();
}}
createText=${t`Create provider`}
>
</ak-provider-wizard>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${t`Policy engine mode`}

View file

@ -65,6 +65,11 @@ export class ProviderWizard extends LitElement {
@property({ attribute: false })
providerTypes: TypeCreate[] = [];
@property({ attribute: false })
finalHandler: () => Promise<void> = () => {
return Promise.resolve();
};
firstUpdated(): void {
new ProvidersApi(DEFAULT_CONFIG).providersAllTypesList().then((types) => {
this.providerTypes = types;
@ -77,6 +82,9 @@ export class ProviderWizard extends LitElement {
.steps=${["initial"]}
header=${t`New provider`}
description=${t`Create a new provider.`}
.finalHandler=${() => {
return this.finalHandler();
}}
>
<ak-provider-wizard-initial
slot="initial"