From be9ae7d4f7cb25b88593487d961b67513f6bdf1e Mon Sep 17 00:00:00 2001 From: Ken Sternberg <133134217+kensternberg-authentik@users.noreply.github.com> Date: Tue, 6 May 2025 08:49:48 -0700 Subject: [PATCH] web: cleanup/loading attribute always true (#14288) * web: Add InvalidationFlow to Radius Provider dialogues ## What - Bugfix: adds the InvalidationFlow to the Radius Provider dialogues - Repairs: `{"invalidation_flow":["This field is required."]}` message, which was *not* propagated to the Notification. - Nitpick: Pretties `?foo=${true}` expressions: `s/\?([^=]+)=\$\{true\}/\1/` ## Note Yes, I know I'm going to have to do more magic when we harmonize the forms, and no, I didn't add the Property Mappings to the wizard, and yes, I know I'm going to have pain with the *new* version of the wizard. But this is a serious bug; you can't make Radius servers with *either* of the current dialogues at the moment. * This (temporary) change is needed to prevent the unit tests from failing. \# What \# Why \# How \# Designs \# Test Steps \# Other Notes * Revert "This (temporary) change is needed to prevent the unit tests from failing." This reverts commit dddde09be571a639ecd041569dd3a282aab3f9be. * web: remove Lit syntax from always true attributes ## What Replaces instances of `?loading=${true}` and `?loading="${true}"` with `loading` ## Why The Lit syntax is completely unnecessary when the attribute's state is constant, and it's a few (just a few) extra CPU cycles for Lit to process that. More to the point, it annoys me. ## How ``` $ perl -pi.bak -e 's/\?loading=\$\{true\}/loading/' $(rg -l '\?loading=\$\{true\}') $ find . -name '*.bak' -exec rm {} \; $ perl -pi.bak -e 's/\?loading="\$\{true\}"/loading/' $(rg -l '\?loading="\$\{true\}"') $ find . -name '*.bak' -exec rm {} \; ``` * Prettier had opinions * Trigger Build --- web/src/admin/applications/ApplicationViewPage.ts | 3 +-- web/src/admin/providers/ProviderViewPage.ts | 2 +- web/src/admin/providers/oauth2/OAuth2ProviderViewPage.ts | 2 +- web/src/admin/providers/saml/SAMLProviderViewPage.ts | 2 +- web/src/admin/sources/SourceViewPage.ts | 2 +- web/src/elements/Diagram.ts | 2 +- web/src/elements/charts/Chart.ts | 4 +--- web/src/elements/forms/ModelForm.ts | 2 +- web/src/elements/router/Route.ts | 2 +- web/src/elements/sync/SyncStatusCard.ts | 2 +- web/src/elements/tests/EmptyState.test.ts | 2 +- web/src/elements/user/sources/SourceSettings.ts | 3 +-- web/src/flow/providers/SessionEnd.ts | 3 +-- web/src/user/LibraryPage/ak-library.ts | 2 +- .../user/user-settings/details/UserSettingsFlowExecutor.ts | 6 ++---- .../user/user-settings/details/stages/prompt/PromptStage.ts | 3 +-- 16 files changed, 17 insertions(+), 25 deletions(-) diff --git a/web/src/admin/applications/ApplicationViewPage.ts b/web/src/admin/applications/ApplicationViewPage.ts index 6f0905a430..6cd06094f9 100644 --- a/web/src/admin/applications/ApplicationViewPage.ts +++ b/web/src/admin/applications/ApplicationViewPage.ts @@ -113,8 +113,7 @@ export class ApplicationViewPage extends AKElement { renderApp(): TemplateResult { if (!this.application) { - return html` - `; + return html` `; } return html` ${this.missingOutpost diff --git a/web/src/admin/providers/ProviderViewPage.ts b/web/src/admin/providers/ProviderViewPage.ts index d1b42bcf79..4afad2f86b 100644 --- a/web/src/admin/providers/ProviderViewPage.ts +++ b/web/src/admin/providers/ProviderViewPage.ts @@ -42,7 +42,7 @@ export class ProviderViewPage extends AKElement { renderProvider(): TemplateResult { if (!this.provider) { - return html``; + return html``; } switch (this.provider?.component) { case "ak-provider-saml-form": diff --git a/web/src/admin/providers/oauth2/OAuth2ProviderViewPage.ts b/web/src/admin/providers/oauth2/OAuth2ProviderViewPage.ts index fe8312a34d..8cdc0fc604 100644 --- a/web/src/admin/providers/oauth2/OAuth2ProviderViewPage.ts +++ b/web/src/admin/providers/oauth2/OAuth2ProviderViewPage.ts @@ -432,7 +432,7 @@ export class OAuth2ProviderViewPage extends AKElement {
${this.preview ? html`
${JSON.stringify(this.preview?.preview, null, 4)}
` - : html` `} + : html` `}
`; diff --git a/web/src/admin/providers/saml/SAMLProviderViewPage.ts b/web/src/admin/providers/saml/SAMLProviderViewPage.ts index 5bf4ff89b6..0790ac1fe2 100644 --- a/web/src/admin/providers/saml/SAMLProviderViewPage.ts +++ b/web/src/admin/providers/saml/SAMLProviderViewPage.ts @@ -502,7 +502,7 @@ export class SAMLProviderViewPage extends AKElement { renderTabPreview(): TemplateResult { if (!this.preview) { - return html``; + return html``; } return html`
`; + return html``; } switch (this.source?.component) { case "ak-source-kerberos-form": diff --git a/web/src/elements/Diagram.ts b/web/src/elements/Diagram.ts index b8c79de3b5..4ff6e5a062 100644 --- a/web/src/elements/Diagram.ts +++ b/web/src/elements/Diagram.ts @@ -83,7 +83,7 @@ export class Diagram extends AKElement { } }); if (!this.diagram) { - return html``; + return html``; } return html`${until( mermaid.render("graph", this.diagram).then((r) => { diff --git a/web/src/elements/charts/Chart.ts b/web/src/elements/charts/Chart.ts index eaea4bb66e..e52f895304 100644 --- a/web/src/elements/charts/Chart.ts +++ b/web/src/elements/charts/Chart.ts @@ -230,9 +230,7 @@ export abstract class AKChart extends AKElement {

${pluckErrorDetail(this.error)}

` - : html`${this.chart - ? html`` - : html``}`} + : html`${this.chart ? html`` : html``}`} ${this.centerText ? html` ${this.centerText} ` : html``}
diff --git a/web/src/elements/forms/ModelForm.ts b/web/src/elements/forms/ModelForm.ts index c45cc73449..b389dcd2b2 100644 --- a/web/src/elements/forms/ModelForm.ts +++ b/web/src/elements/forms/ModelForm.ts @@ -71,7 +71,7 @@ export abstract class ModelForm extends Form renderVisible(): TemplateResult { if ((this._instancePk && !this.instance) || !this._initialDataLoad) { - return html``; + return html``; } return super.renderVisible(); } diff --git a/web/src/elements/router/Route.ts b/web/src/elements/router/Route.ts index 13ac61f8c3..5beee0a509 100644 --- a/web/src/elements/router/Route.ts +++ b/web/src/elements/router/Route.ts @@ -51,7 +51,7 @@ export class Route { if (this.callback) { return html`${until( this.callback(args), - html``, + html``, )}`; } if (this.element) { diff --git a/web/src/elements/sync/SyncStatusCard.ts b/web/src/elements/sync/SyncStatusCard.ts index 5a0b5e2f60..b538ef68f8 100644 --- a/web/src/elements/sync/SyncStatusCard.ts +++ b/web/src/elements/sync/SyncStatusCard.ts @@ -121,7 +121,7 @@ export class SyncStatusCard extends AKElement { renderSyncStatus(): TemplateResult { if (this.loading) { - return html``; + return html``; } if (!this.syncState) { return html`${msg("No sync status.")}`; diff --git a/web/src/elements/tests/EmptyState.test.ts b/web/src/elements/tests/EmptyState.test.ts index 265b1f91e3..35fce14f44 100644 --- a/web/src/elements/tests/EmptyState.test.ts +++ b/web/src/elements/tests/EmptyState.test.ts @@ -19,7 +19,7 @@ describe("ak-empty-state", () => { }); it("should render the default loader", async () => { - render(html` `); + render(html` `); const empty = await $("ak-empty-state").$(">>>.pf-c-empty-state__icon"); await expect(empty).toExist(); diff --git a/web/src/elements/user/sources/SourceSettings.ts b/web/src/elements/user/sources/SourceSettings.ts index 2cfd8a8c51..b7d368e4d2 100644 --- a/web/src/elements/user/sources/SourceSettings.ts +++ b/web/src/elements/user/sources/SourceSettings.ts @@ -139,8 +139,7 @@ export class UserSourceSettingsPage extends AKElement { })} `} ` - : html` - `} + : html` `} `; } } diff --git a/web/src/flow/providers/SessionEnd.ts b/web/src/flow/providers/SessionEnd.ts index 3e58d70d01..33ebecc185 100644 --- a/web/src/flow/providers/SessionEnd.ts +++ b/web/src/flow/providers/SessionEnd.ts @@ -24,8 +24,7 @@ export class SessionEnd extends BaseStage { render(): TemplateResult { if (!this.challenge) { - return html` - `; + return html` `; } return html`