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(); this.requestUpdate();
} }
finalHandler?: () => Promise<void>; @property({ attribute: false })
finalHandler: () => Promise<void> = () => {
return Promise.resolve();
};
renderModalInner(): TemplateResult { renderModalInner(): TemplateResult {
const firstPage = this.querySelector<WizardPage>(`[slot=${this.steps[0]}]`); const firstPage = this.querySelector<WizardPage>(`[slot=${this.steps[0]}]`);
@ -116,9 +119,7 @@ export class Wizard extends ModalButton {
return; return;
} }
if (currentIndex === this.steps.length - 1) { if (currentIndex === this.steps.length - 1) {
if (this.finalHandler) {
await this.finalHandler(); await this.finalHandler();
}
this.open = false; this.open = false;
} else { } else {
const nextPage = this.querySelector<WizardPage>( 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"> <p class="pf-c-form__helper-text">
${t`Select a provider that this application should use. Alternatively, create a new provider.`} ${t`Select a provider that this application should use. Alternatively, create a new provider.`}
</p> </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>
<ak-form-element-horizontal <ak-form-element-horizontal
label=${t`Policy engine mode`} label=${t`Policy engine mode`}

View File

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