Cleanup policies UI do not show `nil` values

Summary

Cleanup policies have nilable fields:

The problem is that the UI doesn't present those nil values.

Here is a cleanup policy with nil values for older_than and keep_n:

#<ContainerExpirationPolicy:0x00007fdcee48dd48
 project_id: 390,
 created_at: Tue, 13 Apr 2021 13:12:28 UTC +00:00,
 updated_at: Tue, 01 Jun 2021 12:56:05 UTC +00:00,
 next_run_at: Wed, 02 Jun 2021 12:56:05 UTC +00:00,
 name_regex: ".*",
 cadence: "1d",
 older_than: nil,
 keep_n: nil,
 enabled: true,
 name_regex_keep: nil>

and here is what the UI displays:

Screenshot_2021-06-01_at_14.58.07

This is confusing and could lead to data loss. Users could think that container images will cleaned up until there are 10 tags left but with keep_n nil, the cleanup policy will actually remove all tags.

Crunching numbers

At the time of this writing, we have on gitlab.com :

Example Project

https://gitlab.com/10io/NugetInstall/-/settings/ci_cd

What is the current bug behavior?

The UI displays 10 tags and 90 days for keep_n and older_than respectively when set to nil

What is the expected correct behavior?

The UI should display a blank value.

Edited by David Fernandez