Added a way to clear filters for non custom search (#2194)
This commit is contained in:
parent
5dc2450b01
commit
663e96d000
2 changed files with 13 additions and 0 deletions
|
@ -20,6 +20,7 @@ export default {
|
||||||
value: "Value",
|
value: "Value",
|
||||||
noSearchResults: "No search results",
|
noSearchResults: "No search results",
|
||||||
noSearchResultsInstructions: "Click on the search bar above to search",
|
noSearchResultsInstructions: "Click on the search bar above to search",
|
||||||
|
clearAllFilters: "Clear all filters",
|
||||||
next: "Next",
|
next: "Next",
|
||||||
back: "Back",
|
back: "Back",
|
||||||
finish: "Finish",
|
finish: "Finish",
|
||||||
|
|
|
@ -25,6 +25,7 @@ import { ListEmptyState } from "../list-empty-state/ListEmptyState";
|
||||||
import { KeycloakSpinner } from "../keycloak-spinner/KeycloakSpinner";
|
import { KeycloakSpinner } from "../keycloak-spinner/KeycloakSpinner";
|
||||||
import { useFetch } from "../../context/auth/AdminClient";
|
import { useFetch } from "../../context/auth/AdminClient";
|
||||||
import type { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
|
import type { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
|
||||||
|
import { ButtonVariant } from "@patternfly/react-core";
|
||||||
|
|
||||||
type TitleCell = { title: JSX.Element };
|
type TitleCell = { title: JSX.Element };
|
||||||
type Cell<T> = keyof T | JSX.Element | TitleCell;
|
type Cell<T> = keyof T | JSX.Element | TitleCell;
|
||||||
|
@ -412,6 +413,17 @@ export function KeycloakDataTable<T>({
|
||||||
isSearchVariant={true}
|
isSearchVariant={true}
|
||||||
message={t("noSearchResults")}
|
message={t("noSearchResults")}
|
||||||
instructions={t("noSearchResultsInstructions")}
|
instructions={t("noSearchResultsInstructions")}
|
||||||
|
secondaryActions={
|
||||||
|
!isSearching
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
text: t("clearAllFilters"),
|
||||||
|
onClick: () => setSearch(""),
|
||||||
|
type: ButtonVariant.link,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{loading && <Loading />}
|
{loading && <Loading />}
|
||||||
|
|
Loading…
Reference in a new issue