UI: Package cleanup policy rule based on package creation date
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
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:
Implementation guide
- Update GraphQL query & mutation to use fields defined in #370584 (to be confirmed)
- Add form field to https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/packages_and_registries/settings/project/components/packages_cleanup_policy_form.vue