web/elements: fix table search not resetting page when query changes (#15324)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L.
2025-07-01 00:55:09 +02:00
committed by GitHub
parent c7fe987c5a
commit 6982e7d1c9
2 changed files with 6 additions and 2 deletions

View File

@ -478,8 +478,10 @@ export abstract class Table<T> extends WithLicenseSummary(AKElement) implements
renderSearch(): TemplateResult {
const runSearch = (value: string) => {
this.search = value;
this.page = 1;
updateURLParams({
search: value,
tablePage: 1,
});
this.fetch();
};

View File

@ -3,7 +3,7 @@ import { updateURLParams } from "#elements/router/RouteMatch";
import { Table } from "#elements/table/Table";
import { msg } from "@lit/localize";
import { CSSResult } from "lit";
import { CSSResult, nothing } from "lit";
import { TemplateResult, html } from "lit";
import { ifDefined } from "lit/directives/if-defined.js";
@ -45,7 +45,7 @@ export abstract class TablePage<T> extends Table<T> {
: html`<ak-empty-state icon=${this.pageIcon()}
><span>${msg("No objects found.")}</span>
<div slot="body">
${this.searchEnabled() ? this.renderEmptyClearSearch() : html``}
${this.searchEnabled() ? this.renderEmptyClearSearch() : nothing}
</div>
<div slot="primary">${this.renderObjectCreate()}</div>
</ak-empty-state>`}
@ -61,8 +61,10 @@ export abstract class TablePage<T> extends Table<T> {
this.search = "";
this.requestUpdate();
this.fetch();
this.page = 1;
updateURLParams({
search: "",
tablePage: 1,
});
}}
class="pf-c-button pf-m-link"