From d7b168e4a8296521a8cde15b6b2dfedb92cf990f Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Thu, 28 Jul 2022 15:02:41 +0200 Subject: [PATCH] fix: add permission lock to quick strategy add (#1165) --- .../FeatureStrategyEmpty.tsx | 4 +++ .../PresetCard/PresetCard.tsx | 28 +++++++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx index 01d24e8cd1..2bd7481087 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx @@ -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. diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/PresetCard/PresetCard.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/PresetCard/PresetCard.tsx index 345550d059..a6603fe019 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/PresetCard/PresetCard.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/PresetCard/PresetCard.tsx @@ -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 = ({ title, children, Icon, + projectId, + environmentId, onClick, }) => ( @@ -34,14 +40,18 @@ export const PresetCard: FC = ({ {children} - + + + Use template + + );