1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-12 01:17:04 +02:00

feat: strategy status as checkbox (#9760)

This commit is contained in:
Jaanus Sellin 2025-04-15 13:11:11 +03:00 committed by GitHub
parent a6c2cef71a
commit 01c1ec5c29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 25 deletions

View File

@ -2,7 +2,7 @@ import {
Box,
FormControlLabel,
styled,
Switch,
Checkbox,
Typography,
} from '@mui/material';
import type { VFC } from 'react';
@ -14,11 +14,15 @@ interface IFeatureStrategyEnabledDisabledProps {
const StyledBox = styled(Box)(({ theme }) => ({
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
backgroundColor: theme.palette.background.elevation1,
flexDirection: 'column',
padding: theme.spacing(2),
borderRadius: `${theme.shape.borderRadiusMedium}px`,
borderRadius: theme.shape.borderRadiusMedium,
}));
const StyledCheckboxRow = styled(Box)(({ theme }) => ({
display: 'flex',
alignItems: 'center',
marginTop: theme.spacing(1),
}));
export const FeatureStrategyEnabledDisabled: VFC<
@ -26,17 +30,24 @@ export const FeatureStrategyEnabledDisabled: VFC<
> = ({ enabled, onToggleEnabled }) => {
return (
<StyledBox>
<Typography>Strategy Status</Typography>
<FormControlLabel
control={
<Switch
name='enabled'
onChange={onToggleEnabled}
checked={enabled}
/>
}
label='Enabled'
/>
<Typography variant='body2' fontWeight='bold'>
Strategy Status
</Typography>
<StyledCheckboxRow>
<FormControlLabel
control={
<Checkbox
name='enabled'
onChange={onToggleEnabled}
checked={enabled}
/>
}
label={<Typography variant='body2'>Active</Typography>}
/>
<Typography variant='body2' color='text.secondary'>
Strategy will be exposed when environment is enabled
</Typography>
</StyledCheckboxRow>
</StyledBox>
);
};

View File

@ -466,6 +466,14 @@ export const FeatureStrategyForm = ({
}}
/>
<FeatureStrategyType
strategy={strategy}
strategyDefinition={strategyDefinition}
setStrategy={setStrategy}
validateParameter={validateParameter}
errors={errors}
hasAccess={access}
/>
<FeatureStrategyEnabledDisabled
enabled={!strategy?.disabled}
onToggleEnabled={() =>
@ -475,15 +483,6 @@ export const FeatureStrategyForm = ({
}))
}
/>
<FeatureStrategyType
strategy={strategy}
strategyDefinition={strategyDefinition}
setStrategy={setStrategy}
validateParameter={validateParameter}
errors={errors}
hasAccess={access}
/>
</>
}
/>