Add a 'Reset' button the the events search form (#2732)
This commit is contained in:
parent
b6d71a25cc
commit
d6edaa1ee1
3 changed files with 26 additions and 3 deletions
|
@ -31,5 +31,6 @@
|
||||||
"attribute": "Attribute",
|
"attribute": "Attribute",
|
||||||
"value": "Value",
|
"value": "Value",
|
||||||
"representation": "Representation",
|
"representation": "Representation",
|
||||||
"noUserDetails": "No user details"
|
"noUserDetails": "No user details",
|
||||||
|
"resetBtn": "Reset"
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,11 @@ export const AdminEvents = () => {
|
||||||
commitFilters();
|
commitFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetSearch() {
|
||||||
|
reset();
|
||||||
|
commitFilters();
|
||||||
|
}
|
||||||
|
|
||||||
function removeFilter(key: keyof AdminEventSearchForm) {
|
function removeFilter(key: keyof AdminEventSearchForm) {
|
||||||
const formValues: AdminEventSearchForm = { ...getValues() };
|
const formValues: AdminEventSearchForm = { ...getValues() };
|
||||||
delete formValues[key];
|
delete formValues[key];
|
||||||
|
@ -437,7 +442,6 @@ export const AdminEvents = () => {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<ActionGroup>
|
<ActionGroup>
|
||||||
<Button
|
<Button
|
||||||
className="keycloak__user_events_search__form_btn"
|
|
||||||
variant={"primary"}
|
variant={"primary"}
|
||||||
onClick={submitSearch}
|
onClick={submitSearch}
|
||||||
data-testid="search-events-btn"
|
data-testid="search-events-btn"
|
||||||
|
@ -445,6 +449,13 @@ export const AdminEvents = () => {
|
||||||
>
|
>
|
||||||
{t("searchAdminEventsBtn")}
|
{t("searchAdminEventsBtn")}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
onClick={resetSearch}
|
||||||
|
isDisabled={!isDirty}
|
||||||
|
>
|
||||||
|
{t("resetBtn")}
|
||||||
|
</Button>
|
||||||
</ActionGroup>
|
</ActionGroup>
|
||||||
</Form>
|
</Form>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
|
@ -138,6 +138,11 @@ export default function EventsSection() {
|
||||||
commitFilters();
|
commitFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetSearch() {
|
||||||
|
reset();
|
||||||
|
commitFilters();
|
||||||
|
}
|
||||||
|
|
||||||
function removeFilter(key: keyof UserEventSearchForm) {
|
function removeFilter(key: keyof UserEventSearchForm) {
|
||||||
const formValues: UserEventSearchForm = { ...getValues() };
|
const formValues: UserEventSearchForm = { ...getValues() };
|
||||||
delete formValues[key];
|
delete formValues[key];
|
||||||
|
@ -342,7 +347,6 @@ export default function EventsSection() {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<ActionGroup>
|
<ActionGroup>
|
||||||
<Button
|
<Button
|
||||||
className="keycloak__user_events_search__form_btn"
|
|
||||||
variant={"primary"}
|
variant={"primary"}
|
||||||
onClick={submitSearch}
|
onClick={submitSearch}
|
||||||
data-testid="search-events-btn"
|
data-testid="search-events-btn"
|
||||||
|
@ -350,6 +354,13 @@ export default function EventsSection() {
|
||||||
>
|
>
|
||||||
{t("searchUserEventsBtn")}
|
{t("searchUserEventsBtn")}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
onClick={resetSearch}
|
||||||
|
isDisabled={!isDirty}
|
||||||
|
>
|
||||||
|
{t("resetBtn")}
|
||||||
|
</Button>
|
||||||
</ActionGroup>
|
</ActionGroup>
|
||||||
</Form>
|
</Form>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
Loading…
Reference in a new issue