From d45bb1d5ad8c91750638e5eab9c4663b9af9fd60 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Wed, 3 Mar 2021 08:53:42 -0500 Subject: [PATCH 1/9] user details WIP --- .../list-empty-state/ListEmptyState.tsx | 2 +- src/route-config.ts | 7 + src/user/UserForm.tsx | 90 +++++++++++++ src/user/UsersSection.tsx | 7 +- src/user/UsersTabs.tsx | 120 ++++++++++++++++++ src/user/messages.json | 1 + 6 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 src/user/UserForm.tsx create mode 100644 src/user/UsersTabs.tsx diff --git a/src/components/list-empty-state/ListEmptyState.tsx b/src/components/list-empty-state/ListEmptyState.tsx index 3a805477d6..cc095f1c05 100644 --- a/src/components/list-empty-state/ListEmptyState.tsx +++ b/src/components/list-empty-state/ListEmptyState.tsx @@ -19,7 +19,7 @@ export type Action = { export type ListEmptyStateProps = { message: string; - instructions: string; + instructions: React.ReactNode; primaryActionText?: string; onPrimaryAction?: MouseEventHandler; hasIcon?: boolean; diff --git a/src/route-config.ts b/src/route-config.ts index 9474c7cec2..bded96c138 100644 --- a/src/route-config.ts +++ b/src/route-config.ts @@ -21,6 +21,7 @@ import { UserFederationSection } from "./user-federation/UserFederationSection"; import { UsersSection } from "./user/UsersSection"; import { MappingDetails } from "./client-scopes/details/MappingDetails"; import { ClientDetails } from "./clients/ClientDetails"; +import { UsersTabs } from "./user/UsersTabs"; import { UserFederationKerberosSettings } from "./user-federation/UserFederationKerberosSettings"; import { UserFederationLdapSettings } from "./user-federation/UserFederationLdapSettings"; import { RoleMappingForm } from "./client-scopes/add/RoleMappingForm"; @@ -161,6 +162,12 @@ export const routes: RoutesFn = (t: TFunction) => [ breadcrumb: t("users:title"), access: "query-users", }, + { + path: "/:realm/users/add-user", + component: UsersTabs, + breadcrumb: t("users:createUser"), + access: "manage-users", + }, { path: "/:realm/sessions", component: SessionsSection, diff --git a/src/user/UserForm.tsx b/src/user/UserForm.tsx new file mode 100644 index 0000000000..349365197a --- /dev/null +++ b/src/user/UserForm.tsx @@ -0,0 +1,90 @@ +import React from "react"; +import { + ActionGroup, + Button, + FormGroup, + TextArea, + TextInput, +// ValidatedOptions, +} from "@patternfly/react-core"; +import { useTranslation } from "react-i18next"; +import { UseFormMethods } from "react-hook-form"; + +import { FormAccess } from "../components/form-access/FormAccess"; +import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +// import { RoleFormType } from "./RealmRoleTabs"; + +export type UserFormProps = { + form: UseFormMethods; + save: (user: UserRepresentation) => void; + editMode: boolean; + reset: () => void; +}; + +export const UserForm = ({ + form, + save, + editMode, + reset, +}: UserFormProps) => { + const { t } = useTranslation("users"); + return ( + + + + + +