1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

chore: hide release plan template permissions behind feature flag (#8799)

This commit is contained in:
David Leek 2024-11-20 07:59:45 +01:00 committed by GitHub
parent b23dd940af
commit 74535e98a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ import {
} from 'utils/permissions'; } from 'utils/permissions';
import { RolePermissionCategory } from './RolePermissionCategory'; import { RolePermissionCategory } from './RolePermissionCategory';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { useUiFlag } from 'hooks/useUiFlag';
interface IPermissionCategoriesProps { interface IPermissionCategoriesProps {
type: PredefinedRoleType; type: PredefinedRoleType;
@ -40,6 +41,8 @@ export const RolePermissionCategories = ({
revalidateOnFocus: false, revalidateOnFocus: false,
}); });
const releasePlansEnabled = useUiFlag('releasePlans');
const isProjectRole = PROJECT_ROLE_TYPES.includes(type); const isProjectRole = PROJECT_ROLE_TYPES.includes(type);
const categories = useMemo( const categories = useMemo(
@ -76,14 +79,23 @@ export const RolePermissionCategories = ({
return useMemo( return useMemo(
() => ( () => (
<> <>
{categories.map(({ label, type, permissions }) => ( {categories
.filter(
({ label }) =>
releasePlansEnabled ||
label !== 'Release plan templates',
)
.map(({ label, type, permissions }) => (
<RolePermissionCategory <RolePermissionCategory
key={label} key={label}
title={`${label} permissions`} title={`${label} permissions`}
context={label.toLowerCase()} context={label.toLowerCase()}
Icon={ Icon={
type === PROJECT_PERMISSION_TYPE ? ( type === PROJECT_PERMISSION_TYPE ? (
<TopicIcon color='disabled' sx={{ mr: 1 }} /> <TopicIcon
color='disabled'
sx={{ mr: 1 }}
/>
) : type === ENVIRONMENT_PERMISSION_TYPE ? ( ) : type === ENVIRONMENT_PERMISSION_TYPE ? (
<CloudCircleIcon <CloudCircleIcon
color='disabled' color='disabled'