Skip to content

web: clear out selecteds list after an API event to ensure a fresh copy of the policies-to-delete list#8125

Merged
kensternberg-authentik merged 4 commits intomainfrom
web/bug/persistent-stage-bindings
Jan 25, 2024
Merged

web: clear out selecteds list after an API event to ensure a fresh copy of the policies-to-delete list#8125
kensternberg-authentik merged 4 commits intomainfrom
web/bug/persistent-stage-bindings

Conversation

@kensternberg-authentik
Copy link
Copy Markdown
Contributor

@kensternberg-authentik kensternberg-authentik commented Jan 10, 2024

Details

When the user bulk-deletes policies bound to a flow, then chooses to delete more of them, the prior list of policies bound to the flow is persistent in the selected list; only the existing flows are shown and marked as selected, but the actual selected list contains all of the previously selected objects, even the now-stale ones.

If there's a nested API event, it indicates the policiesBindList has changed in some way and the current table data is not to be trusted. The API automatically refreshes Table.data and re-renders, but any clients of Table that use ak-bulk-delete will also need to clear out their selected list.

This commit creates a new property of Table, clearOnRefresh, which automatically empties the selectedElements list when an EVENT_REFRESH event completes. Set this flag on any table that uses the selectedElements list for bulk deletion; this ensures that stale data in the selectedElements list will not persist and interfere with future delete requests.

Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)
  • The translation files have been updated (make i18n-extract)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@netlify
Copy link
Copy Markdown

netlify bot commented Jan 10, 2024

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 6d0818c
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/65b2a0b589c4480008464016
😎 Deploy Preview https://deploy-preview-8125--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kensternberg-authentik kensternberg-authentik marked this pull request as ready for review January 10, 2024 19:30
@kensternberg-authentik kensternberg-authentik requested a review from a team as a code owner January 10, 2024 19:30
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (dcbfe73) 92.33% compared to head (6d0818c) 92.33%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8125      +/-   ##
==========================================
- Coverage   92.33%   92.33%   -0.01%     
==========================================
  Files         626      626              
  Lines       30922    30922              
==========================================
- Hits        28552    28551       -1     
- Misses       2370     2371       +1     
Flag Coverage Δ
e2e 50.66% <ø> (+<0.01%) ⬆️
integration 26.02% <ø> (ø)
unit 89.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kensternberg-authentik kensternberg-authentik marked this pull request as draft January 10, 2024 19:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 10, 2024

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-web-bug-persistent-stage-bindings-1706206671-6d0818c
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-web-bug-persistent-stage-bindings-1706206671-6d0818c-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 Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-web-bug-persistent-stage-bindings-1706206671-6d0818c

For arm64, use these values:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-web-bug-persistent-stage-bindings-1706206671-6d0818c-arm64

Afterwards, run the upgrade commands from the latest release notes.

This fix creates a new property of Table, 'clearOnRefresh', which
automatically empties the `selectedElements` list when an EVENT_REFRESH
event completes.  Set this flag on any table that uses the
`selectedElements` list for bulk deletion; this ensures that stale
data in the `selectedElements` list will not persist and interfere
with future deletion events.
@kensternberg-authentik kensternberg-authentik marked this pull request as ready for review January 10, 2024 20:06
@@ -119,6 +119,14 @@ export abstract class Table<T> extends AKElement implements TableLike {
@property({ type: Number })
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only substantive change. Everything else is just setting the flag for bulk-delete users.

* main: (131 commits)
  web: provide a context for checking the status of the enterprise license (#8153)
  core: compile backend translations (#8311)
  translate: Updates for file web/xliff/en.xlf in zh-Hans (#8304)
  translate: Updates for file web/xliff/en.xlf in zh_CN (#8305)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in zh_CN (#8300)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in zh-Hans (#8301)
  events: fix missing labels on prometheus metrics (#8309)
  core: bump goauthentik.io/api/v3 from 3.2023106.4 to 3.2023106.5 (#8302)
  web: bump the wdio group in /tests/wdio with 4 updates (#8303)
  web: restore test anchor tag (#8298)
  translate: Updates for file web/xliff/en.xlf in fr (#8296)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in fr (#8295)
  website: update wording (#8290)
  enterrpise: exclude inactive users from license (#8294)
  web: bump API Client version (#8292)
  core: compile backend translations (#8291)
  events: migrate SystemTasks to DB (#8159)
  web/admin: fix footer links not being parsed on settings page (#8289)
  root: fix system check warnings (#8277)
  web: bump API Client version (#8288)
  ...
@kensternberg-authentik kensternberg-authentik merged commit 645f662 into main Jan 25, 2024
@kensternberg-authentik kensternberg-authentik deleted the web/bug/persistent-stage-bindings branch January 25, 2024 18:19
kensternberg-authentik added a commit that referenced this pull request Jan 25, 2024
* main:
  web: clear out selecteds list after an API event to ensure a fresh copy of the policies-to-delete list (#8125)
  web: provide dual-list multiselect with pagination (#8004)
kensternberg-authentik added a commit that referenced this pull request Jan 25, 2024
* main: (30 commits)
  web: clear out selecteds list after an API event to ensure a fresh copy of the policies-to-delete list (#8125)
  web: provide dual-list multiselect with pagination (#8004)
  web: provide a context for checking the status of the enterprise license (#8153)
  core: compile backend translations (#8311)
  translate: Updates for file web/xliff/en.xlf in zh-Hans (#8304)
  translate: Updates for file web/xliff/en.xlf in zh_CN (#8305)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in zh_CN (#8300)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in zh-Hans (#8301)
  events: fix missing labels on prometheus metrics (#8309)
  core: bump goauthentik.io/api/v3 from 3.2023106.4 to 3.2023106.5 (#8302)
  web: bump the wdio group in /tests/wdio with 4 updates (#8303)
  web: restore test anchor tag (#8298)
  translate: Updates for file web/xliff/en.xlf in fr (#8296)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in fr (#8295)
  website: update wording (#8290)
  enterrpise: exclude inactive users from license (#8294)
  web: bump API Client version (#8292)
  core: compile backend translations (#8291)
  events: migrate SystemTasks to DB (#8159)
  web/admin: fix footer links not being parsed on settings page (#8289)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants