Commit Graph

3 Commits

Author SHA1 Message Date
Ken Sternberg
08b07979ad web/elements: remove pfbase everywhere (#19623)
* 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 dddde09be5.

* website: fix bad escaping of URLs in release notes

## What

Fixes bad escaping of URLs in the release notes that resulted in mangled output.

v2024.6.4 had entries that looked like this:

```
##### `GET` /providers/google_workspace/{#123;id}#125;/
```

v2025.4.md had entries that looked like this:

```
##### `GET` /policies/unique_password/{#125;#123;policy_uuid}/
```

A couple of straightforward search-and-replaces has fixed the issue.

## Notes

Two of the release notes had bad escaping of URLs. I'm not sure how the error was made or got past,
but it was obvious when visiting the page.

@Beryju suggested that the bug is due to our using `{...}` to symbolize parameters in a URL while
Docusaurus wants to interpret `{...}` as an internal template instruction, resulting in odd
behavior. In either case, docusarus interpreted the hashtagged entries as links to unrelated issues
in Github (the same two issues, which were "bump version of pylint" and "bump version of sentry"),
which could be very confusing.

The inconsistencies between the two releases, and the working releases, suggests that the error was
introduced manually.

* web: Remove PFBase.

* Remove stub.

* Just keeping this around.

* web/maintenance: deprecate PFBase in favor of an adopted stylesheet

# What !?!?!?

Removes `PFBase` from all components.

# Why !?!?!?

In `AkElement`, there was this code:

        protected static override finalizeStyles(styles?: CSSResultGroup): CSSResultOrNative[] {
            if (!styles) return [$PFBase, $AKBase];

            if (!Array.isArray(styles)) return [$PFBase, createCSSResult(styles), $PFBase, $AKBase];

            return [
                $PFBase,
                // ---
                ...(styles.flat() as CSSResultOrNative[]).map(createCSSResult),
                $AKBase,
            ];
        }

I’ve refined this:

        protected static override finalizeStyles(styles: CSSResultGroup = []): CSSResultOrNative[] {
            const elementStyles = [
                $PFBase,
                // Route around TSC`s known-to-fail typechecking of `.flat(Infinity)`. Removes types.
                ...([styles] as Array<unknown>).flat(Infinity),
                $AKBase,
                // Restore types. Safe: we control AKBase and PFBase in this file, and `styles` are
                // typed on function signature.
            ] as CSSResultOrNative[];

            // Remove duplicates in reverse order to preserve last-insert-wins semantics of CSS.
            const elementSet = new Set(elementStyles.reverse());
            // Reverse again because the return type is an array, and process as a CSSResult
            return Array.from(elementSet).reverse().map(createCSSResult);
        }

… with the duplication removal documented in Lit 3.0. `styles` defaults to an array, is cast to an array, then automatically flattented before the deduplication is run.

With this, both PFBase and AKBase are automatically included with each and every component that inherits from `AKElement`. At that point, the inclusion of `PFBase` interface-wide made no sense.

So they had to be removed:

    $ for i in $(rg -t typescript -l PFBase | rg -v 'elements/Base\.ts') ; do \
        perl -pi.bak -e 's{import PFBase from ".patternfly/patternfly/patternfly-base.css";}{}' "$i" ; \
        done
    $ for i in $(rg -t typescript -l PFBase | rg -v 'elements/Base\.ts') ; do \
        perl -pi.bak -e 's/PFBase,//' "$i" ; \
        done

This commit removes 131 `import` statements from the source code. As a result, the bundle is about 27K smaller… which admittedly is about 0.2% smaller than before. Ah, well. “Every little bit helps,” right?

* Update comment to point to semantic rules for `finalizeStyles` in Lit reactive-element

* Yeah, didn't need the analysis files lying around.

* Merge confirmed

---------

Co-authored-by: Teffen Ellis <teffen@goauthentik.io>
2026-01-21 12:54:09 -08:00
Teffen Ellis
90d9b2daf9 web: Fix ESBuild hanging process (#18162) 2025-11-15 02:13:28 +01:00
Teffen Ellis
e426f88401 web: Fix application of global styles in style roots. (#17444)
* web: Separate global styles from element roots.

* web: Flesh out style strategy plugin, fixes for imported styles.

* web: Clean up applying of dark theme.

web: unminify.

* web: Fix alignment, rendering on high contrast.

web: Apply footer resize.

web: Fix application of global styles in style roots.

web: Fix missing layout attribute.

web: Normalize background alignment.

web: Fix layout issues, color overrides.

web: Fix alignment, colors, jank.

web: Separate method into function.

web: Clean up alignment, reflow.

web: Fix colors, compatibility mode.

web: Add content left/right support.

web: Fix colors, compatibility mode overrides.

* Fix issue where missing config throws runtime error.

* web: Refactor.

* Update tests.

* web: Fix Storybook imports.

* Fix order of theme application.

* web: Fix storybook asset paths.

* web: Flesh out tests surrounding source buttons, fix alignment,
contrast.

* Update tests, clarify errors.

* Update test selectors, assertions.

* Clarify redirect handling.

* Adjust user check.

* Update logs.

* web: Fix selector timing.

* Fix alignment.

* Fix selectors, timing.

* Log current URL content.

* Refine shadow selector, add delay.

* Replace IDs with named elements.

* Fix overlay color.

* Fix footer padding.

* Fix contrast.

* Add selectable name to button.

* Fix alignment, mobile layout.

* web: Spread exported parts to stages.

* Fix z-index order.

* Tidy colors, behaviors, layout.

* Fix overflow scroll.

* Clean up duplicate color styles.

* Clarify selector order. Fix overrides, color contrast.

* Attempt to read JSON multiple times.

* Clarify error.

* web: Fix timeouts, URL changes.

* web: Fix disabled styles.

* Fix color flip.

* Fix selector.

* Fix issue where hidden tables will alter test URLs.

* Use DOM to look for connection, rather than API. Update selectors.

* Immediately navigate to tab.

* Upgrade Dex.

* Ensure Dex redirects.

* Use same host during tests.

* web: Update package-lock.json

* Add delay.
2025-11-11 15:49:00 -05:00