1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: add permission lock to quick strategy add (#1165)

This commit is contained in:
Tymoteusz Czech 2022-07-28 15:02:41 +02:00 committed by GitHub
parent c79465e7d9
commit d7b168e4a8
2 changed files with 23 additions and 9 deletions

View File

@ -103,6 +103,8 @@ export const FeatureStrategyEmpty = ({
title="Standard strategy"
Icon={getFeatureStrategyIcon('default')}
onClick={onAddSimpleStrategy}
projectId={projectId}
environmentId={environmentId}
>
The standard strategy is strictly on/off for your entire
userbase.
@ -111,6 +113,8 @@ export const FeatureStrategyEmpty = ({
title="Gradual rollout"
Icon={getFeatureStrategyIcon('flexibleRollout')}
onClick={onAddGradualRolloutStrategy}
projectId={projectId}
environmentId={environmentId}
>
Roll out to a percentage of your userbase.
</PresetCard>

View File

@ -1,8 +1,12 @@
import { ElementType, FC } from 'react';
import { Button, Card, CardContent, styled, Typography } from '@mui/material';
import { Card, CardContent, Typography, styled, Box } from '@mui/material';
import PermissionButton from 'component/common/PermissionButton/PermissionButton';
import { CREATE_FEATURE_STRATEGY } from 'component/providers/AccessProvider/permissions';
interface IPresetCardProps {
title: string;
projectId: string;
environmentId: string;
onClick: () => void;
Icon: ElementType;
}
@ -17,6 +21,8 @@ export const PresetCard: FC<IPresetCardProps> = ({
title,
children,
Icon,
projectId,
environmentId,
onClick,
}) => (
<StyledCard variant="outlined">
@ -34,14 +40,18 @@ export const PresetCard: FC<IPresetCardProps> = ({
{children}
</Typography>
<Button
variant="outlined"
size="small"
sx={{ ml: 'auto', mt: 'auto' }}
onClick={onClick}
>
Use template
</Button>
<Box sx={{ ml: 'auto', mt: 'auto', pt: 1 }}>
<PermissionButton
permission={CREATE_FEATURE_STRATEGY}
projectId={projectId}
environmentId={environmentId}
variant="outlined"
size="small"
onClick={onClick}
>
Use template
</PermissionButton>
</Box>
</CardContent>
</StyledCard>
);