mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: add "cleanup" action to other flag lifecycle stages (#10471)
This commit is contained in:
		
							parent
							
								
									ac67a50693
								
							
						
					
					
						commit
						98bbf85421
					
				| @ -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(); | ||||||
|  | |||||||
| @ -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> | ||||||
|                     } |                     } | ||||||
|  | |||||||
| @ -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> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user