Disable client policies tab if feature is disabled. (#19558)
Closes #19460
This commit is contained in:
parent
51a1dd61d2
commit
2c663c2fcc
1 changed files with 53 additions and 42 deletions
|
@ -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,50 +353,58 @@ export const RealmSettingsTabs = ({
|
|||
>
|
||||
<RealmSettingsTokensTab save={save} realm={realm} />
|
||||
</Tab>
|
||||
<Tab
|
||||
title={
|
||||
<TabTitleText>{t("realm-settings:clientPolicies")}</TabTitleText>
|
||||
}
|
||||
data-testid="rs-clientPolicies-tab"
|
||||
{...clientPoliciesTab}
|
||||
>
|
||||
<RoutableTabs
|
||||
mountOnEnter
|
||||
defaultLocation={toClientPolicies({
|
||||
realm: realmName,
|
||||
tab: "profiles",
|
||||
})}
|
||||
{!clientPoliciesDisabled && (
|
||||
<Tab
|
||||
title={
|
||||
<TabTitleText>
|
||||
{t("realm-settings:clientPolicies")}
|
||||
</TabTitleText>
|
||||
}
|
||||
data-testid="rs-clientPolicies-tab"
|
||||
{...clientPoliciesTab}
|
||||
>
|
||||
<Tab
|
||||
id="profiles"
|
||||
data-testid="rs-policies-clientProfiles-tab"
|
||||
aria-label={t("clientProfilesSubTab")}
|
||||
title={<TabTitleText>{t("profiles")}</TabTitleText>}
|
||||
tooltip={
|
||||
<Tooltip
|
||||
content={t("realm-settings:clientPoliciesProfilesHelpText")}
|
||||
/>
|
||||
}
|
||||
{...clientPoliciesProfilesTab}
|
||||
<RoutableTabs
|
||||
mountOnEnter
|
||||
defaultLocation={toClientPolicies({
|
||||
realm: realmName,
|
||||
tab: "profiles",
|
||||
})}
|
||||
>
|
||||
<ProfilesTab />
|
||||
</Tab>
|
||||
<Tab
|
||||
id="policies"
|
||||
data-testid="rs-policies-clientPolicies-tab"
|
||||
aria-label={t("clientPoliciesSubTab")}
|
||||
{...clientPoliciesPoliciesTab}
|
||||
title={<TabTitleText>{t("policies")}</TabTitleText>}
|
||||
tooltip={
|
||||
<Tooltip
|
||||
content={t("realm-settings:clientPoliciesPoliciesHelpText")}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PoliciesTab />
|
||||
</Tab>
|
||||
</RoutableTabs>
|
||||
</Tab>
|
||||
<Tab
|
||||
id="profiles"
|
||||
data-testid="rs-policies-clientProfiles-tab"
|
||||
aria-label={t("clientProfilesSubTab")}
|
||||
title={<TabTitleText>{t("profiles")}</TabTitleText>}
|
||||
tooltip={
|
||||
<Tooltip
|
||||
content={t(
|
||||
"realm-settings:clientPoliciesProfilesHelpText"
|
||||
)}
|
||||
/>
|
||||
}
|
||||
{...clientPoliciesProfilesTab}
|
||||
>
|
||||
<ProfilesTab />
|
||||
</Tab>
|
||||
<Tab
|
||||
id="policies"
|
||||
data-testid="rs-policies-clientPolicies-tab"
|
||||
aria-label={t("clientPoliciesSubTab")}
|
||||
{...clientPoliciesPoliciesTab}
|
||||
title={<TabTitleText>{t("policies")}</TabTitleText>}
|
||||
tooltip={
|
||||
<Tooltip
|
||||
content={t(
|
||||
"realm-settings:clientPoliciesPoliciesHelpText"
|
||||
)}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PoliciesTab />
|
||||
</Tab>
|
||||
</RoutableTabs>
|
||||
</Tab>
|
||||
)}
|
||||
{isFeatureEnabled(Feature.DeclarativeUserProfile) &&
|
||||
realm.attributes?.userProfileEnabled === "true" && (
|
||||
<Tab
|
||||
|
|
Loading…
Reference in a new issue