* .
* .
* web/element: Move the SidebarVersion out of Elements.
# 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.
* Replace aria wayfinders used for testing with Open UI Automation identifiers.
* web/element: remove license & capabilities requirements from SidebarItem
# 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.
* Unneeded debugging information.
* Progress has been made.
* web/admin: Simplify sidebar entries handling
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?
* That side effect infected downstream tests. Darnit.
* Formatter opinions.
* 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.
* The test exists and passes.
* Fix some merge issues.
\# What
\# Why
\# How
\# Designs
\# Test Steps
\# Other Notes
* It almost works. It renders, it doesn't fail, but the CSS is still borked.
* .
* web/admin: Simplify sidebar entries handling
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?
* That side effect infected downstream tests. Darnit.
* Formatter opinions.
* 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.
* The test exists and passes.
* .
* .
* web/element: Move the SidebarVersion out of Elements.
# 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.
* Replace aria wayfinders used for testing with Open UI Automation identifiers.
* Expansion tests updated.
* .
* web/admin: Make Sidebar a wholly coherent and independent entity
This commit revises how Sidebar works.
I introduce a new type that the Sidebar understands: `SidebarItem`:
``` javascript
export interface SidebarItem {
label: string;
key: string;
expanded?: boolean;
path?: string | null;
notice?: string | TemplateResult | null;
children?: SidebarItem[];
}
```
## Sidebar changes
This type is meant to drive the Sidebar alone, independent of the needs of any client code (although it is, obviously, good enough to support ak-interface-admin).
I revise `Sidebar` to be the whole component; no SidebarItem renderer, no slots. The container into which it is rendered is the client code’s responsibility. There are two levels of rendering: the Groups and the Items, and right now they’re only distinguished by “Does it have children?” There were four renderers in SidebarItem, and two of them are gone since they were unused.
I have deliberately left room to revise this again so that a second-level can support a path *and* children. I have an idea for what to do with it.
The CSS has entirely been brought in to handle a single sidebar.
## Sidebar Session Persistence
This is entirely in a controller now; it only needs to be included to do its magic, and it works quite well. I have also revised the very long function names in `expansion.ts` and treat the entire file as a single namespace. The names are shorter and more readable, and can be imported with the `* as SidebarExpansion` syntax to support the full namespace.
This makes Sidebar Session Persistence swappable with a Sidebar Device Persistence (using `localStorage`), should we so desire.
Functions in `expansion` that no one was using have been deleted. YAGNI forever.
## Navigation
*`sidebarEntries.ts`*
The navigation folder is split: the `Entries` file was always meant to be an easy-to-find collection of all the *Entries*, and nothing more, the Entries themselves were meant to be easily editable and fit within a visually informative table. All the tooling cluttered that. With one exception, all tooling has been mooved to the `Tools` file. That exception is a tool, *here*, that will either hand you a “plain” SidebarEntries, or a “can enterprise” SidebarEntries, based on a flag. That logic does not belong in the Interface file.
*`sidebarTools.ts`*
Contains two separate units: one converts the `SidebarEntries` collection into a `SidebarItems` collection fit for sending to the Sidebar. The others (a) assists the Interface in finding the right key to send to the Sidebar for the current path, and (b) assists the header in filling out the page title.
Due to some of the needs in the Interface, `resolveSidebarItems` is an `ExtendedSidebarItem`; it has extra fields to help the CommandPalette. The shape passed to Sidebar is an unchanged `SidebarItem`.
## Interface
The palette code is revised to understand the new `ExtendedSidebarItem` format.
The `ak-page-navbar` and `ak-sidebar` calls have been revised to take the new format. The values are derived at the beginning of the `render()` function to avoid multiple calls to the resolvers.
* I didn't think I'd fat finger while writing the commit message, but what do I know?
* Added the requirement that every item passed to the sidebar must have a path or children (or both; both is good too)
* Almost there.
* Almost there.
* web/admin: Put icons in the sidebar.
## Description
This commit updates the Sidebar to have icons next to top-level headers.
## What
1. Add icons to `AdminSidebarEntries`. The type of `SidebarItem` and `SidebarEntry` have been updated to support this change.
2. Add a unit test to Admin to validate that every SidebarItem we generate has a path or children. This is not an exclusive-or; it allows for both. I’m leaving room for another feature. 😈
3. Bring the entirety of the sidebar into a new namespace, `ak-c-sidebar`. It is now vendored. Anything we weren’t using, I’ve thrown overboard.
4. Each row is now a grid with very solid definitions for the width of the icon and the toggle; the label is given the rest of the horizontal space. This lets us define both the icon and the “rail” (movement/reassurance indicator) and position them perfectly without having to invoke pixels at our end.
5. Update the renderers to produce three different kinds of navigation rows: links, toggles, and toggle-plus-link.
* Recommendation from automated review.
* Revised naming code to track certain features.
* Adding the Breadcrumbs visual component.
* 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](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.
* The updated format for crumbs required an update to the unit tests.
* Sidebar in progress.
* web/admin: Add a Bookmark context manager to the navigation suite
## Description
This commit introduces a Bookmark component.
### The Controller
The BookmarkController is a context provider that does two things:
1. It reads and writes the user’s collection of bookmarks to storage. Right now, the only storage being used is localStorage. This storage is on a per-device (note: *not* per user) basis, and does not travel if the user logs into authentik from different devices. It provides this collection as a context for interested client code to use.
2. It provides a method that can be used by the host component to intercept the SidebarItem\[\] collection and add its own third-tier `children` collection, providing paths and names for bookmarked items.
### The Component
The Bookmark (`ak-bookmark`) monitors the BreadcrumbContext and decides whether or not it should show a Bookmark tab or not. The Bookmark component should be placed someplace where bookmarking would make sense, such as next to the page header `#page-navbar-heading`. The Bookmark component also consumes the BookmarkContext to decide *which* bookmark icon to show: the hollow version or the filled version.
## Status
The Bookmark component’s API-aware extension is now slotted when appropriate; the navbar has been extended to include it. The navbar has also been extended to include a breadcrumb slot if there is no description, creating a consistent view of all verticals across all pages.
* Added comments and details.
* I should keep my promises: bookmarks go into localStorage.
* Revised naming code to track certain features.
* Adding the Breadcrumbs visual component.
* 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](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.
* The updated format for crumbs required an update to the unit tests.
* Sidebar in progress.
* web/admin: Add a Bookmark context manager to the navigation suite
This commit introduces a Bookmark component.
The BookmarkController is a context provider that does two things:
1. It reads and writes the user’s collection of bookmarks to storage. Right now, the only storage being used is localStorage. This storage is on a per-device (note: *not* per user) basis, and does not travel if the user logs into authentik from different devices. It provides this collection as a context for interested client code to use.
2. It provides a method that can be used by the host component to intercept the SidebarItem\[\] collection and add its own third-tier `children` collection, providing paths and names for bookmarked items.
The Bookmark (`ak-bookmark`) monitors the BreadcrumbContext and decides whether or not it should show a Bookmark tab or not. The Bookmark component should be placed someplace where bookmarking would make sense, such as next to the page header `#page-navbar-heading`. The Bookmark component also consumes the BookmarkContext to decide *which* bookmark icon to show: the hollow version or the filled version.
The Bookmark component’s API-aware extension is now slotted when appropriate; the navbar has been extended to include it. The navbar has also been extended to include a breadcrumb slot if there is no description, creating a consistent view of all verticals across all pages.
* Added comments and details.
* I should keep my promises: bookmarks go into localStorage.
* web/admin: make the bookmark a toggle button and drop the breadcrumb heading wrapper
* Changes requested by reviewer (@GirlBossRush).
* Formatters. Feh!
---------
Co-authored-by: Teffen Ellis <[email protected]>
* initial attempt at web changes
* policies: surface dry-run results in events
* web: support static binding dry runs and fix result links
* web: leave translation extraction to automation
* web/policies: align dry-run action with binding controls
* web/policies: address dry-run UI review feedback
* web/policies: address dry-run UI review feedback
- Move renderDryRunHelp from #common/policies/utils to
#admin/policies/renderDryRunHelp, since only the admin app uses it.
- Render the policy raw result in <pre> so indented JSON keeps its
whitespace, and hide the row when there is no raw result
(non-expression policies).
- Build the dry-run events AKQL query as a single string.
* stages/authenticator_validate: keep the pending WebAuthn challenge until it's answered
Rendering the stage again, from another tab or a selection request, replaced the
challenge an in-progress assertion was signed for. Reuse it instead, and remove
it once validated, skipped, enrolled, or passed by identification.
Co-authored-by: Jens Langhammer <[email protected]>
* web/flow: only notify the server of SMS and email challenge selections
Selecting any other device has no effect on the server, but the request still
re-renders the stage and races the actual response.
* verify tab B reuses challenge and tab A’s original assertion succeeds.
---------
Co-authored-by: Jens Langhammer <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]>
* web: move entrypoint bodies into importable modules
Entrypoints import the moved module, with no change in behavior. This
lets a later change run code before the interface modules evaluate.
* web/i18n: load the locale catalog before the interface boots
The locale is fixed per page since #25156, but the catalog still loaded
from a component lifecycle hook, after every statically imported module
had evaluated. Module-level msg() calls returned English.
- each entrypoint awaits initializeLocale() before importing the interface
- the lit-localize runtime moves to #common/ui/locale/runtime
* web/i18n: remove live locale switching
Switching locale reloads the page since #25156, and the catalog now loads
before boot, so nothing observes a locale change after startup.
- LocaleContextController only provides the runtime; drop the lang observer
- drop the activeLanguageTag setter from WithLocale
- drop LOCALE_STATUS_EVENT listeners in the admin interface, API locale
middleware, captcha stage, and locale select
* Fix type.
* Unify types.
* web/i18n: unwrap msg() thunks in label records
The catalog now loads before any interface module evaluates, so label
records can hold translated strings directly.
- label records hold strings instead of MessageFormatter thunks
- call sites read the value instead of calling it
* .
* .
* web/element: Move the SidebarVersion out of Elements.
# 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.
* Replace aria wayfinders used for testing with Open UI Automation identifiers.
* web/element: remove license & capabilities requirements from SidebarItem
# 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.
* Unneeded debugging information.
* Progress has been made.
* web/admin: Simplify sidebar entries handling
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?
* That side effect infected downstream tests. Darnit.
* Formatter opinions.
* 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.
* The test exists and passes.
* Fix some merge issues.
\# What
\# Why
\# How
\# Designs
\# Test Steps
\# Other Notes
* It almost works. It renders, it doesn't fail, but the CSS is still borked.
* .
* web/admin: Simplify sidebar entries handling
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?
* That side effect infected downstream tests. Darnit.
* Formatter opinions.
* 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.
* The test exists and passes.
* .
* .
* web/element: Move the SidebarVersion out of Elements.
# 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.
* Replace aria wayfinders used for testing with Open UI Automation identifiers.
* Expansion tests updated.
* .
* web/admin: Make Sidebar a wholly coherent and independent entity
This commit revises how Sidebar works.
I introduce a new type that the Sidebar understands: `SidebarItem`:
``` javascript
export interface SidebarItem {
label: string;
key: string;
expanded?: boolean;
path?: string | null;
notice?: string | TemplateResult | null;
children?: SidebarItem[];
}
```
## Sidebar changes
This type is meant to drive the Sidebar alone, independent of the needs of any client code (although it is, obviously, good enough to support ak-interface-admin).
I revise `Sidebar` to be the whole component; no SidebarItem renderer, no slots. The container into which it is rendered is the client code’s responsibility. There are two levels of rendering: the Groups and the Items, and right now they’re only distinguished by “Does it have children?” There were four renderers in SidebarItem, and two of them are gone since they were unused.
I have deliberately left room to revise this again so that a second-level can support a path *and* children. I have an idea for what to do with it.
The CSS has entirely been brought in to handle a single sidebar.
## Sidebar Session Persistence
This is entirely in a controller now; it only needs to be included to do its magic, and it works quite well. I have also revised the very long function names in `expansion.ts` and treat the entire file as a single namespace. The names are shorter and more readable, and can be imported with the `* as SidebarExpansion` syntax to support the full namespace.
This makes Sidebar Session Persistence swappable with a Sidebar Device Persistence (using `localStorage`), should we so desire.
Functions in `expansion` that no one was using have been deleted. YAGNI forever.
## Navigation
*`sidebarEntries.ts`*
The navigation folder is split: the `Entries` file was always meant to be an easy-to-find collection of all the *Entries*, and nothing more, the Entries themselves were meant to be easily editable and fit within a visually informative table. All the tooling cluttered that. With one exception, all tooling has been mooved to the `Tools` file. That exception is a tool, *here*, that will either hand you a “plain” SidebarEntries, or a “can enterprise” SidebarEntries, based on a flag. That logic does not belong in the Interface file.
*`sidebarTools.ts`*
Contains two separate units: one converts the `SidebarEntries` collection into a `SidebarItems` collection fit for sending to the Sidebar. The others (a) assists the Interface in finding the right key to send to the Sidebar for the current path, and (b) assists the header in filling out the page title.
Due to some of the needs in the Interface, `resolveSidebarItems` is an `ExtendedSidebarItem`; it has extra fields to help the CommandPalette. The shape passed to Sidebar is an unchanged `SidebarItem`.
## Interface
The palette code is revised to understand the new `ExtendedSidebarItem` format.
The `ak-page-navbar` and `ak-sidebar` calls have been revised to take the new format. The values are derived at the beginning of the `render()` function to avoid multiple calls to the resolvers.
* I didn't think I'd fat finger while writing the commit message, but what do I know?
* Added the requirement that every item passed to the sidebar must have a path or children (or both; both is good too)
* Almost there.
* Almost there.
* web/admin: Put icons in the sidebar.
## Description
This commit updates the Sidebar to have icons next to top-level headers.
## What
1. Add icons to `AdminSidebarEntries`. The type of `SidebarItem` and `SidebarEntry` have been updated to support this change.
2. Add a unit test to Admin to validate that every SidebarItem we generate has a path or children. This is not an exclusive-or; it allows for both. I’m leaving room for another feature. 😈
3. Bring the entirety of the sidebar into a new namespace, `ak-c-sidebar`. It is now vendored. Anything we weren’t using, I’ve thrown overboard.
4. Each row is now a grid with very solid definitions for the width of the icon and the toggle; the label is given the rest of the horizontal space. This lets us define both the icon and the “rail” (movement/reassurance indicator) and position them perfectly without having to invoke pixels at our end.
5. Update the renderers to produce three different kinds of navigation rows: links, toggles, and toggle-plus-link.
* Recommendation from automated review.
* Revised naming code to track certain features.
* Adding the Breadcrumbs visual component.
* 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](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.
* The updated format for crumbs required an update to the unit tests.
* Revised naming code to track certain features.
* Adding the Breadcrumbs visual component.
* 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](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.
* The updated format for crumbs required an update to the unit tests.
* Changes requested by reviewer (@GirlBossRush).
* web/elements: vendor sidebar and add icons
* web/elements: put sidebar expanded state on the toggle and nest sublists
---------
Co-authored-by: Teffen Ellis <[email protected]>
* Get rid of that empty column; we'll use styling instead.
* web/admin: Provide a stronger visual hierarchy for expansion rows.
## Description
The lack of visual separation between BoundPoliciesList, TaskList, and ScheduleList in expansion rows has always irritated me. It’s hard to make out what I’m looking at, at any given time. This commit creates a new visual primitive to make that easier, and wraps expansion row targets in it.
### SectionCard
This commit provides a new visual primitive element, `ak-section-card`, that exists strictly to provide that visual separation: a strong label, a consistent location for the description, a visual separation using both whitespace and a border to create visual distinctiveness between components in an expansion row.
### Table
The table CSS is updated to say that if the table has an `ak-section-card` in it, it’s a flex display with objects in top-to-bottom order, and it has off-the-inline-start spacing so that each “depth” of the hierarchy is clear and apparent.
The table itself is updated to get rid of the leftmost column. It wasn’t used by default, and its spacing was quite wide compared to the design provided by this change.
### Tasks and Schedules
The tasks and schedules lists have been wrapped in SectionCard and properly annotated with labels (“Tasks” or “Schedules”) as appropriate.
Cleanup: Rather than create a new SectionCard for the task list associated with a schedule, I just read in the taskList functional renderer from `TaskList`.
### BoundPoliciesList
While I was replacing the BoundPoliciesList with SectionCard-wrapped equivalents, I noticed that they all had a set pattern, so I extracted the pattern and created a `renderBoundPoliciesExpansion()` function that handles all the details. That both cleaned up a number of call locations and affirmed their types, and it let me only have to write one new SectionCard wrapper.
Cleanup: In order to avoid duplicating the default `allowedTypes` from BoundPoliciesList in `renderBoundPoliciesExpansion()`, I extracted the default list into a top-level `const` and exported it; now both can use it safely.
Cleanup: The description of the bound policies for ApplicationEntitlements is now in the correct place.
## Status
I haven’t figured out what to do with the `F#$!%!^!#` `Path:` field in the BlueprintsList page.
* Well, that was potentially embarrassing.
* Although we don't use it, The BoundPoliciesList description slot can take anything, so I provided a capacity to pass it a 'TemplateResult'. I don't know, maybe someone will want to pass text wrapped in a tooltip or something someday.
* Still trying to get the whitespace exactly right.
* Move the path into the 'name & description' block, creating a more unified view.
* Better structure.
* Don't have description lists on that page anymore, so we don't need the extra CSS or its override.
* That's so much nicer.
* Let tables bleed to the edge, but provide spacing for the DescriptionLists in DataExport.
* Too much whitespace between the header and the body. Fixed.
* Update web/src/admin/policies/renderPolicyBindings.ts
Co-authored-by: Teffen Ellis <[email protected]>
Signed-off-by: Ken Sternberg <[email protected]>
* Update web/src/admin/policies/renderPolicyBindings.ts
Co-authored-by: Teffen Ellis <[email protected]>
Signed-off-by: Ken Sternberg <[email protected]>
* Update web/src/admin/requests/BoundRequestRulesTable.ts
Co-authored-by: Teffen Ellis <[email protected]>
Signed-off-by: Ken Sternberg <[email protected]>
* Some manual edits as suggested by a reviewer (@GirlBossRush)
* Some manual edits as suggested by a reviewer (@GirlBossRush)
* Return types interefered with build and type resolution. Let the inferer do its job.
---------
Signed-off-by: Ken Sternberg <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]>
* web/sources/ldap: fix parent group submission and type-check field names
* web/tests: fix LDAP source form regression coverage
* web/elements: add typed field() helper to Form
Replace the repeated `"x" satisfies keyof LDAPSourceRequest` clauses in
LDAPSourceForm with `this.field("x")`, which checks field names against
the form's submitted data type `D`.
Forms should pass their `*Request` type as `D` before adopting it: the
default (the model type) includes read-only fields like `pk` and omits
write-only fields like passwords and secrets.
* providers/oauth2: sign tokens with ML-DSA keys
* Apply suggestion from @kensternberg-authentik
Co-authored-by: Ken Sternberg <[email protected]>
Signed-off-by: Jens L. <[email protected]>
* providers/oauth2: use MLDSAAlgorithm.algorithm_for_key and MLDSAKey
* providers/oauth2: skip ML-DSA JWKS tests when FIPS is enabled
* providers/oauth2: expect ML-DSA in the supported signing key types message
---------
Signed-off-by: Jens L. <[email protected]>
Co-authored-by: Jens L. <[email protected]>
Co-authored-by: Ken Sternberg <[email protected]>
Name the element after what it is, not the library behind it, ahead of
replacing CodeMirror.
- Rename `<ak-codemirror>` to `<ak-code-editor>`
- Move `#elements/CodeMirror` to `#elements/CodeEditor`
- Rename `CodeMirrorMode` and the source helpers to match
Co-authored-by: Dominic R <[email protected]>
## Description
This commit adds a little CSS to ensure the toggle group is centered on the PolicyBindingForms.
The rule that “child components should not enforce their position or dimension; leave that to the client code to make those decisions” can sometimes make for awkward fits; in this case, a flex-wrapper to ensure centering.
The toggle group is also used in:
- ProxyProviderForm
- Ak-Application-Wizard-Edit-Binding-Steps
- BlueprintForm
- BlueprintImportForm
I have checked all five locations (the above, and PolicyBindingForms), and the toggle group is now centered in the Form in all cases.
Closes \#27357
* move Initial Permissions to Customization
* fix get_perms() for superusers with an object
Due to shortcuts this doesn't actually ever run, but fixing it anyway
* validate blueprint permissions against the database
* add custom permissions
* log permission assignments
* route API authorization through one decision point per phase
* add permission checks
* add field rules to permission checks
* let permission checks alter responses
* web: manage custom permissions
* web: manage permission checks
* website: document custom permissions and permission checks
* `make gen`
* Docs changes
* website/docs: cleanup
* fix typo in the custom permissions flag help
* format custom permission help text
* reword docs
* select list items by `[pk=...]` in field rule paths
* prefix permission check function names with `RBAC_FUNC_`
* trace `visible_objects`
* inline test helpers
* check the custom permissions flag first
* fixup! Merge branch 'main' into rbac/custom-permissions
* fixup! fixup! Merge branch 'main' into rbac/custom-permissions
---------
Co-authored-by: Dewi Roberts <[email protected]>
Co-authored-by: Dominic R <[email protected]>
Confirming the "Select users" dialog replaced the pending list in the
"Assign Additional Users" form, so a second visit to the dialog dropped
the users picked in the first. Each confirm now merges its selection into
the pending list by primary key. The role assignment path shares the form.
The "Simple group" browser test now picks two users in separate visits to
the selection dialog and asserts both are members after assignment.
Fixes#27277
Every AKElement built its own CSSStyleSheet from the brand's custom CSS,
so a page with N elements parsed the brand CSS N times and held N
copies. Lit's sheet cache never hit because createCSSResult wraps the
string in a new strings array each call. This hurts most when the brand
CSS inlines a font or image.
Build the sheet once and have every element and nested shadow root
adopt it. The cache is keyed on the CSS text so a re-read server
context, as injectBrand does in tests, still gets a matching sheet.
* web/elements: keep dialog messages after the dialog closes
A dialog's messages render in its own container, above the modal backdrop.
Closing the dialog removed them, along with confirmations shown on submit.
- Move a closing dialog's messages to the next container: the dialog below, or the page
- Add `findMessageContainer()`, shared with `showMessage()`
* web/elements: remove the unused ak-message event listener
Every message container listened on `window` for `ak-message`, and never
stopped. Nothing dispatches the event. The listener kept each closed dialog's
container in memory.
- Remove the listener from `MessageContainer`
- Remove `AKMessageEvent`
* stages/user_login: restrict sessions with next actions
* core: return a fixed next-action validation error
* stages/user_login: keep malformed next actions restricted
* stages/user_login: preserve required flow plans on direct entry
* stages/user_login: preserve attribute updates during action completion
* stages/user_login: enforce next actions when adding an account
* stages/user_login: reuse Django routing for restricted sessions
* core: verify delegated next-action permissions
* stages/user_login: resolve required flows with Django in_bulk
* core: simplify next-action audit handling
* stages/redirect: retain required-action completion across flow handoffs
* stages/user_login: remove redundant next-action tests
* enterprise: own required-action enforcement and validation
* enterprise: simplify next-action audit changes
* stages/redirect: make cooperative initialization explicit
* core, enterprise, web: enforce required actions on every request
Review asked for three changes: pause and resume flows the way the
Source stage does instead of splicing a completion stage into other
flows, apply actions to sessions that already exist, and a clearer name.
The middleware now reads goauthentik.io/user/required-actions on every
authenticated request, so an action added to a logged-in user applies on
their next request and the User Login stage needs no hook. Starting an
action suspends what the user was doing: a flow in progress is kept on
the action's completion stage and restored afterwards, and any other
page is opened again. The Redirect stage hook is gone, so an action flow
can no longer hand off to another flow.
The set and removed events are dropped because the user's model_updated
event already records the attribute change. Validation only runs when
the value changes, so a deleted flow doesn't block unrelated edits.
* enterprise/required_actions: tighten validation and resumed requests
Reject flows that a logged-in user can never plan, such as the
unauthenticated recovery and enrollment flows, which would otherwise
lock the user out. Keep the body of a suspended POST in the session,
as the login redirect does, so a SAML POST binding still works once the
actions are done. Complete the action for the plan's pending user, so a
plan restored in another browser from an email link doesn't fail.
* set the pending user on action plans
Otherwise an Email stage can fail with "No pending user." and leave
the user stuck.
---------
Co-authored-by: Simonyi Gergő <[email protected]>