From b0f09eb2c4184819d7a7848b1a1b6d457161a938 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 7 Aug 2021 20:06:17 +0200 Subject: [PATCH] web/admin: fix Table not updating selectedElements correctly after update Signed-off-by: Jens Langhammer --- .../providers/oauth2/views/introspection.py | 2 +- web/src/elements/table/Table.ts | 35 +++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/authentik/providers/oauth2/views/introspection.py b/authentik/providers/oauth2/views/introspection.py index 626449aaa..bdf0ae7a5 100644 --- a/authentik/providers/oauth2/views/introspection.py +++ b/authentik/providers/oauth2/views/introspection.py @@ -85,7 +85,7 @@ class TokenIntrospectionParams: params = TokenIntrospectionParams(token=token) if not any([params.authenticate_basic(request), params.authenticate_bearer(request)]): - LOGGER.debug("Not authenticated") + LOGGER.warning("Not authenticated") raise TokenIntrospectionError() return params diff --git a/web/src/elements/table/Table.ts b/web/src/elements/table/Table.ts index ed5e10076..cf331c4f9 100644 --- a/web/src/elements/table/Table.ts +++ b/web/src/elements/table/Table.ts @@ -127,7 +127,7 @@ export abstract class Table extends LitElement { expandable = false; @property({ attribute: false }) - expandedRows: boolean[] = []; + expandedElements: T[] = []; static get styles(): CSSResult[] { return [ @@ -158,7 +158,16 @@ export abstract class Table extends LitElement { .then((r) => { this.data = r; this.page = r.pagination.current; - this.expandedRows = []; + r.results.forEach((res) => { + const selectedIndex = this.selectedElements.indexOf(res); + if (selectedIndex <= -1) { + this.selectedElements.splice(selectedIndex, 1); + } + const expandedIndex = this.expandedElements.indexOf(res); + if (expandedIndex <= -1) { + this.expandedElements.splice(expandedIndex, 1); + } + }); this.isLoading = false; }) .catch(() => { @@ -200,12 +209,9 @@ export abstract class Table extends LitElement { return [this.renderEmpty()]; } return this.data.results.map((item: T, idx: number) => { - if (this.expandedRows.length - 1 < idx) { - this.expandedRows[idx] = false; - } return html` ${this.checkbox @@ -231,11 +237,20 @@ export abstract class Table extends LitElement { ${this.expandable ? html`