1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00

chore: adapt configuration modal to standard and advanced strategies (#10434)

https://linear.app/unleash/issue/2-3730/adapt-modal-to-new-standard-and-advanced-strategies-split

Adapts our "add configuration" modal to the new concept of standard and
advanced strategies.

Follow-up to: https://github.com/Unleash/unleash/pull/10433

<img width="984" height="482" alt="image"
src="https://github.com/user-attachments/assets/5af7a087-0bb6-46c3-93d0-f9968ea1928f"
/>
This commit is contained in:
Nuno Góis 2025-07-30 10:17:03 +01:00 committed by GitHub
parent 3bfed7fb0c
commit 32996460df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,12 +130,16 @@ export const FeatureStrategyMenuCards = ({
const { templates } = useReleasePlanTemplates(); const { templates } = useReleasePlanTemplates();
const navigate = useNavigate(); const navigate = useNavigate();
const preDefinedStrategies = strategies.filter( const activeStrategies = strategies.filter(
(strategy) => !strategy.deprecated && !strategy.editable, (strategy) => !strategy.deprecated,
); );
const customStrategies = strategies.filter( const standardStrategies = activeStrategies.filter(
(strategy) => !strategy.deprecated && strategy.editable, (strategy) => !strategy.advanced && !strategy.editable,
);
const advancedAndCustomStrategies = activeStrategies.filter(
(strategy) => strategy.editable || strategy.advanced,
); );
const defaultStrategy = { const defaultStrategy = {
@ -225,7 +229,7 @@ export const FeatureStrategyMenuCards = ({
Standard strategies Standard strategies
</Typography> </Typography>
<HelpIcon <HelpIcon
tooltip='Select a starting setup, then customize your strategy with targeting and variants' tooltip='Standard strategies let you enable a feature only for a specified audience. Select a starting setup, then customize your strategy with targeting and variants.'
size='16px' size='16px'
/> />
</SectionTitle> </SectionTitle>
@ -240,7 +244,7 @@ export const FeatureStrategyMenuCards = ({
onClose={onClose} onClose={onClose}
/> />
</CardWrapper> </CardWrapper>
{preDefinedStrategies.map((strategy) => ( {standardStrategies.map((strategy) => (
<CardWrapper key={strategy.name}> <CardWrapper key={strategy.name}>
<FeatureStrategyMenuCard <FeatureStrategyMenuCard
projectId={projectId} projectId={projectId}
@ -254,29 +258,33 @@ export const FeatureStrategyMenuCards = ({
</GridSection> </GridSection>
</Box> </Box>
{renderReleasePlanTemplates()} {renderReleasePlanTemplates()}
{customStrategies.length > 0 && ( {advancedAndCustomStrategies.length > 0 && (
<Box> <Box>
<SectionTitle> <SectionTitle>
<Typography color='inherit' variant='body2'> <Typography color='inherit' variant='body2'>
Custom strategies Custom and advanced strategies
</Typography> </Typography>
<HelpIcon <HelpIcon
tooltip='Custom strategies you have defined in Unleash' tooltip='Advanced strategies let you target based on specific properties. Custom activation strategies let you define your own activation strategies to use with Unleash.'
size='16px' size='16px'
/> />
</SectionTitle> </SectionTitle>
<GridSection> <GridSection>
{customStrategies.map((strategy) => ( {advancedAndCustomStrategies.map(
<CardWrapper key={strategy.name}> (strategy) => (
<FeatureStrategyMenuCard <CardWrapper key={strategy.name}>
projectId={projectId} <FeatureStrategyMenuCard
featureId={featureId} projectId={projectId}
environmentId={environmentId} featureId={featureId}
strategy={strategy} environmentId={
onClose={onClose} environmentId
/> }
</CardWrapper> strategy={strategy}
))} onClose={onClose}
/>
</CardWrapper>
),
)}
</GridSection> </GridSection>
</Box> </Box>
)} )}