2022-02-07 11:49:47 +00:00
|
|
|
import { Tab, TabTitleText } from "@patternfly/react-core";
|
|
|
|
import React from "react";
|
2022-01-03 15:00:03 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2022-01-19 09:41:52 +00:00
|
|
|
import { useHistory } from "react-router-dom";
|
|
|
|
import {
|
|
|
|
routableTab,
|
|
|
|
RoutableTabs,
|
|
|
|
} from "../../components/routable-tabs/RoutableTabs";
|
2022-01-03 15:00:03 +00:00
|
|
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
2022-01-19 09:41:52 +00:00
|
|
|
import { toUserProfile } from "../routes/UserProfile";
|
2022-01-07 12:56:27 +00:00
|
|
|
import { AttributesGroupTab } from "./AttributesGroupTab";
|
2022-01-03 15:00:03 +00:00
|
|
|
import { JsonEditorTab } from "./JsonEditorTab";
|
2022-02-07 11:49:47 +00:00
|
|
|
import { UserProfileProvider } from "./UserProfileContext";
|
2022-01-07 12:56:27 +00:00
|
|
|
|
2022-01-03 15:00:03 +00:00
|
|
|
export const UserProfileTab = () => {
|
|
|
|
const { realm } = useRealm();
|
|
|
|
const { t } = useTranslation("realm-settings");
|
2022-01-19 09:41:52 +00:00
|
|
|
const history = useHistory();
|
2022-01-03 15:00:03 +00:00
|
|
|
|
|
|
|
return (
|
2022-02-07 11:49:47 +00:00
|
|
|
<UserProfileProvider>
|
|
|
|
<RoutableTabs
|
|
|
|
defaultLocation={toUserProfile({ realm, tab: "attributes" })}
|
|
|
|
mountOnEnter
|
2022-01-03 15:00:03 +00:00
|
|
|
>
|
2022-02-07 11:49:47 +00:00
|
|
|
<Tab
|
|
|
|
title={<TabTitleText>{t("attributes")}</TabTitleText>}
|
|
|
|
{...routableTab({
|
|
|
|
to: toUserProfile({ realm, tab: "attributes" }),
|
|
|
|
history,
|
|
|
|
})}
|
|
|
|
></Tab>
|
|
|
|
<Tab
|
|
|
|
title={<TabTitleText>{t("attributesGroup")}</TabTitleText>}
|
|
|
|
data-testid="attributesGroupTab"
|
|
|
|
{...routableTab({
|
|
|
|
to: toUserProfile({ realm, tab: "attributesGroup" }),
|
|
|
|
history,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<AttributesGroupTab />
|
|
|
|
</Tab>
|
|
|
|
<Tab
|
|
|
|
title={<TabTitleText>{t("jsonEditor")}</TabTitleText>}
|
|
|
|
{...routableTab({
|
|
|
|
to: toUserProfile({ realm, tab: "jsonEditor" }),
|
|
|
|
history,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<JsonEditorTab />
|
|
|
|
</Tab>
|
|
|
|
</RoutableTabs>
|
|
|
|
</UserProfileProvider>
|
2022-01-03 15:00:03 +00:00
|
|
|
);
|
|
|
|
};
|