Repository navigation
web/elements: rebuild ak-search-select as a form-associated element - #25610
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25610 +/- ##
=======================================
Coverage 92.35% 92.36%
=======================================
Files 1177 1177
Lines 78074 78074
Branches 4129 4129
=======================================
+ Hits 72107 72112 +5
+ Misses 5901 5896 -5
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-171be88e1672d70004ebad76d18c8b5d09854f3a
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-171be88e1672d70004ebad76d18c8b5d09854f3aAfterwards, run the upgrade commands from the latest release notes. |
171be88 to
8ed1749
Compare
e30f53b to
14dbf85
Compare
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 37723468869 -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-def879db6652fb5f1cd10b8bdb393492b9541c85
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-def879db6652fb5f1cd10b8bdb393492b9541c85Afterwards, run the upgrade commands from the latest release notes. |
14dbf85 to
c686978
Compare
a055efe to
4fcb48c
Compare
4fcb48c to
d19f04b
Compare
kensternberg-authentik
left a comment
There was a problem hiding this comment.
Two things that stood out at me, but this is mostly too huge to review manually. (Sorry). I did my best, but this ate two hours and i'm still not sure of everything going on inside.
| element.show(); | ||
| await element.updateComplete; | ||
|
|
||
| element.renderRoot.querySelector<HTMLElement>("#option-blank")!.click(); |
There was a problem hiding this comment.
So if I have Flow or Certificate with the slug "blank", which one will I get? :-)
| aki(CoreApi) | ||
| .coreUsersList(withQuery(query, { ordering: "username" })) | ||
| .then(({ results }) => results), | ||
| keyOf: (user) => String(user.pk), |
There was a problem hiding this comment.
export interface User {
/**
*
* @type {number}
* @memberof User
*/
readonly pk: number;
Is there any place in our code where this key is sent back through client-ts to the server? Because if there is, this is gonna break.
Some fields only know their value once they have loaded their options, e.g. a search select that preselects a default flow. A form submitted before then serialized them empty. - Add a SettlingFormField contract (a `settled` promise) and settleFormFields(), which waits on every settling field in a form. - Form.submit() settles the form's fields before validating and serializing. - FormWizardPage no longer pre-validates before submit(), which settles and validates itself, and treats a `false` result as a failed step. - The application wizard's provider step settles before checking validity.
Replace ak-search-select, its view, ak-list-select, and the EZ variant with a single form-associated element built on the platform: a native combobox input, a popover listbox positioned with CSS anchor positioning (with a JS fallback for Firefox), and ElementInternals for its value and validity. - `value` is the chosen key. Options come from a SearchSelectSource (fetchObjects, keyOf, labelOf, describe, isDisabled, groupBy, preselect). `selectedObject` labels the field before the options load, and the selection stays listed when it isn't on the fetched page. - `settled` resolves once the latest fetch lands, for Form.submit() to wait on. - Keyboard navigation with aria-activedescendant, a pinned action item, a blank option, creatable free text, and closing on outside clicks even when focus stays in the input. A late preselection doesn't close an open menu. - The input takes its accessible name from `label`, the field's <label>, or the enclosing horizontal form element, since none can reach it across the shadow root. - `emptyValue` sets what an empty field serializes as, for string fields. Component tests cover the element.
Replace the per-type wrapper elements with function components over the new element: AKSearchSelect and AKSearchSelectField, AKFlowSearch and AKFlowField, and AKCertificateSearch. Shared sources for policies, groups, users, device access groups, roles, and notification mappings live in #admin/common/search-sources. ak-file-search-input moves onto a file source with free-text values.
The authorization, authentication, and invalidation flow fields repeat across the provider forms, and the pre-authentication, authentication, and enrollment flow fields across the source forms. So do the SAML NameID and AuthnContextClassRef mapping fields. Each becomes a field preset with the shared wording, which forms can override.
Also fixes the brand's default flows never preselecting in the LDAP and RADIUS provider forms: the brand stores slugs, not primary keys.
Brands, outposts, events, RBAC, blueprints, endpoints, lifecycle rules, requests, tokens, users, object attributes, property mapping tests, and sync objects. Blueprint paths serialize as an empty string when unset, since the field isn't nullable.
The form fixture finds search selects by their label and chooses options by role. New cases cover a default flow still loading at submit, keyboard and search, outside clicks, edit forms showing saved values, and a group binding in the application wizard.
Rebasing onto main brought in settle-form-fields.ts from #26566, while this branch still carried its own earlier copy of settleFormFields and SettlingFormField in form-associated-element.ts. Form.ts imported both, which failed type checking with a duplicate identifier. Keeps main's version, which also times out and never rejects, and points Form and ak-search-select at it.
38b5fed to
d34f0b7
Compare
…n tests The LDAP source form submitted its parent group as `additionalParentGroup`, a name the API doesn't know, so the group never saved. Submit it as `syncParentGroup`. The admin tables render a second create button in their empty state while rows load, so an unscoped "New …" click could match two buttons. Scope those clicks in the e2e tests to the table toolbar, as the provider tests already do.
…s unique - Sources can declare parseKey(); the user and provider sources send their primary keys as numbers again, matching main. - Object option IDs get their own prefix and an unambiguous encoding, so keys like "blank" or "action" no longer collide with the built-in options. - The active option scrolls into view by its rendered ID.
Wizard steps and modal forms checked validity synchronously before waiting for fields to settle, so a required search select still preselecting its default rejected the click and never retried. - WizardStep waits for settled() before validating Next/Finish and ignores repeat clicks meanwhile; ApplicationWizardStep settles its form. - ModalForm settles the form before its validity check. - Cover the provider step with an e2e test that holds back the invalidation flows.
This PR rebuilds
ak-search-selectas a single form-associated element The commits are grouped for review: the element, then components and shared sources, presets, call sites by area, and tests.ElementInternalssupport, the selection stays listed even when it isn't on the fetched page.AKSearchSelectAKSearchSelectFieldAKFlowSearchAKFlowField,AKCertificateSearch