1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-13 13:48:59 +02:00

feat: add "cleanup" action to other flag lifecycle stages (#10471)

This commit is contained in:
Tymoteusz Czech 2025-08-07 11:54:33 +02:00 committed by GitHub
parent ac67a50693
commit 98bbf85421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 5 deletions

View File

@ -59,7 +59,7 @@ test('render remove flag from code reminder', async () => {
}); });
await screen.findByText('Time to remove flag from code?'); await screen.findByText('Time to remove flag from code?');
await screen.findByText('Revert to production'); await screen.findByText('Revert to previous stage');
const reminder = await screen.findByText('Remind me later'); const reminder = await screen.findByText('Remind me later');
reminder.click(); reminder.click();

View File

@ -213,7 +213,7 @@ export const CleanupReminder: FC<{
disabled={loading} disabled={loading}
projectId={feature.project} projectId={feature.project}
> >
Revert to production Revert to previous stage
</PermissionButton> </PermissionButton>
</ActionsBox> </ActionsBox>
} }

View File

@ -164,6 +164,33 @@ const LiveStageAction: FC<{
); );
}; };
const ReadyForCleanupAction: FC<{
onComplete: () => void;
loading: boolean;
project: string;
}> = ({ onComplete, loading, project }) => {
return (
<StyledStageAction>
<StyledStageActionTitle>Ready for cleanup?</StyledStageActionTitle>
<InfoText sx={{ mb: 1 }}>
If this flag is no longer needed and ready to be removed from
the code, you can mark it as ready for cleanup. This helps
reduce technical debt.
</InfoText>
<PermissionButton
variant='outlined'
permission={UPDATE_FEATURE}
size='small'
onClick={onComplete}
disabled={loading}
projectId={project}
>
Mark ready for cleanup
</PermissionButton>
</StyledStageAction>
);
};
const SafeToArchive: FC<{ const SafeToArchive: FC<{
onArchive: () => void; onArchive: () => void;
onUncomplete: () => void; onUncomplete: () => void;
@ -194,7 +221,7 @@ const SafeToArchive: FC<{
disabled={loading} disabled={loading}
projectId={project} projectId={project}
> >
Revert to production Revert to previous stage
</PermissionButton> </PermissionButton>
<PermissionButton <PermissionButton
variant='outlined' variant='outlined'
@ -223,7 +250,7 @@ const ActivelyUsed: FC<{
</InfoText> </InfoText>
<InfoText> <InfoText>
If you think this feature was completed too early you can revert to If you think this feature was completed too early you can revert to
the live stage. the previous stage.
</InfoText> </InfoText>
<PermissionButton <PermissionButton
variant='outlined' variant='outlined'
@ -233,7 +260,7 @@ const ActivelyUsed: FC<{
onClick={onUncomplete} onClick={onUncomplete}
disabled={loading} disabled={loading}
> >
Revert to production Revert to previous stage
</PermissionButton> </PermissionButton>
</StyledStageAction> </StyledStageAction>
); );
@ -421,6 +448,15 @@ export const FeatureLifecycleTooltip: FC<{
project={project} project={project}
/> />
) : null} ) : null}
{(stage.name === 'initial' ||
stage.name === 'pre-live') &&
onComplete ? (
<ReadyForCleanupAction
onComplete={onComplete}
loading={loading}
project={project}
/>
) : null}
</StyledFooter> </StyledFooter>
) : null} ) : null}
</Box> </Box>