web/admin: add button to empty state to clear search (#2911)

This commit is contained in:
Jens L 2022-05-20 18:01:26 +02:00 committed by GitHub
parent 334898ae23
commit ec15060c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 64 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import PFPage from "@patternfly/patternfly/components/Page/page.css";
import PFSidebar from "@patternfly/patternfly/components/Sidebar/sidebar.css";
import "../../elements/PageHeader";
import { updateURLParams } from "../router/RouteMatch";
import { Table } from "./Table";
export abstract class TablePage<T> extends Table<T> {
@ -33,11 +34,33 @@ export abstract class TablePage<T> extends Table<T> {
${inner
? inner
: html`<ak-empty-state icon=${this.pageIcon()} header="${t`No objects found.`}">
<div slot="body">${this.renderObjectCreate()}</div>
<div slot="body">
${this.searchEnabled() ? this.renderEmptyClearSearch() : html``}
</div>
<div slot="primary">${this.renderObjectCreate()}</div>
</ak-empty-state>`}
`);
}
renderEmptyClearSearch(): TemplateResult {
if (this.search === "") {
return html``;
}
return html`<button
@click=${() => {
this.search = "";
this.requestUpdate();
this.fetch();
updateURLParams({
search: "",
});
}}
class="pf-c-button pf-m-link"
>
${t`Clear search`}
</button>`;
}
renderObjectCreate(): TemplateResult {
return html``;
}

View File

@ -944,6 +944,10 @@ msgstr "Cache löschen"
msgid "Clear icon"
msgstr "Symbol zurücksetzen"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "Klicken Sie, um den Wert zu ändern"

View File

@ -946,6 +946,10 @@ msgstr "Clear cache"
msgid "Clear icon"
msgstr "Clear icon"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr "Clear search"
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "Click to change value"

View File

@ -934,6 +934,10 @@ msgstr "Limpiar caché"
msgid "Clear icon"
msgstr "Ícono Borrar"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "Haga clic para cambiar el valor"

View File

@ -942,6 +942,10 @@ msgstr "Vider le cach"
msgid "Clear icon"
msgstr "Supprimer l'icôn"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "Cliquer pour changer la valeur"

View File

@ -931,6 +931,10 @@ msgstr "Wyczyść pamięć podręczną"
msgid "Clear icon"
msgstr "Wyczyść ikonę"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "Kliknij, aby zmienić wartość"

View File

@ -934,6 +934,10 @@ msgstr ""
msgid "Clear icon"
msgstr ""
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr ""

View File

@ -934,6 +934,10 @@ msgstr "Önbelleği temizle"
msgid "Clear icon"
msgstr "Simgeyi temizle"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "Değeri değiştirmek için tıklayın"

View File

@ -930,6 +930,10 @@ msgstr "清除缓存"
msgid "Clear icon"
msgstr "清除图标"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "点击以更改值"

View File

@ -932,6 +932,10 @@ msgstr "清除缓存"
msgid "Clear icon"
msgstr "清除图标"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "单击以更改值"

View File

@ -932,6 +932,10 @@ msgstr "清除缓存"
msgid "Clear icon"
msgstr "清除图标"
#: src/elements/table/TablePage.ts
msgid "Clear search"
msgstr ""
#: src/elements/forms/HorizontalFormElement.ts
msgid "Click to change value"
msgstr "单击以更改值"