From 79e671062c76766b94ba51bcda11a5ab682e7959 Mon Sep 17 00:00:00 2001 From: Eugenia <32821331+jenny-s51@users.noreply.github.com> Date: Tue, 15 Dec 2020 02:21:17 -0500 Subject: [PATCH] Realm role attributes (#247) * add role attributes, WIP * WIP role attributes * fix storybook demos * add attributes tab to realm roles section * use TableComposable * fix formatting * css updates * fix up styling of role attributes table * fix check-types erros * fix build * fix formatting * address PR feedback from Sarah * add aria label to button * fix storybook demos and address PR feedback from Erik * fix merge conflict * delete unnecessary files * remove unused code * remove BorderColor * delete final comment * fix formatting Co-authored-by: Sarah Rambacher --- src/realm-roles/RealmRoleForm.tsx | 29 +++-- src/realm-roles/RealmRoleTabs.tsx | 142 +++++++++++++++++++++++++ src/realm-roles/RealmRolesSection.css | 17 +++ src/realm-roles/RoleAttributes.tsx | 96 +++++++++++++++++ src/realm-roles/messages.json | 2 + src/stories/RoleAttributes.stories.tsx | 23 ++++ src/stories/RoleDetails.stories.tsx | 21 +--- 7 files changed, 300 insertions(+), 30 deletions(-) create mode 100644 src/realm-roles/RealmRoleTabs.tsx create mode 100644 src/realm-roles/RealmRolesSection.css create mode 100644 src/realm-roles/RoleAttributes.tsx create mode 100644 src/stories/RoleAttributes.stories.tsx diff --git a/src/realm-roles/RealmRoleForm.tsx b/src/realm-roles/RealmRoleForm.tsx index 8a7e47f118..d5028524d2 100644 --- a/src/realm-roles/RealmRoleForm.tsx +++ b/src/realm-roles/RealmRoleForm.tsx @@ -26,20 +26,21 @@ import { ViewHeader } from "../components/view-header/ViewHeader"; import { useAdminClient } from "../context/auth/AdminClient"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; +import { RoleAttributes } from "./RoleAttributes"; type RoleFormType = { - form: UseFormMethods; - save: SubmitHandler; - editMode: boolean; + form?: UseFormMethods; + save?: SubmitHandler; + editMode?: boolean; }; -const RoleForm = ({ form, save, editMode }: RoleFormType) => { +export const RoleForm = ({ form, save, editMode }: RoleFormType) => { const { t } = useTranslation("roles"); const history = useHistory(); return ( @@ -47,11 +48,11 @@ const RoleForm = ({ form, save, editMode }: RoleFormType) => { label={t("roleName")} fieldId="kc-name" isRequired - validated={form.errors.name ? "error" : "default"} + validated={form!.errors.name ? "error" : "default"} helperTextInvalid={t("common:required")} > { label={t("description")} fieldId="kc-description" validated={ - form.errors.description + form!.errors.description ? ValidatedOptions.error : ValidatedOptions.default } - helperTextInvalid={form.errors.description?.message} + helperTextInvalid={form!.errors.description?.message} >