Skip to content

web/standards: fix boolean attribute abuse #14662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
89dad07
web: Add InvalidationFlow to Radius Provider dialogues
kensternberg-authentik Oct 23, 2024
914993a
Merge branch 'main' into dev
kensternberg-authentik Oct 30, 2024
f25a9c6
Merge branch 'main' into dev
kensternberg-authentik Nov 4, 2024
e0d5df8
Merge branch 'main' into dev
kensternberg-authentik Nov 4, 2024
7579090
Merge branch 'main' into dev
kensternberg-authentik Nov 4, 2024
3244276
Merge branch 'main' into dev
kensternberg-authentik Nov 7, 2024
5cc2c0f
Merge branch 'main' into dev
kensternberg-authentik Nov 7, 2024
831797b
Merge branch 'main' into dev
kensternberg-authentik Nov 12, 2024
36b10b4
:wqge branch 'main' into dev
kensternberg-authentik Nov 14, 2024
e7527c5
Merge branch 'main' into dev
kensternberg-authentik Nov 15, 2024
9809b94
Merge branch 'main' into dev
kensternberg-authentik Nov 20, 2024
67aed3e
Merge branch 'main' into dev
kensternberg-authentik Nov 22, 2024
5b8d86b
Merge branch 'main' into dev
kensternberg-authentik Nov 25, 2024
67b3274
Merge branch 'main' into dev
kensternberg-authentik Nov 25, 2024
20b66f8
Merge branch 'main' into dev
kensternberg-authentik Nov 26, 2024
fe9e452
Merge branch 'main' into dev
kensternberg-authentik Dec 2, 2024
9cc440e
Merge branch 'main' into dev
kensternberg-authentik Dec 5, 2024
7bb6a3d
Merge branch 'main' into dev
kensternberg-authentik Dec 9, 2024
1dcf910
Merge branch 'main' into dev
kensternberg-authentik Dec 10, 2024
6d7fc94
Merge branch 'main' into dev
kensternberg-authentik Dec 26, 2024
dddde09
This (temporary) change is needed to prevent the unit tests from fail…
kensternberg-authentik Dec 26, 2024
f6afb59
Revert "This (temporary) change is needed to prevent the unit tests f…
kensternberg-authentik Dec 26, 2024
bd0e81b
Merge branch 'main' into dev
kensternberg-authentik Jan 2, 2025
be349e2
Merge branch 'main' into dev
kensternberg-authentik Jan 3, 2025
854427e
Merge branch 'main' into dev
kensternberg-authentik Jan 6, 2025
7d972ec
Merge branch 'main' into dev
kensternberg-authentik Jan 8, 2025
50d2f69
Merge branch 'main' into dev
kensternberg-authentik Jan 11, 2025
25eefb7
Merge branch 'main' into dev
kensternberg-authentik Jan 21, 2025
457b61c
Merge branch 'main' into dev
kensternberg-authentik Jan 22, 2025
e338bef
Merge branch 'main' into dev
kensternberg-authentik Feb 13, 2025
675e60b
Merge branch 'main' into dev
kensternberg-authentik Feb 13, 2025
2279768
Merge branch 'main' into dev
kensternberg-authentik Feb 14, 2025
ffbe8fb
Merge branch 'main' into dev
kensternberg-authentik Feb 17, 2025
19f25d5
Merge branch 'main' into dev
kensternberg-authentik Feb 19, 2025
811e794
Merge branch 'main' into dev
kensternberg-authentik Mar 4, 2025
75c61af
Merge branch 'main' into dev
kensternberg-authentik Mar 5, 2025
aa20df5
Merge branch 'main' into dev
kensternberg-authentik Mar 6, 2025
5fe344f
Merge branch 'main' into dev
kensternberg-authentik Mar 7, 2025
6838736
Merge branch 'main' into dev
kensternberg-authentik Mar 11, 2025
0055882
Merge branch 'main' into dev
kensternberg-authentik Mar 11, 2025
9251e60
Merge branch 'main' into dev
kensternberg-authentik Mar 11, 2025
cd78fc0
Merge branch 'main' into dev
kensternberg-authentik Mar 14, 2025
fa994ae
Merge branch 'main' into dev
kensternberg-authentik Mar 17, 2025
61dbc93
Merge branch 'main' into dev
kensternberg-authentik Mar 24, 2025
f63b3c2
Merge branch 'main' into dev
kensternberg-authentik Mar 24, 2025
9cf551b
Merge branch 'main' into dev
kensternberg-authentik Apr 9, 2025
9a6ca4f
Merge branch 'main' into dev
kensternberg-authentik Apr 15, 2025
8b95840
Merge branch 'main' into dev
kensternberg-authentik Apr 22, 2025
baa64bc
Merge branch 'main' into dev
kensternberg-authentik Apr 23, 2025
518e9e1
Merge branch 'main' into dev
kensternberg-authentik Apr 24, 2025
5da3493
Merge branch 'main' into dev
kensternberg-authentik Apr 25, 2025
136e59c
Merge branch 'main' into dev
kensternberg-authentik May 2, 2025
cddc13f
Merge branch 'main' into dev
kensternberg-authentik May 5, 2025
38c4701
Merge branch 'main' into dev
kensternberg-authentik May 14, 2025
e340268
Merge branch 'main' into dev
kensternberg-authentik May 22, 2025
8bad0ed
web/maintenance: correct the usage of boolean (false) attributes
kensternberg-authentik May 23, 2025
469e8d8
Prettier had opinions.
kensternberg-authentik May 23, 2025
3fccf2b
Caught during code review.
kensternberg-authentik May 23, 2025
7d983e5
Merge branch 'main' into web/standards/fix-boolean-attribute-abuse
kensternberg-authentik Jun 6, 2025
6f4fba7
Merged incorrectly; not sure what went wrong, but this re-applies the…
kensternberg-authentik Jun 6, 2025
0192a13
Merge branch 'main' into web/standards/fix-boolean-attribute-abuse
kensternberg-authentik Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions web/src/admin/AdminInterface/index.entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,14 @@ export class AdminInterface extends WithLicenseSummary(AuthenticatedInterface) {

protected readonly ws: WebsocketClient;

@property({
type: Object,
attribute: false,
reflect: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot reflect an Object.

Amazingly, this is the only change that's more or less unrelated to the Booleans issue. Everything else is just... getting it right. 😉

})
@property({ type: Object, attribute: false })
public user?: SessionUser;

@query("ak-about-modal")
public aboutModal?: AboutModal;

@property({ type: Boolean, reflect: true })
public sidebarOpen: boolean;
public sidebarOpen = false;

@eventOptions({ passive: true })
protected sidebarListener(event: CustomEvent<SidebarToggleEventDetail>) {
Expand Down
1 change: 0 additions & 1 deletion web/src/admin/admin-overview/AdminOverviewPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export class AdminOverviewPage extends AdminOverviewBase {
return html` <ak-page-header
header=${msg(str`Welcome, ${username || ""}.`)}
description=${msg("General system status")}
?hasIcon=${false}
>
</ak-page-header>
<section class="pf-c-page__main-section">
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/applications/ApplicationCheckAccessForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ export class ApplicationCheckAccessForm extends Form<{ forUser: number }> {
}

renderForm(): TemplateResult {
return html`<ak-form-element-horizontal
label=${msg("User")}
?required=${true}
name="forUser"
>
return html`<ak-form-element-horizontal label=${msg("User")} required name="forUser">
<ak-search-select
.fetchObjects=${async (query?: string): Promise<User[]> => {
const args: CoreUsersListRequest = {
Expand Down
1 change: 0 additions & 1 deletion web/src/admin/applications/ApplicationViewPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export class ApplicationViewPage extends AKElement {
return html`<ak-page-header
header=${this.application?.name || msg("Loading")}
description=${ifDefined(this.application?.metaPublisher)}
.iconImage=${true}
>
<ak-app-icon
size=${PFSize.Medium}
Expand Down
2 changes: 1 addition & 1 deletion web/src/admin/applications/ProviderSelectModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ProviderSelectModal extends TableModal<Provider> {
}

@property({ type: Boolean })
backchannel?: boolean;
backchannel = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few places left Booleans as undefined. That's... not cool. :-). Boolean attributes should always have a default.


@property()
confirm!: (selectedItems: Provider[]) => Promise<unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,14 @@ export class AkBackchannelProvidersInput extends AKElement {

render() {
const renderOneChip = (provider: Provider) =>
html`<ak-chip
.removable=${true}
value=${ifDefined(provider.pk)}
@remove=${this.remover(provider)}
html`<ak-chip value=${ifDefined(provider.pk)} @remove=${this.remover(provider)}
>${provider.name}</ak-chip
>`;

return html`
<ak-form-element-horizontal label=${this.label} name=${this.name}>
<div class="pf-c-input-group">
<ak-provider-select-table ?backchannel=${true} .confirm=${this.confirm}>
<ak-provider-select-table backchannel .confirm=${this.confirm}>
<button slot="trigger" class="pf-c-button pf-m-control" type="button">
${this.tooltip ? this.tooltip : nothing}
<i class="fas fa-plus" aria-hidden="true"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,15 @@ export class ApplicationEntitlementForm extends ModelForm<ApplicationEntitlement
}

renderForm(): TemplateResult {
return html` <ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
return html` <ak-form-element-horizontal label=${msg("Name")} required name="name">
<input
type="text"
value="${this.instance?.name ?? ""}"
class="pf-c-form-control"
required
/>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Attributes")}
?required=${false}
name="attributes"
>
<ak-form-element-horizontal label=${msg("Attributes")} name="attributes">
<ak-codemirror
mode=${CodeMirrorMode.YAML}
value="${YAML.stringify(this.instance?.attributes ?? {})}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ApplicationWizardRACProviderForm extends ApplicationWizardProviderF
<ak-form-element-horizontal
name="authorizationFlow"
label=${msg("Authorization flow")}
?required=${true}
required
>
<ak-flow-search
flowType=${FlowsInstancesListDesignationEnum.Authorization}
Expand All @@ -60,7 +60,7 @@ export class ApplicationWizardRACProviderForm extends ApplicationWizardProviderF
inputHint="code"
></ak-text-input>

<ak-form-group .expanded=${true}>
<ak-form-group expanded>
<span slot="header"> ${msg("Protocol settings")} </span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
Expand Down
4 changes: 2 additions & 2 deletions web/src/admin/blueprints/BlueprintForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
}

renderForm(): TemplateResult {
return html` <ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
return html` <ak-form-element-horizontal label=${msg("Name")} required name="name">
<input
type="text"
value="${ifDefined(this.instance?.name)}"
Expand Down Expand Up @@ -133,7 +133,7 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
.selected=${(item: BlueprintFile): boolean => {
return this.instance?.path === item.path;
}}
?blankable=${true}
blankable
>
</ak-search-select>
</ak-form-element-horizontal>`
Expand Down
2 changes: 1 addition & 1 deletion web/src/admin/brands/BrandForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class BrandForm extends ModelForm<Brand, string> {
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Default flow background")}
?required=${true}
required
name="brandingDefaultFlowBackground"
>
<input
Expand Down
2 changes: 1 addition & 1 deletion web/src/admin/common/ak-core-group-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class CoreGroupSearch extends CustomListenerElement(AKElement) {
.value=${renderValue}
.selected=${this.selected}
@ak-change=${this.handleSearchUpdate}
?blankable=${true}
blankable
>
</ak-search-select>
`;
Expand Down
2 changes: 1 addition & 1 deletion web/src/admin/common/ak-crypto-certificate-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class AkCryptoCertificateSearch extends CustomListenerElement(AKElement)
.value=${renderValue}
.selected=${this.selected}
@ak-change=${this.handleSearchUpdate}
?blankable=${true}
blankable
>
</ak-search-select>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const Default = () =>
container(
html` <ak-form-element-horizontal
label=${msg("Authorization flow")}
?required=${true}
required
name="authorizationFlow"
>
<ak-flow-search
Expand All @@ -124,7 +124,7 @@ export const WithInitialValue = () =>
container(
html` <ak-form-element-horizontal
label=${msg("Authorization flow")}
?required=${true}
required
name="authorizationFlow"
>
<ak-flow-search
Expand Down
14 changes: 3 additions & 11 deletions web/src/admin/crypto/CertificateGenerateForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class CertificateKeyPairForm extends Form<CertificateGenerationRequest> {
return html`<ak-form-element-horizontal
label=${msg("Common Name")}
name="commonName"
?required=${true}
required
>
<input type="text" class="pf-c-form-control" required />
</ak-form-element-horizontal>
Expand All @@ -39,18 +39,10 @@ export class CertificateKeyPairForm extends Form<CertificateGenerationRequest> {
${msg("Optional, comma-separated SubjectAlt Names.")}
</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Validity days")}
name="validityDays"
?required=${true}
>
<ak-form-element-horizontal label=${msg("Validity days")} name="validityDays" required>
<input class="pf-c-form-control" type="number" value="365" />
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Private key Algorithm")}
?required=${true}
name="alg"
>
<ak-form-element-horizontal label=${msg("Private key Algorithm")} required name="alg">
<ak-radio
.options=${[
{
Expand Down
4 changes: 2 additions & 2 deletions web/src/admin/crypto/CertificateKeyPairForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
}

renderForm(): TemplateResult {
return html` <ak-form-element-horizontal label=${msg("Name")} name="name" ?required=${true}>
return html` <ak-form-element-horizontal label=${msg("Name")} name="name" required>
<input
type="text"
value="${ifDefined(this.instance?.name)}"
Expand All @@ -49,7 +49,7 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
label=${msg("Certificate")}
name="certificateData"
?writeOnly=${this.instance !== undefined}
?required=${true}
required
>
<textarea
autocomplete="off"
Expand Down
12 changes: 4 additions & 8 deletions web/src/admin/events/RuleForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
}

renderForm(): TemplateResult {
return html` <ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
return html` <ak-form-element-horizontal label=${msg("Name")} required name="name">
<input
type="text"
value="${ifDefined(this.instance?.name)}"
Expand Down Expand Up @@ -88,7 +88,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
.selected=${(group: Group): boolean => {
return group.pk === this.instance?.group;
}}
?blankable=${true}
blankable
>
</ak-search-select>
<p class="pf-c-form__helper-text">
Expand All @@ -97,11 +97,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
)}
</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Transports")}
?required=${true}
name="transports"
>
<ak-form-element-horizontal label=${msg("Transports")} required name="transports">
<ak-dual-select-dynamic-selected
.provider=${eventTransportsProvider}
.selector=${eventTransportsSelector(this.instance?.transports)}
Expand All @@ -114,7 +110,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
)}
</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal label=${msg("Severity")} ?required=${true} name="severity">
<ak-form-element-horizontal label=${msg("Severity")} required name="severity">
<ak-radio
.options=${[
{
Expand Down
4 changes: 2 additions & 2 deletions web/src/admin/flows/BoundStagesList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class BoundStagesList extends Table<FlowStageBinding> {
<div slot="primary">
<ak-stage-wizard
createText=${msg("Create and bind Stage")}
?showBindingPage=${true}
showBindingPage
bindingTarget=${ifDefined(this.target)}
></ak-stage-wizard>
<ak-forms-modal>
Expand All @@ -148,7 +148,7 @@ export class BoundStagesList extends Table<FlowStageBinding> {
return html`
<ak-stage-wizard
createText=${msg("Create and bind Stage")}
?showBindingPage=${true}
showBindingPage
bindingTarget=${ifDefined(this.target)}
></ak-stage-wizard>
<ak-forms-modal>
Expand Down
24 changes: 8 additions & 16 deletions web/src/admin/flows/FlowForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
}

renderForm(): TemplateResult {
return html` <ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
return html` <ak-form-element-horizontal label=${msg("Name")} required name="name">
<input
type="text"
value="${ifDefined(this.instance?.name)}"
class="pf-c-form-control"
required
/>
</ak-form-element-horizontal>
<ak-form-element-horizontal label=${msg("Title")} ?required=${true} name="title">
<ak-form-element-horizontal label=${msg("Title")} required name="title">
<input
type="text"
value="${ifDefined(this.instance?.title)}"
Expand All @@ -94,7 +94,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
/>
<p class="pf-c-form__helper-text">${msg("Shown as the Title in Flow pages.")}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal label=${msg("Slug")} ?required=${true} name="slug">
<ak-form-element-horizontal label=${msg("Slug")} required name="slug">
<input
type="text"
value="${ifDefined(this.instance?.slug)}"
Expand All @@ -105,11 +105,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
/>
<p class="pf-c-form__helper-text">${msg("Visible in the URL.")}</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Designation")}
?required=${true}
name="designation"
>
<ak-form-element-horizontal label=${msg("Designation")} required name="designation">
<select class="pf-c-form-control">
<option value="" ?selected=${this.instance?.designation === undefined}>
---------
Expand Down Expand Up @@ -168,7 +164,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Authentication")}
?required=${true}
required
name="authentication"
>
<select class="pf-c-form-control">
Expand Down Expand Up @@ -243,7 +239,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Denied action")}
?required=${true}
required
name="deniedAction"
>
<ak-radio
Expand Down Expand Up @@ -282,7 +278,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${msg("Policy engine mode")}
?required=${true}
required
name="policyEngineMode"
>
<ak-radio
Expand Down Expand Up @@ -312,11 +308,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
<ak-form-group>
<span slot="header"> ${msg("Appearance settings")} </span>
<div slot="body" class="pf-c-form">
<ak-form-element-horizontal
label=${msg("Layout")}
?required=${true}
name="layout"
>
<ak-form-element-horizontal label=${msg("Layout")} required name="layout">
<select class="pf-c-form-control">
<option
value=${FlowLayoutEnum.Stacked}
Expand Down
Loading
Loading