-
-
Notifications
You must be signed in to change notification settings - Fork 909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web: provide simple tables for API-less displays #11028
Conversation
…from the backend Provide an alternative, readonly, disabled, unindexed input object with the text "Loading...", to be replaced with the _real_ input element after the content is loaded. This provides the correct appearance and spacing so the content doesn't jiggle about between the start of loading and the SearchSelect element being finalized. It was visually distracting and unappealing.
…correct component under test.
- Add a unit test to ensure the "Loading..." element is displayed correctly before data arrives - Demo how to mock a `fetchObjects()` call in testing. Very cool. - Make distinguishing rule sets for code, tests, and scripts in nightmare mode - In SearchSelect, Move the `styles()` declaration to the top of the class for consistency. - To test for the FLOUC issue in SearchSelect. This is both an exercise in mocking @BeryJu's `fetchObjects()` protocol, and shows how we can unit test generic components that render API objects.
…select-table * web/bug/search-select-flouc-issue: web: test for flash of unstructured content web: comment on state management in API layer, move file to point to correct component under test. web: fix Flash of Unstructured Content while SearchSelect is loading from the backend
Mostly these tests assert that the table renders and that the content we give it is where we expect it to be after sorting. For select tables, it also asserts that the overall value of the table is what we expect it to be when we click on a single row, or on the "select all" button.
✅ Deploy Preview for authentik-docs canceled.
|
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
* main: website/docs: cve release notes (#11026) security: fix CVE-2024-42490 (#11022) web: bump API Client version (#11021) providers/scim: optimize sending all members within a group (#9968) providers/scim: add API endpoint to sync single user (#8486) web: bump chromedriver from 127.0.3 to 128.0.0 in /tests/wdio (#11017) web: dual-select uses, part 2: dual-select harder (#9377) web: fix flash of unstructured content, add tests for it (#11013) core: bump drf-orjson-renderer from 1.7.2 to 1.7.3 (#11015) core: bump github.com/gorilla/sessions from 1.3.0 to 1.4.0 (#11002) website/docs: Correct the forward authentication configuration template for Caddy (#11012)
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #11028 +/- ##
=======================================
Coverage 92.76% 92.76%
=======================================
Files 736 736
Lines 36542 36542
=======================================
+ Hits 33898 33900 +2
+ Misses 2644 2642 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-dbcf778874ee014e2e0820fc20460cbd49945db6
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s For arm64, use these values: AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-dbcf778874ee014e2e0820fc20460cbd49945db6-arm64
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s Afterwards, 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-dbcf778874ee014e2e0820fc20460cbd49945db6 For arm64, use these values: 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-dbcf778874ee014e2e0820fc20460cbd49945db6-arm64 Afterwards, run the upgrade commands from the latest release notes. |
Includes documentation updates and better tests for select-table.
…manipulate test DOMs directly in a browser.exec call so they run in the proper context and be await()ed properly
web/eslint.config.mjs
Outdated
@@ -41,6 +41,10 @@ export default [ | |||
}, | |||
files: ["src/**"], | |||
rules: { | |||
"lit/attribute-names": "error", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helpful when creating new elements!
@@ -296,6 +296,7 @@ | |||
"lint:types", | |||
"lint:components", | |||
"lint:spelling", | |||
"lint:package", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter for package.json itself was somehow missed.
await document.body.querySelector("ak-search-select-view")?.remove(); | ||
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit | ||
if (document.body["_$litPart$"]) { | ||
await browser.execute(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found in the course of testing: these need to be executed in the context of the browser, which can then be await()
ed; otherwise, they may not get cleared correctly, which may result in misleading test results.
|
||
const MAX_INSTANCES = 10; | ||
|
||
if (!skipChrome) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the tests run in Chrome. Environment variables now allow you to control if it should run in Firefox or Safari, and control which on-demand.
viteConfig: (config: UserConfig = { plugins: [] }) => ({ | ||
...config, | ||
viteConfig: (userConfig: UserConfig = { plugins: [] }) => ({ | ||
...userConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint no-shadow
web/wdio.conf.ts
Outdated
@@ -83,26 +114,13 @@ export const config: Options.Testrunner = { | |||
// and 30 processes will get spawned. The property handles how many capabilities | |||
// from the same test should run tests. | |||
// | |||
maxInstances: 10, | |||
maxInstances: runHeadless ? MAX_INSTANCES : 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint no-magic-numbers
* main: (30 commits) website/docs: prepare release notes for 2024.8 (#11011) translate: Updates for file web/xliff/en.xlf in zh_CN (#11070) translate: Updates for file web/xliff/en.xlf in zh-Hans (#11071) web: bump mermaid from 10.9.1 to 11.0.2 in /web (#11066) core: bump github.com/jellydator/ttlcache/v3 from 3.2.0 to 3.2.1 (#11059) Fix incorrect size redefinition for Discord avatar acquisition code. (#11050) core, web: update translations (#11051) website: bump micromatch from 4.0.5 to 4.0.8 in /website (#11052) core: bump django-pglock from 1.5.1 to 1.6.0 (#11058) core: bump goauthentik.io/api/v3 from 3.2024063.13 to 3.2024064.1 (#11060) core: bump github.com/prometheus/client_golang from 1.20.1 to 1.20.2 (#11061) web: bump the swc group across 2 directories with 11 updates (#11062) web: bump tslib from 2.6.3 to 2.7.0 in /web (#11063) web: bump @eslint/js from 9.9.0 to 9.9.1 in /web (#11064) web: bump syncpack from 12.4.0 to 13.0.0 in /web (#11065) web: bump @goauthentik/api from 2024.6.3-1724337552 to 2024.6.3-1724414734 in /web/sfe (#11067) web: Provide tests for the aggregate cards, fix a few minor things (#9744) enterprise: fix license status progress bar (#11048) root: backport version bump (#11045) web/flows: update flow background (#11044) ...
…. Map does not do full tracking.
* main: (92 commits) internal: fix go paginator not setting page correctly (#11253) core: bump google-api-python-client from 2.143.0 to 2.144.0 (#11241) core: bump twilio from 9.2.4 to 9.3.0 (#11242) core: bump github.com/prometheus/client_golang from 1.20.2 to 1.20.3 (#11243) core: bump ruff from 0.6.3 to 0.6.4 (#11244) core: bump pydantic from 2.8.2 to 2.9.0 (#11245) core: bump msgraph-sdk from 1.5.4 to 1.6.0 (#11246) web: bump the rollup group across 2 directories with 1 update (#11248) core: fix missing argument name escaping for property mapping (#11231) providers/ldap: rework search_group migration to work with read replicas (#11228) core, web: update translations (#11220) website: bump postcss from 8.4.44 to 8.4.45 in /website (#11221) core: bump golang.org/x/oauth2 from 0.22.0 to 0.23.0 (#11222) core: bump django-model-utils from 4.5.1 to 5.0.0 (#11223) web: bump @changesets/cli from 2.27.7 to 2.27.8 in /web (#11224) web: bump @types/node from 22.5.3 to 22.5.4 in /web (#11225) web/admin: improve error handling (#11212) providers/ldap: fix incorrect permission check for search access (#11217) web/admin: fix missing Sync object button SCIM Provider (#11211) website/docs: add note about terraform provider (#11206) ...
* main: (146 commits) website: bump @types/react from 18.3.8 to 18.3.9 in /website (#11502) core: bump debugpy from 1.8.5 to 1.8.6 (#11503) core: bump google-api-python-client from 2.146.0 to 2.147.0 (#11504) web: bump @types/node from 22.6.1 to 22.7.0 in /web (#11505) core, web: update translations (#11500) sources/ldap: fix mapping check, fix debug endpoint (#11442) web/admin: fix Authentication flow being required (#11496) web: bump the wdio group across 2 directories with 5 updates (#11494) web: bump turnstile-types from 1.2.2 to 1.2.3 in /web (#11495) web: bump the swc group across 2 directories with 11 updates (#11493) web: bump the eslint group across 2 directories with 5 updates (#11492) web: bump the storybook group across 1 directory with 7 updates (#11491) core: bump bandit from 1.7.9 to 1.7.10 (#11485) web: bump the rollup group across 2 directories with 3 updates (#11487) web: bump @types/node from 22.5.5 to 22.6.1 in /web (#11490) website/docs: use a more consistent version requirement notice (#11400) website/docs: clarify API browser access (#11373) website/integrations: Glitchtip: update redirect URL (#11438) web: bump knip from 5.30.4 to 5.30.5 in /web (#11479) fix: proxy provider - docker traefik label (#11460) ...
- Replace `th` with `td` in `thead` components. Because Patternfly. - Add @BeryJu's styling to the tables, which make it much better looking
* main: providers/oauth2: add indexes on tokens (#11524) website/scripts/docsmg: final version (#11501) web: bump ts-pattern from 5.3.1 to 5.4.0 in /web (#11512) web: bump @sentry/browser from 8.31.0 to 8.32.0 in /web in the sentry group across 1 directory (#11510) web: bump @types/node from 22.7.0 to 22.7.2 in /web (#11511) translate: Updates for file locale/en/LC_MESSAGES/django.po in zh_CN (#11516) web: bump @types/jquery from 3.5.30 to 3.5.31 in /web (#11513) web: bump @types/jquery from 3.5.30 to 3.5.31 in /web/sfe (#11514) translate: Updates for file web/xliff/en.xlf in zh_CN (#11517) core: bump twilio from 9.3.1 to 9.3.2 (#11515) translate: Updates for file web/xliff/en.xlf in zh-Hans (#11518) translate: Updates for file locale/en/LC_MESSAGES/django.po in zh-Hans (#11519)
Dependabot rolled us into WebdriverIO 9. While that's probably the right thing to do, right now it breaks out end-to-end tests badly. Dependabot's mucking with infrastructure should not be taken lightly, especially in cases when the infrastructure is for DX, not UX, and doesn't create a bigger attack surface on the running product.
- Roll back another dependabot breaking change, this time to WebdriverIO - Remove the redundant scripts wrapping ESLint for Precommit mode. Access to those modes is available through the flags to the `./web/scripts/eslint.mjs` script. - Remove SonarJS checks until SonarJS is ESLint 9 compatible. - Minor nitpicking.
…able * web/bug/fix-wdio-and-lint: web: small fixes for wdio and lint
… add them? Anyway, they were breaking the tests, they're a Wdio9-ism.
* main: website: update release notes for 2024.8.3 and 2024.6.5 (#11541) website/docs: added a Docs banner to announce new docs structure (#11525) security: fix CVE-2024-47070 (#11536) security: fix CVE-2024-47077 (#11535) sources/ldap: fix ms_ad userAccountControl not checking for lockout (#11532) web: Fix missing integrity fields in package-lock.json (#11509) core, web: update translations (#11527) core: bump ruff from 0.6.7 to 0.6.8 (#11528) web: bump the wdio group across 2 directories with 3 updates (#11529) web: bump @patternfly/elements from 4.0.1 to 4.0.2 in /web (#11530) web: bump @types/node from 22.7.2 to 22.7.3 in /web (#11531)
**PLEASE** Stop trying to upgrade WebdriverIO following Dependabot's instructions. The changes between wdio8 and wdio9 are extensive enough to require a lot more manual intervention. The unit tests fail in wdio 9, with the testbed driver Wdio uses to compile content to push to the browser ([vite](https://vitejs.dev) complaining: ``` 2024-09-27T15:30:03.672Z WARN @wdio/browser-runner:vite: warning: Unrecognized default export in file /Users/ken/projects/dev/web/node_modules/@patternfly/patternfly/components/Dropdown/dropdown.css Plugin: postcss-lit File: /Users/ken/projects/dev/web/node_modules/@patternfly/patternfly/components/Dropdown/dropdown.css [0-6] 2024-09-27T15:30:04.083Z INFO webdriver: BIDI COMMAND script.callFunction {"functionDeclaration":"<Function[976 bytes]>","awaitPromise":true,"arguments":[],"target":{"context":"8E608E6D13E355DFFC28112C236B73AF"}} [0-6] Error: Test failed due to following error(s): - ak-search-select.test.ts: The requested module '/src/common/styles/authentik.css' does not provide an export named 'default': SyntaxError: The requested module '/src/common/styles/authentik.css' does not provide an export named 'default' ``` So until we can figure out why the Vite installation isn't liking our CSS import scheme, we'll have to soldier on with what we have. At least with Wdio 8, we get: ``` Spec Files: 7 passed, 7 total (100% completed) in 00:00:19 ```
- provides a new utility, `_isSlug_`, used to verify a user input - extends the ak-horizontal-component wrapper to have a stronger identity and available value - updates the types that use the wrapper to be typed more strongly - (Why) The above are used in the wizard to get and store values - fixes a bug in SearchSelectEZ that broke the display if the user didn't supply a `groupBy` field. - Adds `@wdio/types` to the package file so eslint is satisfied wdio builds correctly - updates the end-to-end test to understand the revised button identities on the login page - Running the end-to-end tests verifies that changes to the components listed above did not break the semantics of those components.
…able * web/bug/fix-wdio-and-lint: Forgot to run prettier. web: small fixes for wdio and lint providers/oauth2: improve indexes on tokens (#11543) web: bump API Client version (#11544) release: 2024.8.3 (#11542) package-lock.json update website: update release notes for 2024.8.3 and 2024.6.5 (#11541) website/docs: added a Docs banner to announce new docs structure (#11525) security: fix CVE-2024-47070 (#11536) security: fix CVE-2024-47077 (#11535) sources/ldap: fix ms_ad userAccountControl not checking for lockout (#11532) web: Fix missing integrity fields in package-lock.json (#11509) core, web: update translations (#11527) core: bump ruff from 0.6.7 to 0.6.8 (#11528) web: bump the wdio group across 2 directories with 3 updates (#11529) web: bump @patternfly/elements from 4.0.1 to 4.0.2 in /web (#11530) web: bump @types/node from 22.7.2 to 22.7.3 in /web (#11531)
…able * web/update/small-upgrades: web: small fixes for elements and forms
web/package.json
Outdated
"@wdio/browser-runner": "^9.1.0", | ||
"@wdio/cli": "^9.1.0", | ||
"@wdio/browser-runner": "^8.40.2", | ||
"@wdio/cli": "^8.40.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependabot roll-backs. These destroyed the unit testing.
web/package.json
Outdated
@@ -86,8 +87,8 @@ | |||
"esbuild": "^0.24.0", | |||
"eslint": "^9.11.1", | |||
"eslint-plugin-lit": "^1.14.0", | |||
"eslint-plugin-sonarjs": "^2.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not ready for ESLint 9.
* main: (29 commits) web: small fixes for elements and forms (#11546) web: unify unit and end-to-end tests (#11598) web: audit and update package.json and associated test harness, with upgrade to WebdriverIO 9 (#11596) web: bump @spotlightjs/spotlight from 2.4.1 to 2.4.2 in /web in the sentry group across 1 directory (#11581) core: bump sentry-sdk from 2.14.0 to 2.15.0 (#11589) web: bump the rollup group across 2 directories with 4 updates (#11590) web: bump chromedriver from 129.0.1 to 129.0.2 in /tests/wdio (#11591) web: bump globals from 15.9.0 to 15.10.0 in /web (#11592) core, web: update translations (#11575) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#11578) core: bump goauthentik.io/api/v3 from 3.2024083.1 to 3.2024083.2 (#11580) web: bump the eslint group across 2 directories with 4 updates (#11582) web: bump API Client version (#11574) stages/identification: dynamically find login challenges (#11571) web: add missing id attribute for button in ak-flow-input-password (#11413) internal: restore /ping behaviour for embedded outpost (#11568) core: bump goauthentik.io/api/v3 from 3.2024082.1 to 3.2024083.1 (#11555) website: bump @types/react from 18.3.9 to 18.3.10 in /website (#11556) core: bump watchdog from 5.0.2 to 5.0.3 (#11557) core: bump uvicorn from 0.30.6 to 0.31.0 (#11558) ...
* main: (33 commits) web: provide simple tables for API-less displays (#11028) core: bump goauthentik/fips-python from 3.12.6-slim-bookworm-fips-full to 3.12.7-slim-bookworm-fips-full (#11607) core: bump twilio from 9.3.2 to 9.3.3 (#11608) core: bump msgraph-sdk from 1.8.0 to 1.9.0 (#11609) web: small fixes for elements and forms (#11546) web: unify unit and end-to-end tests (#11598) web: audit and update package.json and associated test harness, with upgrade to WebdriverIO 9 (#11596) web: bump @spotlightjs/spotlight from 2.4.1 to 2.4.2 in /web in the sentry group across 1 directory (#11581) core: bump sentry-sdk from 2.14.0 to 2.15.0 (#11589) web: bump the rollup group across 2 directories with 4 updates (#11590) web: bump chromedriver from 129.0.1 to 129.0.2 in /tests/wdio (#11591) web: bump globals from 15.9.0 to 15.10.0 in /web (#11592) core, web: update translations (#11575) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#11578) core: bump goauthentik.io/api/v3 from 3.2024083.1 to 3.2024083.2 (#11580) web: bump the eslint group across 2 directories with 4 updates (#11582) web: bump API Client version (#11574) stages/identification: dynamically find login challenges (#11571) web: add missing id attribute for button in ak-flow-input-password (#11413) internal: restore /ping behaviour for embedded outpost (#11568) ...
* main: (490 commits) website: latest migration to new structure (#11522) web: Fix css loading in unit tests, remove unneeded dot paths (#11629) website: bump docusaurus-theme-openapi-docs from 4.0.1 to 4.1.0 in /website (#11624) core, web: update translations (#11623) website: bump docusaurus-plugin-openapi-docs from 4.0.1 to 4.1.0 in /website (#11625) core: bump ruff from 0.6.8 to 0.6.9 (#11626) ci: require ci-web.build for merging (#11627) core: bump black from 24.8.0 to 24.10.0 (#11630) core: bump google-api-python-client from 2.147.0 to 2.148.0 (#11631) web: provide simple tables for API-less displays (#11028) core: bump goauthentik/fips-python from 3.12.6-slim-bookworm-fips-full to 3.12.7-slim-bookworm-fips-full (#11607) core: bump twilio from 9.3.2 to 9.3.3 (#11608) core: bump msgraph-sdk from 1.8.0 to 1.9.0 (#11609) web: small fixes for elements and forms (#11546) web: unify unit and end-to-end tests (#11598) web: audit and update package.json and associated test harness, with upgrade to WebdriverIO 9 (#11596) web: bump @spotlightjs/spotlight from 2.4.1 to 2.4.2 in /web in the sentry group across 1 directory (#11581) core: bump sentry-sdk from 2.14.0 to 2.15.0 (#11589) web: bump the rollup group across 2 directories with 4 updates (#11590) web: bump chromedriver from 129.0.1 to 129.0.2 in /tests/wdio (#11591) ...
* main: (481 commits) web: provide simple tables for API-less displays (#11028) core: bump goauthentik/fips-python from 3.12.6-slim-bookworm-fips-full to 3.12.7-slim-bookworm-fips-full (#11607) core: bump twilio from 9.3.2 to 9.3.3 (#11608) core: bump msgraph-sdk from 1.8.0 to 1.9.0 (#11609) web: small fixes for elements and forms (#11546) web: unify unit and end-to-end tests (#11598) web: audit and update package.json and associated test harness, with upgrade to WebdriverIO 9 (#11596) web: bump @spotlightjs/spotlight from 2.4.1 to 2.4.2 in /web in the sentry group across 1 directory (#11581) core: bump sentry-sdk from 2.14.0 to 2.15.0 (#11589) web: bump the rollup group across 2 directories with 4 updates (#11590) web: bump chromedriver from 129.0.1 to 129.0.2 in /tests/wdio (#11591) web: bump globals from 15.9.0 to 15.10.0 in /web (#11592) core, web: update translations (#11575) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#11578) core: bump goauthentik.io/api/v3 from 3.2024083.1 to 3.2024083.2 (#11580) web: bump the eslint group across 2 directories with 4 updates (#11582) web: bump API Client version (#11574) stages/identification: dynamically find login challenges (#11571) web: add missing id attribute for button in ak-flow-input-password (#11413) internal: restore /ping behaviour for embedded outpost (#11568) ...
web: API-free tables for authentik
What
Provides a pair of table types that mirror @BeryJu’s Table implementation but are completely independent of the API.
ak-simple-table
takes an array of tuples, one for each column, and a tuple for the column headers, and renders a table. It will display sort markers if sort keys are provided, but it does not do sorting itself; it relies on the client supplying the information to receive thetablesort
event and respond with the content sorted according to the client’s specification.ak-select-table
inherits from and extendsak-simple-table
in the most obvious way possible: it adds columns, tracks selections, emits achange
event, and provides avalue
field as well as thejson()
method used by the authentikForms
manager. Like its predecessor, it relies on clients to manage sorting.part::
definitions.ak-select-table
provides an excellent example of how one would write a client component.Why
These tables provide the ability to render complex, rich tables on the client side without the client being a mere thin front-end to the Django back-end. These tables are needed to support a one-to-many relationship with our transactional wizard model, since the information we need to display does not exist on the back-end before the transaction is complete.
npm run test
)make web
)