Repository navigation
web/admin: breadcrumb controller - #27319
Conversation
# What This commit moves the SidebarVersion element, which yes shows the version information in the sidebar. The component is moved into Admin, and the Sidebar now provides an active slot for it. Since it is now indpendent of and never even mentions “Sidebar” on its own, it’s now renamed `VersionDetails`. # Why SidebarVersion uses WithLicenseSummary, which has knowledge of the API. The long-term goal of the Elements is to extract from it every element that does *not* need to know about the API, and this was one of the first things I encountered while working on the SidebarIcons project. # Details SidebarVersion had a lot of aria that wasn’t necessary. The `aria-labels` overrode much of the text, so the user would hear that there was version information available, but would never actually hear the version information. Headers inside a button would get discarded by some screen-readers because that doesn’t make sense inside a button. Buttons can only contain “inline” content, so using `<span>` and then styling them to be block is the correct way to make sure the information remains accessible while meeting the expected layout. `aria-controls` in the Interface pointed at nothing, because it was referencing an `id` that doesn’t cross a shadow-root. I’ve changed the target, so at least now that’s going to the right place. The PFNav and PFAvatar imports were never used inside SidebarVersion. They’ve been removed. The hover styling has been moved into SidebarVersion explicitly. VersionDetails is now slotted into the Sidebar so it is visible in the Admin lightDOM, and in consequence it no longer needs its `exportparts`. `@patterfly-element/pfe-core` has been a part of our product since we included some of the elements into our base, notably the original Tooltips. This only makes it explicit that we use it. The check-for-undefined in the VersionDetails renderer did nothing; we already check if `this.version` is defined, and if it is, `versionCurrent` is not allowed to be null or undefined. If the type and the behavior don’t coincide, that’s a problem for the back-end team. 😈 Since we’re exposing `[part]` names for styleability, I’ve changed the class names inside VersionDetails into `[part~=]` selectors. We’re not performance-bound, and it reduced the clutter.
* main: (21 commits) policies: fix warning from setting non-string tracing data (#27062) root: annotate hot paths (#27052) website/docs: contributing: add guidelines for vendor contributions (#27032) providers/saml: Add ability to select encryption algorithm (#27009) lib: set postgres timezone on connection (#27053) core: add postgres connection info (#27024) ci: fix cargo deny for basic-toml (#27054) web/elements: keep ak-array-input edits through form submission (#27045) enterprise: optimize middleware (#27015) core: bump goauthentik/platform-ssh from 26.04-ak-0.72.0 to 26.04-ak-0.72.1 in /tests/e2e (#27038) core: bump ruff from 0.16.10 to 0.17.0 (#27044) core: bump sentry-sdk from 2.71.0 to 2.72.0 (#27043) core: bump django-postgres-extra from 3.0.0 to 3.0.1 (#27042) core: bump python-kadmin-rs from 0.7.4 to 0.7.5 (#27040) core: bump goauthentik/selenium from 152.0-ak-0.72.0 to 152.0-ak-0.72.1 in /tests/e2e (#27039) core: bump aiohttp from 3.14.3 to 3.14.4 (#27034) web/flow: fix remember-me being cleared by CSRF token rotation (#25205) web/theme: Remove the categories build from the theme (#26982) core: bump library/golang from `2f84bc9` to `4766793` in /lifecycle/container (#26996) providers/saml: verify logoutrequest/response signatures (#26534) ...
# What This commit moves the “isLicensed” and “canEnterprise” checks in SidebarItem and instead decorates the SidebarEntries collection with additional flags and values to support holding the information entirely within the Admin UI. # How SidebarItem takes two additional attributes: `notice`, which is where the “Enterprise Only” message goes, and `pathoverride`, which will override the default path if provided. This is hardly an elegant way to go around it, but it preserves the original `entries` tree, producing a new tree and not mutating the original. With this, SidebarItem (and Sidebar itself!) is completely generic and no longer needs to know anything at all about licensing or enterprise capability. The CSS for SidebarItem has been modified: it’s just `notice` not `enterprise-ntice` now. Fit for any purpose under the sun. A new function, `resolveSidebarEntries`, completely centralizes the logic for “do we even show Enterprise features” and “if the user isn’t licensed, decorate them with ‘enterprise only’ markers”; it contains the logic dictating, for each element in the SidebarEntries tree, if the instance isLicensed and canEnterprise; it filters out entries that are enterprise-only when the instance does not support enterprise features, then generates the new tree, decorating the `attributes` field with the “Enterprise only” message and path override as required. These generic features are passed to SidebarItem. `ak-interface-admin` then needed only to <s>rip out</s> modify the navigationEntries method to use the `resolveSidebarEntries` function, and remove the redundant check for enterprise-only features in the palette-generator, since those features will not be present after the resolver does its magic. Also: A couple of tests.
* main: lib/tracing: fix sentry tracing when otel is enabled (#27066) website/integrations: audiobookshelf: Fix Post Logout URI (#27074) web/user: fix agents tab flashing without license (#27069) root: bump cert-related deps due to emudhra (#27068) web: fix table fetch races and search select e2e lookups (#27059) core: bump astral-sh/uv from 0.13.1 to 0.13.3 in /lifecycle/container (#27037)
* main: (27 commits) lib/tracing: fix sentry tracing when otel is enabled (#27066) website/integrations: audiobookshelf: Fix Post Logout URI (#27074) web/user: fix agents tab flashing without license (#27069) root: bump cert-related deps due to emudhra (#27068) web: fix table fetch races and search select e2e lookups (#27059) core: bump astral-sh/uv from 0.13.1 to 0.13.3 in /lifecycle/container (#27037) policies: fix warning from setting non-string tracing data (#27062) root: annotate hot paths (#27052) website/docs: contributing: add guidelines for vendor contributions (#27032) providers/saml: Add ability to select encryption algorithm (#27009) lib: set postgres timezone on connection (#27053) core: add postgres connection info (#27024) ci: fix cargo deny for basic-toml (#27054) web/elements: keep ak-array-input edits through form submission (#27045) enterprise: optimize middleware (#27015) core: bump goauthentik/platform-ssh from 26.04-ak-0.72.0 to 26.04-ak-0.72.1 in /tests/e2e (#27038) core: bump ruff from 0.16.10 to 0.17.0 (#27044) core: bump sentry-sdk from 2.71.0 to 2.72.0 (#27043) core: bump django-postgres-extra from 3.0.0 to 3.0.1 (#27042) core: bump python-kadmin-rs from 0.7.4 to 0.7.5 (#27040) ...
…ts/sidebar-api-disconnect * web/elements/sidebar-footer-dependency:
This commit streamlines how sidebar entries are generated and validated. The `entries` field was only being used as a signal to `requestUpdate()`; the actual entries were being generated on the fly in `get navigateEntries()`. We already had functions to generate the base entries and the enterprise entries, and putting the “just base or base + enterprise” function into the `sidebar.ts` file reduced the `navigateEntries` to two lines, and separates the “canEnterprise” from “what does that mean for sidebar” nicely. @GirlBossRush, there’s a `validateRoutes` function in `./src/admin/navigation/sidebar.ts` that I tried to make into a unit test, but I could not get to run under Vitest, mostly because `Routes.ts` has exactly one side-effect import and Vitest cannot handle that. I didn’t want to make it a browser test, however. Any suggestions?
* main: (21 commits) root: require Node.js 24.22.1 (#27093) website/docs: change routing info after 2026.8 changes (#27109) core: bump astral-sh/uv from 0.13.4 to 0.13.5 in /lifecycle/container (#27096) flows: avoid saving plan history when inspector inaccessible (#27089) core: bump pyo3 from 0.29.0 to 0.30.1 (#27099) core: bump arc-swap from 1.9.2 to 1.9.3 (#27098) core: bump pyroscope-io from 1.2.5 to 1.3.0 (#27100) core: bump pyo3-build-config from 0.29.0 to 0.30.1 (#27097) core: bump dexidp/dex from v2.46.0 to v2.46.1 in /tests/e2e (#27095) website/integrations: VCF 9: touch up (#27094) lifecycle/container: add a distroless version of the server image (#26321) ci: run tests in the server image (#26510) packages/client-ts: Generate imports with `.js` extensions (#27029) core: bump djangorestframework from 3.18.1 to 3.18.3 (#26838) website/docs: add release notes for `2026.8.5` (#27084) website/docs: add release notes for `2026.5.8` (#27083) core, web: update translations (#27035) core: bump twilio from 9.11.2 to 9.12.0 (#27081) core: bump cachetools from 7.2.2 to 7.2.3 (#27082) core: bump paramiko from 5.0.0 to 5.0.1 (#27080) ...
…/sidebar-footer-dependency * web/sidebar/validate-sidebar-entries: Formatter opinions. That side effect infected downstream tests. Darnit. web/admin: Simplify sidebar entries handling
…is to have the dashboard as live as possible as early as possible. Putting into Routes made Routes into a browser-only feature, and it could not be unit tested without this move.
* main: web/elements: test that ak-mdx does not evaluate API-supplied content (#24524)
…/sidebar-footer-dependency * web/sidebar/validate-sidebar-entries: The test exists and passes. Moving the load of the AdminOverviewPage to the entrypoint. The idea is to have the dashboard as live as possible as early as possible. Putting into Routes made Routes into a browser-only feature, and it could not be unit tested without this move. web/elements: test that ak-mdx does not evaluate API-supplied content (#24524)
…ts/sidebar-api-disconnect * web/elements/sidebar-footer-dependency: (27 commits) The test exists and passes. Moving the load of the AdminOverviewPage to the entrypoint. The idea is to have the dashboard as live as possible as early as possible. Putting into Routes made Routes into a browser-only feature, and it could not be unit tested without this move. web/elements: test that ak-mdx does not evaluate API-supplied content (#24524) root: require Node.js 24.22.1 (#27093) Formatter opinions. That side effect infected downstream tests. Darnit. web/admin: Simplify sidebar entries handling website/docs: change routing info after 2026.8 changes (#27109) core: bump astral-sh/uv from 0.13.4 to 0.13.5 in /lifecycle/container (#27096) flows: avoid saving plan history when inspector inaccessible (#27089) core: bump pyo3 from 0.29.0 to 0.30.1 (#27099) core: bump arc-swap from 1.9.2 to 1.9.3 (#27098) core: bump pyroscope-io from 1.2.5 to 1.3.0 (#27100) core: bump pyo3-build-config from 0.29.0 to 0.30.1 (#27097) core: bump dexidp/dex from v2.46.0 to v2.46.1 in /tests/e2e (#27095) website/integrations: VCF 9: touch up (#27094) lifecycle/container: add a distroless version of the server image (#26321) ci: run tests in the server image (#26510) packages/client-ts: Generate imports with `.js` extensions (#27029) core: bump djangorestframework from 3.18.1 to 3.18.3 (#26838) ...
\# What \# Why \# How \# Designs \# Test Steps \# Other Notes
…single-shadowdom-sidebar * web/elements/sidebar-api-disconnect: (28 commits) Fix some merge issues. The test exists and passes. Moving the load of the AdminOverviewPage to the entrypoint. The idea is to have the dashboard as live as possible as early as possible. Putting into Routes made Routes into a browser-only feature, and it could not be unit tested without this move. web/elements: test that ak-mdx does not evaluate API-supplied content (#24524) root: require Node.js 24.22.1 (#27093) Formatter opinions. That side effect infected downstream tests. Darnit. web/admin: Simplify sidebar entries handling website/docs: change routing info after 2026.8 changes (#27109) core: bump astral-sh/uv from 0.13.4 to 0.13.5 in /lifecycle/container (#27096) flows: avoid saving plan history when inspector inaccessible (#27089) core: bump pyo3 from 0.29.0 to 0.30.1 (#27099) core: bump arc-swap from 1.9.2 to 1.9.3 (#27098) core: bump pyroscope-io from 1.2.5 to 1.3.0 (#27100) core: bump pyo3-build-config from 0.29.0 to 0.30.1 (#27097) core: bump dexidp/dex from v2.46.0 to v2.46.1 in /tests/e2e (#27095) website/integrations: VCF 9: touch up (#27094) lifecycle/container: add a distroless version of the server image (#26321) ci: run tests in the server image (#26510) packages/client-ts: Generate imports with `.js` extensions (#27029) ...
This commit streamlines how sidebar entries are generated and validated. The `entries` field was only being used as a signal to `requestUpdate()`; the actual entries were being generated on the fly in `get navigateEntries()`. We already had functions to generate the base entries and the enterprise entries, and putting the “just base or base + enterprise” function into the `sidebar.ts` file reduced the `navigateEntries` to two lines, and separates the “canEnterprise” from “what does that mean for sidebar” nicely. @GirlBossRush, there’s a `validateRoutes` function in `./src/admin/navigation/sidebar.ts` that I tried to make into a unit test, but I could not get to run under Vitest, mostly because `Routes.ts` has exactly one side-effect import and Vitest cannot handle that. I didn’t want to make it a browser test, however. Any suggestions?
…is to have the dashboard as live as possible as early as possible. Putting into Routes made Routes into a browser-only feature, and it could not be unit tested without this move.
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
| public sidebarOpen = false; | ||
|
|
||
| protected get navigationEntries(): readonly ExtendedSidebarItem[] { | ||
| public get navigationEntries(): readonly ExtendedSidebarItem[] { |
There was a problem hiding this comment.
Required so Controllers can see it.
| */ | ||
| @state() | ||
| protected pathname = window.location.pathname; | ||
| public pathname = window.location.pathname; |
There was a problem hiding this comment.
Required so Controllers can see it.
| class="${classMap(sidebarClasses)}" | ||
| .entries=${entries} | ||
| current=${ifPresent(findCurrentSidebarKey(entries, path, routeName))} | ||
| current=${ifPresent(findCurrentSidebarKey(entries, routeName, path))} |
There was a problem hiding this comment.
Matches the signature of findCurrentSidebarSectionLabel.
| /** | ||
| * Returns the matched entry _and_ all of its parents | ||
| */ | ||
| export function findSidebarEntries( |
There was a problem hiding this comment.
Finds the list of all entries from "here" to the root.
| return []; | ||
| } | ||
|
|
||
| const findSidebarEntry = ( |
There was a problem hiding this comment.
This is the original function; it uses the new plural function, and just returns the tip, matching the old version.
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 42110618387 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-8210583fde2e138609b5204fbd6a190e7f24cffc
# Distroless image: AUTHENTIK_TAG=gh-8210583fde2e138609b5204fbd6a190e7f24cffc-distroless
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-8210583fde2e138609b5204fbd6a190e7f24cffc
# Distroless image: tag: gh-8210583fde2e138609b5204fbd6a190e7f24cffc-distrolessAfterwards, run the upgrade commands from the latest release notes. |
8a4af9e to
0d356aa
Compare
GirlBossRush
left a comment
There was a problem hiding this comment.
Minor suggestions. Beautiful code
| a.path === b.path && | ||
| a.objectPath === b.objectPath && | ||
| a.crumbs.length === b.crumbs.length && | ||
| JSON.stringify(a.fullCrumbs) === JSON.stringify(b.fullCrumbs); |
There was a problem hiding this comment.
I believe this is mostly a non-issue in most browsers, but I want to say that it's not always the case that JSON.stringify will result in the same order.
Something like fast-deep-equal will ensure this is compared without serialization order effecting things.
| this.#abortController = null; | ||
| } | ||
|
|
||
| hostUpdated() { |
There was a problem hiding this comment.
| hostUpdated() { | |
| public hostUpdated(): void { |
## Description This commit introduces a Breadcrumb component (patterned on the [Patternfly 5 Breadcrumb Component](https://v5-archive.patternfly.org/components/breadcrumb/html)) and introduces a BreadcrumbController that tracks changes in our navigation to provide information in the format the Breadcrumb component expects. ## What ### First, a little maintenance: `findCurrentSidebarKey` and `findSidebarSectionByRoute` are the *same function*, it’s just that one returns the key used by the code, the other returns the label used by humans. (Also, they took their arguments in different order). I’ve renamed the latter to `findCurrentSidebarSectionLabel`, made the argument sequences the same, and extracted the common functionality. The function `findSidebarEntries` now returns a list of sidebar entries. Most functions are only interested in the last one (the tip of the route is the page or page/tab combo you’ve navigated to) but having that information is useful. ### Breadcrumb Context Controller The Breadcrumb controller is a standard parasitic context manager: it attaches to an object and monitors that object’s behavior, translating changes in that object into messages for other services to use. To enable it, you need only add exactly one line to an Interface, creating an instance of the controller. It does everything else. The controller has no additional external dependencies, and it creates no new external obligations. Because of our split navigation (Routes for collections, Tabs for objects), the controller listens for both events, identifies the current full path according to the SidebarEntries, and records each step along the way. It publishes this information as an active context object. And that’s pretty much all it does. ### Breadcrumb Component (`ak-breadcrumb`) The Breadcrumb Component takes a property argument, `.entries`, that is a list of `{ label, path? }` pairs; if the path is present and is *not* the page you’re currently looking at, the label will be wrapped in an anchor for easy navigation up the hierarchy. The Breadcrumb Component is API-free. ### Breadcrumb UI Component (`ak-ui-breadcrumb`) The Breadcrumb UI Component inherits and extends the Breadcrumb component by plugging into the Breadcrumb Context and pushing the context changes into the the `.entries` field before rendering. This avoids both API entanglement with the Breadcrumb renderer, having to remember how to use it as a slotted controller, or some other shenaningans to get `ak-breadcrumb` into the right position. ### Miscellaneous Jens thought shortening “Enterprise Only” to “Enterprise” and floating it to the right looked nice.
0d356aa to
3e390a1
Compare
…b-controller' into web/admin/breadcrumb-controller * refs/remotes/origin/web/admin/breadcrumb-controller: (214 commits) The updated format for crumbs required an update to the unit tests. web/admin: Add a Breadcrumb context manager to the navigation suite Adding the Breadcrumbs visual component. Revised naming code to track certain features. web/elements: vendor sidebar and add icons (#27289) providers/oauth2: don't set state in responses if not supplied (#9735) web/elements: expansion visual hierarchy (#27562) providers/oauth2: accept ML-DSA keys for DPoP (#27174) website/docs: draft 2026.11 release notes (#26814) sources/ldap: store the directory date when resetting a password (#27578) events: bundle DB-IP Lite GeoIP databases instead of MaxMind GeoLite2 (#27102) web/admin: fix ldap source parent group form (#26421) stages/prompt: preserve empty initial values (#25148) core: batch expired cache and channel record cleanup (#27587) web: bump mermaid from 11.16.0 to 12.3.0 in /website (#27598) ci: bump taiki-e/install-action from 2.89.0 to 2.89.1 in /.github/actions/setup (#27630) core: bump goauthentik/fips-python from `d4c46c4` to `69e7058` in /lifecycle/container (#27626) ci: bump AndreKurait/docker-cache from 0.7.0 to 0.7.1 in /.github/actions/setup (#27628) ci: bump actions-rust-lang/setup-rust-toolchain from 2.0.0 to 2.0.1 in /.github/actions/setup (#27629) ci: bump actions-rust-lang/setup-rust-toolchain from 2.0.0 to 2.0.1 (#27627) ...
The breadcrumb controller merge (#27319) reverted the sidebar structure from #27289, moving aria-expanded back onto the list item and flattening child rows. Restore the nested subnav list, keep aria-expanded on the toggle, and keep the whole section button as the toggle when a group has no link of its own. Co-authored-by: Ken Sternberg <[email protected]>
The breadcrumb controller merge (#27319) reverted the sidebar structure from #27289, moving aria-expanded back onto the list item and flattening child rows. Restore the nested subnav list, keep aria-expanded on the toggle, and keep the whole section button as the toggle when a group has no link of its own. Co-authored-by: Ken Sternberg <[email protected]>
The breadcrumb controller merge (#27319) reverted the sidebar structure from #27289, moving aria-expanded back onto the list item and flattening child rows. Restore the nested subnav list, keep aria-expanded on the toggle, and keep the whole section button as the toggle when a group has no link of its own. Co-authored-by: Ken Sternberg <[email protected]>
…type-check tests (#27681) * web/elements: restore sidebar toggle expanded state and nested sublists The breadcrumb controller merge (#27319) reverted the sidebar structure from #27289, moving aria-expanded back onto the list item and flattening child rows. Restore the nested subnav list, keep aria-expanded on the toggle, and keep the whole section button as the toggle when a group has no link of its own. Co-authored-by: Ken Sternberg <[email protected]> * web/components: move the drawer panel into its own module The WithNotifications mixin imports the notification utilities, so registering the drawer elements there created an import cycle that crashed the admin interface on load. Render the panel from its own module instead. * web: let unit tests import Lit elements Compile legacy decorators in the unit project, which skips tsconfig discovery, and install @lit-labs/ssr-dom-shim globals so element modules load under Node. * web: fix lint warnings * web: reference browser globals directly Drop the self and globalThis prefixes in favour of bare globals, and use window for browser-specific APIs such as window.location, window.open and window.postMessage. Declare setTimeout and setInterval as returning a number, since @types/node is always in the program and its timers return Timeout. * web/common: remove the dev request middleware's listeners on dispose Dispose only removed the hashchange listener, leaving the refresh and click listeners attached. * web: type-check colocated tests Add the tsconfig.unit.json the unit project already referenced, run build:types against it, and fix the type errors it exposes. * Fix lint. --------- Co-authored-by: Ken Sternberg <[email protected]>
web/admin: Add a Breadcrumb context manager to the navigation suite
Description
This commit introduces a Breadcrumb component (patterned on the Patternfly 5 Breadcrumb Component) and introduces a BreadcrumbController that tracks changes in our navigation to provide information in the format the Breadcrumb component expects.
What
First, a little maintenance:
findCurrentSidebarKeyandfindSidebarSectionByRouteare the same function, it’s just that one returns the key used by the code, the other returns the label used by humans. (Also, they took their arguments in different order). I’ve renamed the latter tofindCurrentSidebarSectionLabel, made the argument sequences the same, and extracted the common functionality.The function
findSidebarEntriesnow returns a list of sidebar entries. Most functions are only interested in the last one (the tip of the route is the page or page/tab combo you’ve navigated to) but having that information is useful.Breadcrumb Context Controller
The Breadcrumb controller is a standard parasitic context manager: it attaches to an object and monitors that object’s behavior, translating changes in that object into messages for other services to use. To enable it, you need only add exactly one line to an Interface, creating an instance of the controller. It does everything else. The controller has no additional external dependencies, and it creates no new external obligations.
Because of our split navigation (Routes for collections, Tabs for objects), the controller listens for both events, identifies the current full path according to the SidebarEntries, and records each step along the way. It publishes this information as an active context object. And that’s pretty much all it does.
Breadcrumb Component (
ak-breadcrumb)The Breadcrumb Component takes a property argument,
.entries, that is a list of{ label, path? }pairs; if the path is present and is not the page you’re currently looking at, the label will be wrapped in an anchor for easy navigation up the hierarchy.The Breadcrumb Component is API-free.
Breadcrumb UI Component (
ak-ui-breadcrumb)The Breadcrumb UI Component inherits and extends the Breadcrumb component by plugging into the Breadcrumb Context and pushing the context changes into the the
.entriesfield before rendering. This avoids both API entanglement with the Breadcrumb renderer, having to remember how to use it as a slotted controller, or some other shenaningans to getak-breadcrumbinto the right position.Miscellaneous
Jens thought shortening “Enterprise Only” to “Enterprise” and floating it to the right looked nice.
Checklist
make all)make docs)