diff --git a/src/realm-roles/RealmRoleDetails.tsx b/src/realm-roles/RealmRoleDetails.tsx deleted file mode 100644 index 58a5cdb9b1..0000000000 --- a/src/realm-roles/RealmRoleDetails.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { useHistory, useParams } from "react-router-dom"; -import { - ActionGroup, - AlertVariant, - Button, - FormGroup, - PageSection, - Tab, - Tabs, - TabTitleText, - TextArea, - TextInput, - ValidatedOptions, -} from "@patternfly/react-core"; -import { useTranslation } from "react-i18next"; -import { Controller, useForm } from "react-hook-form"; -import { FormAccess } from "../components/form-access/FormAccess"; - -import { useAlerts } from "../components/alert/Alerts"; -import { ViewHeader } from "../components/view-header/ViewHeader"; - -import { useAdminClient } from "../context/auth/AdminClient"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; -import { RoleAttributes } from "./RoleAttributes"; - -export const RolesForm = () => { - const { t } = useTranslation("roles"); - const { register, handleSubmit, errors, control, setValue } = useForm< - RoleRepresentation - >(); - const history = useHistory(); - const [name, setName] = useState(""); - const [activeTab, setActiveTab] = useState(0); - - const adminClient = useAdminClient(); - const form = useForm(); - - - const { id } = useParams<{ id: string }>(); - - const { addAlert } = useAlerts(); - - useEffect(() => { - (async () => { - const fetchedRole = await adminClient.roles.findOneById({ id }); - setName(fetchedRole.name!); - setupForm(fetchedRole); - })(); - }, []); - - const setupForm = (role: RoleRepresentation) => { - Object.entries(role).map((entry) => { - setValue(entry[0], entry[1]); - }); - }; - - const save = async (role: RoleRepresentation) => { - try { - await adminClient.roles.updateById({ id }, role); - setupForm(role as RoleRepresentation); - addAlert(t("roleSaveSuccess"), AlertVariant.success); - } catch (error) { - addAlert(`${t("roleSaveError")} '${error}'`, AlertVariant.danger); - } - }; - - return ( - <> - - - - setActiveTab(key as number)} - isBox - > - {t("details")}}> - - - {name ? ( - - ) : undefined} - - - ( -