Disable client policies tab if feature is disabled. (#19558)

Closes #19460
This commit is contained in:
Stan Silvert 2023-04-07 07:51:37 -04:00 committed by GitHub
parent 51a1dd61d2
commit 2c663c2fcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,6 +48,7 @@ import { RealmSettingsThemesTab } from "./ThemesTab";
import { RealmSettingsTokensTab } from "./TokensTab";
import { UserProfileTab } from "./user-profile/UserProfileTab";
import { UserRegistration } from "./UserRegistration";
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
type RealmSettingsHeaderProps = {
onChange: (value: boolean) => void;
@ -236,6 +237,8 @@ export const RealmSettingsTabs = ({
const sessionsTab = useTab("sessions");
const tokensTab = useTab("tokens");
const clientPoliciesTab = useTab("client-policies");
const clientPoliciesDisabled =
useServerInfo().profileInfo?.disabledFeatures?.includes("CLIENT_POLICIES");
const userProfileTab = useTab("user-profile");
const userRegistrationTab = useTab("user-registration");
@ -350,9 +353,12 @@ export const RealmSettingsTabs = ({
>
<RealmSettingsTokensTab save={save} realm={realm} />
</Tab>
{!clientPoliciesDisabled && (
<Tab
title={
<TabTitleText>{t("realm-settings:clientPolicies")}</TabTitleText>
<TabTitleText>
{t("realm-settings:clientPolicies")}
</TabTitleText>
}
data-testid="rs-clientPolicies-tab"
{...clientPoliciesTab}
@ -371,7 +377,9 @@ export const RealmSettingsTabs = ({
title={<TabTitleText>{t("profiles")}</TabTitleText>}
tooltip={
<Tooltip
content={t("realm-settings:clientPoliciesProfilesHelpText")}
content={t(
"realm-settings:clientPoliciesProfilesHelpText"
)}
/>
}
{...clientPoliciesProfilesTab}
@ -386,7 +394,9 @@ export const RealmSettingsTabs = ({
title={<TabTitleText>{t("policies")}</TabTitleText>}
tooltip={
<Tooltip
content={t("realm-settings:clientPoliciesPoliciesHelpText")}
content={t(
"realm-settings:clientPoliciesPoliciesHelpText"
)}
/>
}
>
@ -394,6 +404,7 @@ export const RealmSettingsTabs = ({
</Tab>
</RoutableTabs>
</Tab>
)}
{isFeatureEnabled(Feature.DeclarativeUserProfile) &&
realm.attributes?.userProfileEnabled === "true" && (
<Tab