Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: conditionally show groupId in StrategyExecution under rollout #9101

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: conditionally show groupId in StrategyExecution under rollout
daveleek committed Jan 15, 2025
commit cfae2da1c774a88736fc4781daf230d24d6ab44a
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import { BuiltInStrategies } from 'utils/strategyNames';

interface IStrategyExecutionProps {
strategy: IFeatureStrategyPayload | CreateFeatureStrategySchema;
displayGroupId?: boolean;
}

const StyledContainer = styled(Box, {
@@ -77,6 +78,7 @@ const StyledValueSeparator = styled('span')(({ theme }) => ({

export const StrategyExecution: FC<IStrategyExecutionProps> = ({
strategy,
displayGroupId = false,
}) => {
const { parameters, constraints = [] } = strategy;
const stickiness = parameters?.stickiness;
@@ -103,6 +105,60 @@ export const StrategyExecution: FC<IStrategyExecutionProps> = ({

const badgeType = strategy.disabled ? 'neutral' : 'success';

if (displayGroupId && parameters.groupId) {
return (
<StyledValueContainer
sx={{
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
}}
>
<Box sx={{ mr: 2 }}>
<PercentageCircle
percentage={percentage}
size='2rem'
disabled={strategy.disabled}
/>
</Box>
<div>
<Badge color={badgeType}>
{percentage}%
</Badge>{' '}
<span>of your base</span>{' '}
<span>
{explainStickiness ? (
<>
with{' '}
<strong>{stickiness}</strong>
</>
) : (
''
)}{' '}
</span>
<span>
{constraints.length > 0
? 'who match constraints'
: ''}{' '}
is included.
</span>
</div>
<Box
sx={(theme) => ({
width: '100%',
mt: 1,
ml: 6,
color: theme.palette.info.contrastText,
})}
>
<Badge color='info'>
GroupId: {parameters.groupId}
</Badge>
</Box>
</StyledValueContainer>
);
}

return (
<StyledValueContainer
sx={{ display: 'flex', alignItems: 'center' }}
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ export const ReleasePlanMilestoneStrategy = ({
<Icon />
{`${formatStrategyName(String(strategy.strategyName))}${strategy.title ? `: ${strategy.title}` : ''}`}
</StyledHeader>
<StrategyExecution strategy={strategy} />
<StrategyExecution strategy={strategy} displayGroupId={true} />
daveleek marked this conversation as resolved.
Show resolved Hide resolved
{strategy.variants &&
strategy.variants.length > 0 &&
(strategy.disabled ? (