mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-02 01:17:58 +02:00
feat: strategy status as checkbox (#9760)
This commit is contained in:
parent
a6c2cef71a
commit
01c1ec5c29
@ -2,7 +2,7 @@ import {
|
|||||||
Box,
|
Box,
|
||||||
FormControlLabel,
|
FormControlLabel,
|
||||||
styled,
|
styled,
|
||||||
Switch,
|
Checkbox,
|
||||||
Typography,
|
Typography,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import type { VFC } from 'react';
|
import type { VFC } from 'react';
|
||||||
@ -14,11 +14,15 @@ interface IFeatureStrategyEnabledDisabledProps {
|
|||||||
|
|
||||||
const StyledBox = styled(Box)(({ theme }) => ({
|
const StyledBox = styled(Box)(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
flexDirection: 'column',
|
||||||
justifyContent: 'space-between',
|
|
||||||
backgroundColor: theme.palette.background.elevation1,
|
|
||||||
padding: theme.spacing(2),
|
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<
|
export const FeatureStrategyEnabledDisabled: VFC<
|
||||||
@ -26,17 +30,24 @@ export const FeatureStrategyEnabledDisabled: VFC<
|
|||||||
> = ({ enabled, onToggleEnabled }) => {
|
> = ({ enabled, onToggleEnabled }) => {
|
||||||
return (
|
return (
|
||||||
<StyledBox>
|
<StyledBox>
|
||||||
<Typography>Strategy Status</Typography>
|
<Typography variant='body2' fontWeight='bold'>
|
||||||
<FormControlLabel
|
Strategy Status
|
||||||
control={
|
</Typography>
|
||||||
<Switch
|
<StyledCheckboxRow>
|
||||||
name='enabled'
|
<FormControlLabel
|
||||||
onChange={onToggleEnabled}
|
control={
|
||||||
checked={enabled}
|
<Checkbox
|
||||||
/>
|
name='enabled'
|
||||||
}
|
onChange={onToggleEnabled}
|
||||||
label='Enabled'
|
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>
|
</StyledBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -466,6 +466,14 @@ export const FeatureStrategyForm = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<FeatureStrategyType
|
||||||
|
strategy={strategy}
|
||||||
|
strategyDefinition={strategyDefinition}
|
||||||
|
setStrategy={setStrategy}
|
||||||
|
validateParameter={validateParameter}
|
||||||
|
errors={errors}
|
||||||
|
hasAccess={access}
|
||||||
|
/>
|
||||||
<FeatureStrategyEnabledDisabled
|
<FeatureStrategyEnabledDisabled
|
||||||
enabled={!strategy?.disabled}
|
enabled={!strategy?.disabled}
|
||||||
onToggleEnabled={() =>
|
onToggleEnabled={() =>
|
||||||
@ -475,15 +483,6 @@ export const FeatureStrategyForm = ({
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FeatureStrategyType
|
|
||||||
strategy={strategy}
|
|
||||||
strategyDefinition={strategyDefinition}
|
|
||||||
setStrategy={setStrategy}
|
|
||||||
validateParameter={validateParameter}
|
|
||||||
errors={errors}
|
|
||||||
hasAccess={access}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user