web: elements: Table: Fix table selection clearing behavior (#13959)
web: elements: Table: Fix table selection clearing and modal closing behavior Closes https://github.com/goauthentik/authentik/issues/13831
This commit is contained in:
@ -167,13 +167,13 @@ export class DeleteBulkForm<T> extends ModalButton {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
this.onSuccess();
|
this.onSuccess();
|
||||||
this.open = false;
|
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new CustomEvent(EVENT_REFRESH, {
|
new CustomEvent(EVENT_REFRESH, {
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
composed: true,
|
composed: true,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
this.open = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.onError(e as Error);
|
this.onError(e as Error);
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@ -207,9 +207,6 @@ export abstract class Table<T> extends AKElement implements TableLike {
|
|||||||
super();
|
super();
|
||||||
this.addEventListener(EVENT_REFRESH, async () => {
|
this.addEventListener(EVENT_REFRESH, async () => {
|
||||||
await this.fetch();
|
await this.fetch();
|
||||||
if (this.clearOnRefresh) {
|
|
||||||
this.selectedElements = [];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (this.searchEnabled()) {
|
if (this.searchEnabled()) {
|
||||||
this.search = getURLParam("search", "");
|
this.search = getURLParam("search", "");
|
||||||
@ -272,6 +269,11 @@ export abstract class Table<T> extends AKElement implements TableLike {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.expandedElements = newExpanded;
|
this.expandedElements = newExpanded;
|
||||||
|
|
||||||
|
// Clear selections after fetch if clearOnRefresh is true
|
||||||
|
if (this.clearOnRefresh) {
|
||||||
|
this.selectedElements = [];
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(async (error: unknown) => {
|
.catch(async (error: unknown) => {
|
||||||
this.error = await parseAPIResponseError(error);
|
this.error = await parseAPIResponseError(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user