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

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

* Prettier had opinions.

* web: A better fix

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.
This commit is contained in:
Ken Sternberg
2024-01-25 10:18:59 -08:00
committed by GitHub
parent 5f1ba45966
commit 645f662e3e
40 changed files with 52 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import { RbacApi, Role } from "@goauthentik/api";
@customElement("ak-role-list")
export class RoleListPage extends TablePage<Role> {
checkbox = true;
clearOnRefresh = true;
searchEnabled(): boolean {
return true;
}

View File

@ -21,6 +21,7 @@ export class RolePermissionGlobalTable extends Table<Permission> {
}
checkbox = true;
clearOnRefresh = true;
order = "content_type__app_label,content_type__model";

View File

@ -20,6 +20,7 @@ export class RolePermissionObjectTable extends Table<ExtraRoleObjectPermission>
}
checkbox = true;
clearOnRefresh = true;
apiEndpoint(page: number): Promise<PaginatedResponse<ExtraRoleObjectPermission>> {
return new RbacApi(DEFAULT_CONFIG).rbacPermissionsRolesList({