2022-02-07 11:49:47 +00:00
|
|
|
import { Tab, TabTitleText } from "@patternfly/react-core";
|
2022-08-03 12:12:07 +00:00
|
|
|
|
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-02-16 11:39:08 +00:00
|
|
|
import { AttributesTab } from "./AttributesTab";
|
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>}
|
2022-02-16 11:39:08 +00:00
|
|
|
data-testid="attributesTab"
|
2022-02-07 11:49:47 +00:00
|
|
|
{...routableTab({
|
|
|
|
to: toUserProfile({ realm, tab: "attributes" }),
|
|
|
|
history,
|
|
|
|
})}
|
2022-02-16 11:39:08 +00:00
|
|
|
>
|
|
|
|
<AttributesTab />
|
|
|
|
</Tab>
|
2022-02-07 11:49:47 +00:00
|
|
|
<Tab
|
|
|
|
title={<TabTitleText>{t("attributesGroup")}</TabTitleText>}
|
|
|
|
data-testid="attributesGroupTab"
|
|
|
|
{...routableTab({
|
2022-06-22 11:35:10 +00:00
|
|
|
to: toUserProfile({ realm, tab: "attributes-group" }),
|
2022-02-07 11:49:47 +00:00
|
|
|
history,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<AttributesGroupTab />
|
|
|
|
</Tab>
|
|
|
|
<Tab
|
|
|
|
title={<TabTitleText>{t("jsonEditor")}</TabTitleText>}
|
2022-02-16 11:39:08 +00:00
|
|
|
data-testid="jsonEditorTab"
|
2022-02-07 11:49:47 +00:00
|
|
|
{...routableTab({
|
2022-06-22 11:35:10 +00:00
|
|
|
to: toUserProfile({ realm, tab: "json-editor" }),
|
2022-02-07 11:49:47 +00:00
|
|
|
history,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<JsonEditorTab />
|
|
|
|
</Tab>
|
|
|
|
</RoutableTabs>
|
|
|
|
</UserProfileProvider>
|
2022-01-03 15:00:03 +00:00
|
|
|
);
|
|
|
|
};
|