web/admin: use attribute naming scheme for attributes (#14644)

web/standards: use attribute naming scheme for attributes

## What

Renamed the 'inputHint' attribute to 'input-hint', because it is an attribute, not a property.
Properties are camelCased, but attributes are kebab-cased.

Updated all instances where this appears with the usual magic:

```
$ perl -pi.bak -e 's/inputHint="code"/input-hint="code"/' $(rg -l 'inputHint="code"')
```

This fix is in preparation for both the Patternfly 5 project and the Schema-Driven Forms project.

* Revision: You almost certainly do NOT want every field to be reflected.  Booleans are okay, especially for fields that may be changed internally but need to be read by screen-readers, sunch as 'hidden' or 'invalid'.  But if a field is a string or a number and has a default value, you do not want it to be reflected.
This commit is contained in:
Ken Sternberg
2025-06-06 14:49:47 -07:00
committed by GitHub
parent e77a3241f0
commit 6b530ff764
10 changed files with 32 additions and 32 deletions

View File

@ -72,7 +72,7 @@ export class AdminSettingsForm extends Form<SettingsRequest> {
name="avatars" name="avatars"
label=${msg("Avatars")} label=${msg("Avatars")}
value="${ifDefined(this._settings?.avatars)}" value="${ifDefined(this._settings?.avatars)}"
inputHint="code" input-hint="code"
.bighelp=${html` .bighelp=${html`
<p class="pf-c-form__helper-text"> <p class="pf-c-form__helper-text">
${msg( ${msg(
@ -159,7 +159,7 @@ export class AdminSettingsForm extends Form<SettingsRequest> {
<ak-text-input <ak-text-input
name="eventRetention" name="eventRetention"
label=${msg("Event retention")} label=${msg("Event retention")}
inputHint="code" input-hint="code"
required required
value="${ifDefined(this._settings?.eventRetention)}" value="${ifDefined(this._settings?.eventRetention)}"
.bighelp=${html`<p class="pf-c-form__helper-text"> .bighelp=${html`<p class="pf-c-form__helper-text">
@ -237,7 +237,7 @@ export class AdminSettingsForm extends Form<SettingsRequest> {
<ak-text-input <ak-text-input
name="defaultTokenDuration" name="defaultTokenDuration"
label=${msg("Default token duration")} label=${msg("Default token duration")}
inputHint="code" input-hint="code"
required required
value="${ifDefined(this._settings?.defaultTokenDuration)}" value="${ifDefined(this._settings?.defaultTokenDuration)}"
.bighelp=${html`<p class="pf-c-form__helper-text"> .bighelp=${html`<p class="pf-c-form__helper-text">

View File

@ -136,7 +136,7 @@ export class ApplicationForm extends WithCapabilitiesConfig(ModelForm<Applicatio
label=${msg("Slug")} label=${msg("Slug")}
required required
help=${msg("Internal application name used in URLs.")} help=${msg("Internal application name used in URLs.")}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-text-input <ak-text-input
name="group" name="group"
@ -145,7 +145,7 @@ export class ApplicationForm extends WithCapabilitiesConfig(ModelForm<Applicatio
help=${msg( help=${msg(
"Optionally enter a group name. Applications with identical groups are shown grouped together.", "Optionally enter a group name. Applications with identical groups are shown grouped together.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-provider-search-input <ak-provider-search-input
name="provider" name="provider"
@ -186,7 +186,7 @@ export class ApplicationForm extends WithCapabilitiesConfig(ModelForm<Applicatio
help=${msg( help=${msg(
"If left empty, authentik will try to extract the launch URL based on the selected provider.", "If left empty, authentik will try to extract the launch URL based on the selected provider.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-switch-input <ak-switch-input
name="openInNewTab" name="openInNewTab"

View File

@ -128,7 +128,7 @@ export class ApplicationWizardApplicationStep extends ApplicationWizardStep {
?invalid=${errors.slug ?? this.errors.has("slug")} ?invalid=${errors.slug ?? this.errors.has("slug")}
.errorMessages=${this.errorMessages("slug")} .errorMessages=${this.errorMessages("slug")}
help=${msg("Internal application name used in URLs.")} help=${msg("Internal application name used in URLs.")}
inputHint="code" input-hint="code"
></ak-slug-input> ></ak-slug-input>
<ak-text-input <ak-text-input
name="group" name="group"
@ -138,7 +138,7 @@ export class ApplicationWizardApplicationStep extends ApplicationWizardStep {
help=${msg( help=${msg(
"Optionally enter a group name. Applications with identical groups are shown grouped together.", "Optionally enter a group name. Applications with identical groups are shown grouped together.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-radio-input <ak-radio-input
label=${msg("Policy engine mode")} label=${msg("Policy engine mode")}
@ -161,7 +161,7 @@ export class ApplicationWizardApplicationStep extends ApplicationWizardStep {
help=${msg( help=${msg(
"If left empty, authentik will try to extract the launch URL based on the selected provider.", "If left empty, authentik will try to extract the launch URL based on the selected provider.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-switch-input <ak-switch-input
name="openInNewTab" name="openInNewTab"

View File

@ -57,7 +57,7 @@ export class ApplicationWizardRACProviderForm extends ApplicationWizardProviderF
help=${msg( help=${msg(
"Determines how long a session lasts before being disconnected and requiring re-authorization.", "Determines how long a session lasts before being disconnected and requiring re-authorization.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-form-group .expanded=${true}> <ak-form-group .expanded=${true}>

View File

@ -127,7 +127,7 @@ export function renderForm(
label=${msg("Base DN")} label=${msg("Base DN")}
required required
value="${provider?.baseDn ?? "DC=ldap,DC=goauthentik,DC=io"}" value="${provider?.baseDn ?? "DC=ldap,DC=goauthentik,DC=io"}"
inputHint="code" input-hint="code"
.errorMessages=${errors?.baseDn ?? []} .errorMessages=${errors?.baseDn ?? []}
help=${msg( help=${msg(
"LDAP DN under which bind requests and search requests can be made.", "LDAP DN under which bind requests and search requests can be made.",
@ -154,7 +154,7 @@ export function renderForm(
value="${provider?.tlsServerName ?? ""}" value="${provider?.tlsServerName ?? ""}"
.errorMessages=${errors?.tlsServerName ?? []} .errorMessages=${errors?.tlsServerName ?? []}
help=${tlsServerNameHelp} help=${tlsServerNameHelp}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-number-input <ak-number-input

View File

@ -163,14 +163,14 @@ export function renderForm(
label=${msg("Client ID")} label=${msg("Client ID")}
value="${provider?.clientId ?? randomString(40, ascii_letters + digits)}" value="${provider?.clientId ?? randomString(40, ascii_letters + digits)}"
required required
inputHint="code" input-hint="code"
> >
</ak-text-input> </ak-text-input>
<ak-text-input <ak-text-input
name="clientSecret" name="clientSecret"
label=${msg("Client Secret")} label=${msg("Client Secret")}
value="${provider?.clientSecret ?? randomString(128, ascii_letters + digits)}" value="${provider?.clientSecret ?? randomString(128, ascii_letters + digits)}"
inputHint="code" input-hint="code"
?hidden=${!showClientSecret} ?hidden=${!showClientSecret}
> >
</ak-text-input> </ak-text-input>
@ -252,7 +252,7 @@ export function renderForm(
<ak-text-input <ak-text-input
name="accessCodeValidity" name="accessCodeValidity"
label=${msg("Access code validity")} label=${msg("Access code validity")}
inputHint="code" input-hint="code"
required required
value="${provider?.accessCodeValidity ?? "minutes=1"}" value="${provider?.accessCodeValidity ?? "minutes=1"}"
.bighelp=${html`<p class="pf-c-form__helper-text"> .bighelp=${html`<p class="pf-c-form__helper-text">
@ -265,7 +265,7 @@ export function renderForm(
name="accessTokenValidity" name="accessTokenValidity"
label=${msg("Access Token validity")} label=${msg("Access Token validity")}
value="${provider?.accessTokenValidity ?? "minutes=5"}" value="${provider?.accessTokenValidity ?? "minutes=5"}"
inputHint="code" input-hint="code"
required required
.bighelp=${html` <p class="pf-c-form__helper-text"> .bighelp=${html` <p class="pf-c-form__helper-text">
${msg("Configure how long access tokens are valid for.")} ${msg("Configure how long access tokens are valid for.")}
@ -278,7 +278,7 @@ export function renderForm(
name="refreshTokenValidity" name="refreshTokenValidity"
label=${msg("Refresh Token validity")} label=${msg("Refresh Token validity")}
value="${provider?.refreshTokenValidity ?? "days=30"}" value="${provider?.refreshTokenValidity ?? "days=30"}"
inputHint="code" input-hint="code"
?required=${true} ?required=${true}
.bighelp=${html` <p class="pf-c-form__helper-text"> .bighelp=${html` <p class="pf-c-form__helper-text">
${msg("Configure how long refresh tokens are valid for.")} ${msg("Configure how long refresh tokens are valid for.")}

View File

@ -48,7 +48,7 @@ function renderHttpBasic(provider: Partial<ProxyProvider>) {
help=${msg( help=${msg(
"User/Group Attribute used for the user part of the HTTP-Basic Header. If not set, the user's Email address is used.", "User/Group Attribute used for the user part of the HTTP-Basic Header. If not set, the user's Email address is used.",
)} )}
inputHint="code" input-hint="code"
> >
</ak-text-input> </ak-text-input>
@ -57,7 +57,7 @@ function renderHttpBasic(provider: Partial<ProxyProvider>) {
label=${msg("HTTP-Basic Password Key")} label=${msg("HTTP-Basic Password Key")}
value="${ifDefined(provider?.basicAuthPasswordAttribute)}" value="${ifDefined(provider?.basicAuthPasswordAttribute)}"
help=${msg("User/Group Attribute used for the password part of the HTTP-Basic Header.")} help=${msg("User/Group Attribute used for the password part of the HTTP-Basic Header.")}
inputHint="code" input-hint="code"
> >
</ak-text-input>`; </ak-text-input>`;
} }
@ -90,7 +90,7 @@ function renderProxySettings(provider: Partial<ProxyProvider>, errors?: Validati
help=${msg( help=${msg(
"The external URL you'll access the application at. Include any non-standard port.", "The external URL you'll access the application at. Include any non-standard port.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-text-input <ak-text-input
name="internalHost" name="internalHost"
@ -99,7 +99,7 @@ function renderProxySettings(provider: Partial<ProxyProvider>, errors?: Validati
required required
.errorMessages=${errors?.internalHost ?? []} .errorMessages=${errors?.internalHost ?? []}
help=${msg("Upstream host that the requests are forwarded to.")} help=${msg("Upstream host that the requests are forwarded to.")}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-switch-input <ak-switch-input
@ -126,7 +126,7 @@ function renderForwardSingleSettings(provider: Partial<ProxyProvider>, errors?:
help=${msg( help=${msg(
"The external URL you'll access the application at. Include any non-standard port.", "The external URL you'll access the application at. Include any non-standard port.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input>`; ></ak-text-input>`;
} }
@ -225,7 +225,7 @@ export function renderForm(
.errorMessages=${errors?.accessTokenValidity ?? []} .errorMessages=${errors?.accessTokenValidity ?? []}
required required
.help=${msg("Configure how long tokens are valid for.")} .help=${msg("Configure how long tokens are valid for.")}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-form-group> <ak-form-group>

View File

@ -80,7 +80,7 @@ export function renderForm(
.errorMessages=${errors?.sharedSecret ?? []} .errorMessages=${errors?.sharedSecret ?? []}
value=${provider?.sharedSecret ?? randomString(128, ascii_letters + digits)} value=${provider?.sharedSecret ?? randomString(128, ascii_letters + digits)}
required required
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-text-input <ak-text-input
name="clientNetworks" name="clientNetworks"
@ -89,7 +89,7 @@ export function renderForm(
.errorMessages=${errors?.clientNetworks ?? []} .errorMessages=${errors?.clientNetworks ?? []}
required required
help=${clientNetworksHelp} help=${clientNetworksHelp}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-form-element-horizontal <ak-form-element-horizontal
label=${msg("Property mappings")} label=${msg("Property mappings")}

View File

@ -40,7 +40,7 @@ export function renderForm(provider?: Partial<SCIMProvider>, errors: ValidationE
.errorMessages=${errors?.url ?? []} .errorMessages=${errors?.url ?? []}
required required
help=${msg("SCIM base url, usually ends in /v2.")} help=${msg("SCIM base url, usually ends in /v2.")}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-switch-input <ak-switch-input
@ -59,7 +59,7 @@ export function renderForm(provider?: Partial<SCIMProvider>, errors: ValidationE
help=${msg( help=${msg(
"Token to authenticate with. Currently only bearer authentication is supported.", "Token to authenticate with. Currently only bearer authentication is supported.",
)} )}
inputHint="code" input-hint="code"
></ak-text-input> ></ak-text-input>
<ak-radio-input <ak-radio-input
name="compatibilityMode" name="compatibilityMode"

View File

@ -18,13 +18,13 @@ export class HorizontalLightComponent<T> extends AKElement {
return this; return this;
} }
@property({ type: String }) @property({ type: String, reflect: true })
name!: string; name!: string;
@property({ type: String }) @property({ type: String })
label = ""; label = "";
@property({ type: Boolean }) @property({ type: Boolean, reflect: true })
required = false; required = false;
@property({ type: String }) @property({ type: String })
@ -33,10 +33,10 @@ export class HorizontalLightComponent<T> extends AKElement {
@property({ type: Object }) @property({ type: Object })
bighelp?: TemplateResult | TemplateResult[]; bighelp?: TemplateResult | TemplateResult[];
@property({ type: Boolean }) @property({ type: Boolean, reflect: true })
hidden = false; hidden = false;
@property({ type: Boolean }) @property({ type: Boolean, reflect: true })
invalid = false; invalid = false;
@property({ attribute: false }) @property({ attribute: false })
@ -45,7 +45,7 @@ export class HorizontalLightComponent<T> extends AKElement {
@property({ attribute: false }) @property({ attribute: false })
value?: T; value?: T;
@property({ type: String }) @property({ type: String, attribute: "input-hint" })
inputHint = ""; inputHint = "";
renderControl() { renderControl() {