mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: add permission lock to quick strategy add (#1165)
This commit is contained in:
		
							parent
							
								
									c79465e7d9
								
							
						
					
					
						commit
						d7b168e4a8
					
				@ -103,6 +103,8 @@ export const FeatureStrategyEmpty = ({
 | 
				
			|||||||
                    title="Standard strategy"
 | 
					                    title="Standard strategy"
 | 
				
			||||||
                    Icon={getFeatureStrategyIcon('default')}
 | 
					                    Icon={getFeatureStrategyIcon('default')}
 | 
				
			||||||
                    onClick={onAddSimpleStrategy}
 | 
					                    onClick={onAddSimpleStrategy}
 | 
				
			||||||
 | 
					                    projectId={projectId}
 | 
				
			||||||
 | 
					                    environmentId={environmentId}
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
                    The standard strategy is strictly on/off for your entire
 | 
					                    The standard strategy is strictly on/off for your entire
 | 
				
			||||||
                    userbase.
 | 
					                    userbase.
 | 
				
			||||||
@ -111,6 +113,8 @@ export const FeatureStrategyEmpty = ({
 | 
				
			|||||||
                    title="Gradual rollout"
 | 
					                    title="Gradual rollout"
 | 
				
			||||||
                    Icon={getFeatureStrategyIcon('flexibleRollout')}
 | 
					                    Icon={getFeatureStrategyIcon('flexibleRollout')}
 | 
				
			||||||
                    onClick={onAddGradualRolloutStrategy}
 | 
					                    onClick={onAddGradualRolloutStrategy}
 | 
				
			||||||
 | 
					                    projectId={projectId}
 | 
				
			||||||
 | 
					                    environmentId={environmentId}
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
                    Roll out to a percentage of your userbase.
 | 
					                    Roll out to a percentage of your userbase.
 | 
				
			||||||
                </PresetCard>
 | 
					                </PresetCard>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,12 @@
 | 
				
			|||||||
import { ElementType, FC } from 'react';
 | 
					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 {
 | 
					interface IPresetCardProps {
 | 
				
			||||||
    title: string;
 | 
					    title: string;
 | 
				
			||||||
 | 
					    projectId: string;
 | 
				
			||||||
 | 
					    environmentId: string;
 | 
				
			||||||
    onClick: () => void;
 | 
					    onClick: () => void;
 | 
				
			||||||
    Icon: ElementType;
 | 
					    Icon: ElementType;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -17,6 +21,8 @@ export const PresetCard: FC<IPresetCardProps> = ({
 | 
				
			|||||||
    title,
 | 
					    title,
 | 
				
			||||||
    children,
 | 
					    children,
 | 
				
			||||||
    Icon,
 | 
					    Icon,
 | 
				
			||||||
 | 
					    projectId,
 | 
				
			||||||
 | 
					    environmentId,
 | 
				
			||||||
    onClick,
 | 
					    onClick,
 | 
				
			||||||
}) => (
 | 
					}) => (
 | 
				
			||||||
    <StyledCard variant="outlined">
 | 
					    <StyledCard variant="outlined">
 | 
				
			||||||
@ -34,14 +40,18 @@ export const PresetCard: FC<IPresetCardProps> = ({
 | 
				
			|||||||
                {children}
 | 
					                {children}
 | 
				
			||||||
            </Typography>
 | 
					            </Typography>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <Button
 | 
					            <Box sx={{ ml: 'auto', mt: 'auto', pt: 1 }}>
 | 
				
			||||||
                variant="outlined"
 | 
					                <PermissionButton
 | 
				
			||||||
                size="small"
 | 
					                    permission={CREATE_FEATURE_STRATEGY}
 | 
				
			||||||
                sx={{ ml: 'auto', mt: 'auto' }}
 | 
					                    projectId={projectId}
 | 
				
			||||||
                onClick={onClick}
 | 
					                    environmentId={environmentId}
 | 
				
			||||||
            >
 | 
					                    variant="outlined"
 | 
				
			||||||
                Use template
 | 
					                    size="small"
 | 
				
			||||||
            </Button>
 | 
					                    onClick={onClick}
 | 
				
			||||||
 | 
					                >
 | 
				
			||||||
 | 
					                    Use template
 | 
				
			||||||
 | 
					                </PermissionButton>
 | 
				
			||||||
 | 
					            </Box>
 | 
				
			||||||
        </CardContent>
 | 
					        </CardContent>
 | 
				
			||||||
    </StyledCard>
 | 
					    </StyledCard>
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user