From 2eb7c16a9af9a772ffefd65e468431acba46cf50 Mon Sep 17 00:00:00 2001 From: Jens L Date: Wed, 1 Mar 2023 16:14:32 +0100 Subject: [PATCH] web/admin: set valid correctly when opened and radio is already selected (#4821) closes #4813 Signed-off-by: Jens Langhammer --- SECURITY.md | 1 + web/src/admin/outposts/ServiceConnectionWizard.ts | 11 +++++++++++ web/src/admin/policies/PolicyWizard.ts | 11 +++++++++++ .../property-mappings/PropertyMappingWizard.ts | 11 +++++++++++ web/src/admin/providers/ProviderWizard.ts | 13 ++++++++++++- web/src/admin/sources/SourceWizard.ts | 11 +++++++++++ web/src/admin/stages/StageWizard.ts | 11 +++++++++++ 7 files changed, 68 insertions(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 84e8d4993..f27a1e1a8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,6 +8,7 @@ Authentik takes security very seriously. We follow the rules of [responsible dis | --------- | ------------------ | | 2022.12.x | :white_check_mark: | | 2023.1.x | :white_check_mark: | +| 2023.2.x | :white_check_mark: | ## Reporting a Vulnerability diff --git a/web/src/admin/outposts/ServiceConnectionWizard.ts b/web/src/admin/outposts/ServiceConnectionWizard.ts index 417538a1c..84ee1e5c3 100644 --- a/web/src/admin/outposts/ServiceConnectionWizard.ts +++ b/web/src/admin/outposts/ServiceConnectionWizard.ts @@ -31,6 +31,17 @@ export class InitialServiceConnectionWizardPage extends WizardPage { } sidebarLabel = () => t`Select type`; + activeCallback: () => Promise = async () => { + this.host.isValid = false; + this.shadowRoot + ?.querySelectorAll("input[type=radio]") + .forEach((radio) => { + if (radio.checked) { + this.host.isValid = true; + } + }); + }; + render(): TemplateResult { return html`
${this.connectionTypes.map((type) => { diff --git a/web/src/admin/policies/PolicyWizard.ts b/web/src/admin/policies/PolicyWizard.ts index eb8575d97..e79fe8fb3 100644 --- a/web/src/admin/policies/PolicyWizard.ts +++ b/web/src/admin/policies/PolicyWizard.ts @@ -37,6 +37,17 @@ export class InitialPolicyWizardPage extends WizardPage { } sidebarLabel = () => t`Select type`; + activeCallback: () => Promise = async () => { + this.host.isValid = false; + this.shadowRoot + ?.querySelectorAll("input[type=radio]") + .forEach((radio) => { + if (radio.checked) { + this.host.isValid = true; + } + }); + }; + render(): TemplateResult { return html` ${this.policyTypes.map((type) => { diff --git a/web/src/admin/property-mappings/PropertyMappingWizard.ts b/web/src/admin/property-mappings/PropertyMappingWizard.ts index 60f3364bb..32c75be51 100644 --- a/web/src/admin/property-mappings/PropertyMappingWizard.ts +++ b/web/src/admin/property-mappings/PropertyMappingWizard.ts @@ -34,6 +34,17 @@ export class InitialPropertyMappingWizardPage extends WizardPage { } sidebarLabel = () => t`Select type`; + activeCallback: () => Promise = async () => { + this.host.isValid = false; + this.shadowRoot + ?.querySelectorAll("input[type=radio]") + .forEach((radio) => { + if (radio.checked) { + this.host.isValid = true; + } + }); + }; + render(): TemplateResult { return html` ${this.mappingTypes.map((type) => { diff --git a/web/src/admin/providers/ProviderWizard.ts b/web/src/admin/providers/ProviderWizard.ts index c2ffff4fd..82a7f7836 100644 --- a/web/src/admin/providers/ProviderWizard.ts +++ b/web/src/admin/providers/ProviderWizard.ts @@ -36,6 +36,17 @@ export class InitialProviderWizardPage extends WizardPage { } sidebarLabel = () => t`Select type`; + activeCallback: () => Promise = async () => { + this.host.isValid = false; + this.shadowRoot + ?.querySelectorAll("input[type=radio]") + .forEach((radio) => { + if (radio.checked) { + this.host.isValid = true; + } + }); + }; + renderHint(): TemplateResult { return html`
${t`Try the new application wizard`}
@@ -56,7 +67,7 @@ export class InitialProviderWizardPage extends WizardPage { } render(): TemplateResult { - return html` + return html` ${this.providerTypes.map((type) => { return html`
t`Select type`; + activeCallback: () => Promise = async () => { + this.host.isValid = false; + this.shadowRoot + ?.querySelectorAll("input[type=radio]") + .forEach((radio) => { + if (radio.checked) { + this.host.isValid = true; + } + }); + }; + render(): TemplateResult { return html` ${this.sourceTypes.map((type) => { diff --git a/web/src/admin/stages/StageWizard.ts b/web/src/admin/stages/StageWizard.ts index 98fd9cd48..2ab588aa3 100644 --- a/web/src/admin/stages/StageWizard.ts +++ b/web/src/admin/stages/StageWizard.ts @@ -50,6 +50,17 @@ export class InitialStageWizardPage extends WizardPage { return [PFBase, PFForm, PFButton, AKGlobal, PFRadio]; } + activeCallback: () => Promise = async () => { + this.host.isValid = false; + this.shadowRoot + ?.querySelectorAll("input[type=radio]") + .forEach((radio) => { + if (radio.checked) { + this.host.isValid = true; + } + }); + }; + render(): TemplateResult { return html` ${this.stageTypes.map((type) => {