web/flows: fix sub_text not rendering for static fields

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-01 20:54:43 +01:00
parent af83308fd4
commit a92bce322d
4 changed files with 35 additions and 3 deletions

View file

@ -99,8 +99,16 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
?required=${prompt.required}>`; ?required=${prompt.required}>`;
case PromptTypeEnum.Static: case PromptTypeEnum.Static:
return `<p>${prompt.placeholder}</p>`; return `<p>${prompt.placeholder}</p>`;
default:
return `<p>invalid type '${prompt.type}'</p>`;
} }
return ""; }
renderPromptHelpText(prompt: StagePrompt): TemplateResult {
if (prompt.subText === "") {
return html``;
}
return html`<p class="pf-c-form__helper-text">${unsafeHTML(prompt.subText)}</p>`;
} }
render(): TemplateResult { render(): TemplateResult {
@ -141,7 +149,10 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
prompt.type === PromptTypeEnum.Hidden || prompt.type === PromptTypeEnum.Hidden ||
prompt.type === PromptTypeEnum.Separator prompt.type === PromptTypeEnum.Separator
) { ) {
return unsafeHTML(this.renderPromptInner(prompt)); return html`
${unsafeHTML(this.renderPromptInner(prompt))}
${this.renderPromptHelpText(prompt)}
`;
} }
return html`<ak-form-element return html`<ak-form-element
label="${prompt.label}" label="${prompt.label}"
@ -150,7 +161,7 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
.errors=${(this.challenge?.responseErrors || {})[prompt.fieldKey]} .errors=${(this.challenge?.responseErrors || {})[prompt.fieldKey]}
> >
${unsafeHTML(this.renderPromptInner(prompt))} ${unsafeHTML(this.renderPromptInner(prompt))}
<p class="pf-c-form__helper-text">${unsafeHTML(prompt.subText)}</p> ${this.renderPromptHelpText(prompt)}
</ak-form-element>`; </ak-form-element>`;
})} })}
${"non_field_errors" in (this.challenge?.responseErrors || {}) ${"non_field_errors" in (this.challenge?.responseErrors || {})

View file

@ -202,6 +202,10 @@ msgstr "Addition User DN"
msgid "Additional group DN, prepended to the Base DN." msgid "Additional group DN, prepended to the Base DN."
msgstr "Additional group DN, prepended to the Base DN." msgstr "Additional group DN, prepended to the Base DN."
#: src/pages/providers/proxy/ProxyProviderForm.ts
msgid "Additional scope mappings, which are passed to the proxy."
msgstr "Additional scope mappings, which are passed to the proxy."
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
msgid "Additional settings" msgid "Additional settings"
msgstr "Additional settings" msgstr "Additional settings"
@ -2148,6 +2152,7 @@ msgstr "Hide service-accounts"
#: src/pages/events/RuleForm.ts #: src/pages/events/RuleForm.ts
#: src/pages/outposts/OutpostForm.ts #: src/pages/outposts/OutpostForm.ts
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
@ -2538,6 +2543,7 @@ msgstr "Loading"
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts #: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts #: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
@ -3774,6 +3780,7 @@ msgstr "Scope which the client can specify to access these properties."
#: src/elements/oauth/UserCodeList.ts #: src/elements/oauth/UserCodeList.ts
#: src/elements/oauth/UserRefreshList.ts #: src/elements/oauth/UserRefreshList.ts
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
msgid "Scopes" msgid "Scopes"
msgstr "Scopes" msgstr "Scopes"

View file

@ -207,6 +207,10 @@ msgstr "Préfixe DN utilisateurs"
msgid "Additional group DN, prepended to the Base DN." msgid "Additional group DN, prepended to the Base DN."
msgstr "DN à préfixer au DN de base pour les groupes" msgstr "DN à préfixer au DN de base pour les groupes"
#: src/pages/providers/proxy/ProxyProviderForm.ts
msgid "Additional scope mappings, which are passed to the proxy."
msgstr ""
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
msgid "Additional settings" msgid "Additional settings"
msgstr "Paramètres supplémentaire" msgstr "Paramètres supplémentaire"
@ -2131,6 +2135,7 @@ msgstr "Cacher les comptes de service"
#: src/pages/events/RuleForm.ts #: src/pages/events/RuleForm.ts
#: src/pages/outposts/OutpostForm.ts #: src/pages/outposts/OutpostForm.ts
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
@ -2519,6 +2524,7 @@ msgstr "Chargement en cours"
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts #: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts #: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
@ -3742,6 +3748,7 @@ msgstr "Portée que le client peut spécifier pour accéder à ces propriétés.
#: src/elements/oauth/UserCodeList.ts #: src/elements/oauth/UserCodeList.ts
#: src/elements/oauth/UserRefreshList.ts #: src/elements/oauth/UserRefreshList.ts
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
msgid "Scopes" msgid "Scopes"
msgstr "Portées" msgstr "Portées"

View file

@ -202,6 +202,10 @@ msgstr ""
msgid "Additional group DN, prepended to the Base DN." msgid "Additional group DN, prepended to the Base DN."
msgstr "" msgstr ""
#: src/pages/providers/proxy/ProxyProviderForm.ts
msgid "Additional scope mappings, which are passed to the proxy."
msgstr ""
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
msgid "Additional settings" msgid "Additional settings"
msgstr "" msgstr ""
@ -2140,6 +2144,7 @@ msgstr ""
#: src/pages/events/RuleForm.ts #: src/pages/events/RuleForm.ts
#: src/pages/outposts/OutpostForm.ts #: src/pages/outposts/OutpostForm.ts
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
#: src/pages/sources/ldap/LDAPSourceForm.ts #: src/pages/sources/ldap/LDAPSourceForm.ts
@ -2530,6 +2535,7 @@ msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts #: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts #: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
@ -3766,6 +3772,7 @@ msgstr ""
#: src/elements/oauth/UserCodeList.ts #: src/elements/oauth/UserCodeList.ts
#: src/elements/oauth/UserRefreshList.ts #: src/elements/oauth/UserRefreshList.ts
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
#: src/pages/providers/proxy/ProxyProviderForm.ts
msgid "Scopes" msgid "Scopes"
msgstr "" msgstr ""