UI: Package cleanup policy rule based on package creation date

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Context

As part of &5152 (closed), GitLab is adding policies to manage your storage usage with the Package Registry. As an MVC we added the ability to programmatically delete package assets (or files).

Problem to solve

Thinking beyond the MVC, we will need to add the ability to delete the packages themselves, not just the assets. This will allow users to better manage storage and maintain a tidy workspace.

Scope of this issue

Add an additional section in project settings where the user can set a policy to remove packages older than n days

Screen_Shot_2022-11-01_at_15.43.56

🎨 Figma

Designs also include state where #378342 is also completed.

Considerations

Eventually, cleanup policies will be on its own page with a more complex UI (design), for example having a preview of items to be deleted. However, to keep the scope of this issue small, I propose adding a small section to the main package settings page with the knowledge that eventually we will rework it.

Logic

If the user has entered a value for any of the possible cleanup policies, we show a message Packages and assets will not be deleted until cleanup runs in [number] hours.

If the user removes all values from any of the possible cleanup policies, the message is no longer shown:

Screen_Recording_2022-11-08_at_17.16.22

Implementation guide

Edited by 🤖 GitLab Bot 🤖