preliminary work

This commit is contained in:
mfrances 2021-02-09 13:01:23 -05:00
parent 86cf4f8501
commit 6c63a8d4dc
3 changed files with 23 additions and 2 deletions

View file

@ -220,12 +220,24 @@ export const routes: RoutesFn = (t: TFunction) => [
breadcrumb: t("common:settings"), breadcrumb: t("common:settings"),
access: "view-realm", access: "view-realm",
}, },
{
path: "/:realm/user-federation/kerberos/new",
component: UserFederationKerberosSettings,
breadcrumb: t("common:settings"),
access: "view-realm",
},
{ {
path: "/:realm/user-federation/ldap/:id", path: "/:realm/user-federation/ldap/:id",
component: UserFederationLdapSettings, component: UserFederationLdapSettings,
breadcrumb: t("common:settings"), breadcrumb: t("common:settings"),
access: "view-realm", access: "view-realm",
}, },
{
path: "/:realm/user-federation/ldap/new",
component: UserFederationLdapSettings,
breadcrumb: t("common:settings"),
access: "view-realm",
},
{ {
path: "/:realm/", path: "/:realm/",
component: DashboardSection, component: DashboardSection,

View file

@ -92,6 +92,8 @@ export const UserFederationKerberosSettings = () => {
}, []); }, []);
const setupForm = (component: ComponentRepresentation) => { const setupForm = (component: ComponentRepresentation) => {
console.log("READING as:");
console.log(component);
Object.entries(component).map((entry) => { Object.entries(component).map((entry) => {
form.setValue( form.setValue(
"config.allowPasswordAuthentication", "config.allowPasswordAuthentication",
@ -105,6 +107,8 @@ export const UserFederationKerberosSettings = () => {
}; };
const save = async (component: ComponentRepresentation) => { const save = async (component: ComponentRepresentation) => {
console.log("SAVING as:");
console.log(component);
try { try {
await adminClient.components.update({ id }, component); await adminClient.components.update({ id }, component);
setupForm(component as ComponentRepresentation); setupForm(component as ComponentRepresentation);

View file

@ -26,6 +26,8 @@ import { useAdminClient, asyncStateFetch } from "../context/auth/AdminClient";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import "./user-federation.css"; import "./user-federation.css";
import { useHistory, useRouteMatch } from "react-router-dom";
export const UserFederationSection = () => { export const UserFederationSection = () => {
const [userFederations, setUserFederations] = useState< const [userFederations, setUserFederations] = useState<
ComponentRepresentation[] ComponentRepresentation[]
@ -37,6 +39,9 @@ export const UserFederationSection = () => {
const [key, setKey] = useState(0); const [key, setKey] = useState(0);
const refresh = () => setKey(new Date().getTime()); const refresh = () => setKey(new Date().getTime());
const { url } = useRouteMatch();
const history = useHistory();
useEffect(() => { useEffect(() => {
return asyncStateFetch( return asyncStateFetch(
() => { () => {
@ -53,8 +58,8 @@ export const UserFederationSection = () => {
}, [key]); }, [key]);
const ufAddProviderDropdownItems = [ const ufAddProviderDropdownItems = [
<DropdownItem key="itemLDAP">LDAP</DropdownItem>, <DropdownItem key="itemLDAP" onClick={() => history.push(`${url}/ldap/new`)}>LDAP</DropdownItem>,
<DropdownItem key="itemKerberos">Kerberos</DropdownItem>, <DropdownItem key="itemKerberos" onClick={() => history.push(`${url}/kerberos/new`)}>Kerberos</DropdownItem>,
]; ];
const learnMoreLinkProps = { const learnMoreLinkProps = {