address PR feedback from Mark
This commit is contained in:
parent
39cd530696
commit
aa1448ca56
3 changed files with 12 additions and 3 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
} from "@patternfly/react-core";
|
||||
import { SearchIcon } from "@patternfly/react-icons";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
||||
|
||||
type SearchUserProps = {
|
||||
onSearch: (search: string) => void;
|
||||
|
@ -20,6 +21,11 @@ type SearchUserProps = {
|
|||
export const SearchUser = ({ onSearch }: SearchUserProps) => {
|
||||
const { t } = useTranslation("users");
|
||||
const { register, handleSubmit } = useForm<{ search: string }>();
|
||||
const { url } = useRouteMatch();
|
||||
const history = useHistory();
|
||||
|
||||
const goToCreate = () => history.push(`${url}/add-user`);
|
||||
|
||||
return (
|
||||
<EmptyState>
|
||||
<Title headingLevel="h4" size="lg">
|
||||
|
@ -44,7 +50,7 @@ export const SearchUser = ({ onSearch }: SearchUserProps) => {
|
|||
</InputGroup>
|
||||
</Form>
|
||||
</EmptyStateBody>
|
||||
<Button variant="link" onClick={() => {}}>
|
||||
<Button variant="link" onClick={goToCreate}>
|
||||
{t("createNewUser")}
|
||||
</Button>
|
||||
</EmptyState>
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
} from "@patternfly/react-core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Controller, UseFormMethods } from "react-hook-form";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
||||
import { FormAccess } from "../components/form-access/FormAccess";
|
||||
import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
|
||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||
|
@ -27,6 +27,7 @@ export const UserForm = ({
|
|||
}: UserFormProps) => {
|
||||
const { t } = useTranslation("users");
|
||||
const { realm } = useRealm();
|
||||
const { url } = useRouteMatch();
|
||||
|
||||
const [
|
||||
isRequiredUserActionsDropdownOpen,
|
||||
|
@ -60,6 +61,8 @@ export const UserForm = ({
|
|||
setRequiredUserActionsDropdownOpen(false);
|
||||
};
|
||||
|
||||
const goToCreate = () => history.push(`${url}/add-user`);
|
||||
|
||||
return (
|
||||
<FormAccess
|
||||
isHorizontal
|
||||
|
|
|
@ -188,7 +188,7 @@ export const UsersSection = () => {
|
|||
message={t("noUsersFound")}
|
||||
instructions={t("emptyInstructions")}
|
||||
primaryActionText={t("createNewUser")}
|
||||
onPrimaryAction={() => {}}
|
||||
onPrimaryAction={goToCreate}
|
||||
/>
|
||||
}
|
||||
toolbarItem={
|
||||
|
|
Loading…
Reference in a new issue