From e85d2d0096c24b09ddb0c0c5deb2201fea66d777 Mon Sep 17 00:00:00 2001 From: Ken Sternberg <133134217+kensternberg-authentik@users.noreply.github.com> Date: Mon, 16 Jun 2025 08:17:11 -0700 Subject: [PATCH] Web/cleanup/empty state better slot handling (#14289) * 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 * web: move optional textual information out of attributes and into slots ## What Replaces instances of: ``` ``` with ``` ${msg(...)} ``` ## Why 1. It's correct. 2. It lets us elide the decorations for any slots we aren't using. 3. It's preparation for moving to Patternfly 5 4. It annoyed me. ## How Since we already have Patternfly Elements installed, we have access to the PFE-Core, which has the unbelievable useful `SlotsController`. Using it, I created a conditional render template that will only put in the header, body, and primary slots if there is something in the lightDOM requesting those slots. The conditional template will still put the spinner in if the header is not provided but the loading state is true. I then had to edit all the places where this is used. For about 30 of them, this script sufficed: ``` perl -pi.bak -e 's/header="?(\$\{msg\([^)]+\)\})"?>/>\1<\/span>/' \ $(rg -l `]header') ``` The other six had to be done by hand. I have tested a handful of the automatic ones, and all of the ones that were edited manually. I'm pleasantly surprised that the textual rules [are inherited by the slots as expected](https://htmlwithsuperpowers.netlify.app/styling/inheritable.htm). --- .../admin-overview/cards/RecentEventsCard.ts | 3 +- .../ak-application-wizard-bindings-step.ts | 3 +- web/src/admin/flows/BoundStagesList.ts | 3 +- web/src/admin/policies/BoundPoliciesList.ts | 3 +- web/src/components/events/ObjectChangelog.ts | 3 +- web/src/components/events/UserEvents.ts | 3 +- web/src/elements/EmptyState.ts | 29 +++++++++++++------ web/src/elements/charts/Chart.ts | 3 +- web/src/elements/events/LogViewer.ts | 4 ++- .../notifications/NotificationDrawer.ts | 3 +- web/src/elements/table/Table.ts | 12 +++++--- web/src/elements/tests/EmptyState.test.ts | 21 +++++++++++--- 12 files changed, 64 insertions(+), 26 deletions(-) diff --git a/web/src/admin/admin-overview/cards/RecentEventsCard.ts b/web/src/admin/admin-overview/cards/RecentEventsCard.ts index 50978de655..df9ceeb786 100644 --- a/web/src/admin/admin-overview/cards/RecentEventsCard.ts +++ b/web/src/admin/admin-overview/cards/RecentEventsCard.ts @@ -88,7 +88,8 @@ export class RecentEventsCard extends Table { } return super.renderEmpty( - html` + html`${msg("No Events found.")}
${msg("No matching events could be found.")}
`, ); diff --git a/web/src/admin/applications/wizard/steps/ak-application-wizard-bindings-step.ts b/web/src/admin/applications/wizard/steps/ak-application-wizard-bindings-step.ts index 65b954f441..e7285bce1c 100644 --- a/web/src/admin/applications/wizard/steps/ak-application-wizard-bindings-step.ts +++ b/web/src/admin/applications/wizard/steps/ak-application-wizard-bindings-step.ts @@ -115,7 +115,8 @@ export class ApplicationWizardBindingsStep extends ApplicationWizardStep { .columns=${COLUMNS} .content=${[]} > - + ${msg("No bound policies.")}
${msg("No policies are currently bound to this object.")}