2019-12-11 07:08:10 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ContainerExpirationPoliciesHelper
|
|
|
|
def cadence_options
|
|
|
|
ContainerExpirationPolicy.cadence_options.map do |key, val|
|
2019-12-20 04:24:38 -05:00
|
|
|
{ key: key.to_s, label: val }.tap do |base|
|
|
|
|
base[:default] = true if key.to_s == '1d'
|
|
|
|
end
|
2019-12-11 07:08:10 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def keep_n_options
|
|
|
|
ContainerExpirationPolicy.keep_n_options.map do |key, val|
|
2019-12-20 04:24:38 -05:00
|
|
|
{ key: key, label: val }.tap do |base|
|
|
|
|
base[:default] = true if key == 10
|
|
|
|
end
|
2019-12-11 07:08:10 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def older_than_options
|
|
|
|
ContainerExpirationPolicy.older_than_options.map do |key, val|
|
2019-12-20 04:24:38 -05:00
|
|
|
{ key: key.to_s, label: val }.tap do |base|
|
2020-04-02 14:08:11 -04:00
|
|
|
base[:default] = true if key.to_s == '90d'
|
2019-12-20 04:24:38 -05:00
|
|
|
end
|
2019-12-11 07:08:10 -05:00
|
|
|
end
|
|
|
|
end
|
2020-10-12 11:08:32 -04:00
|
|
|
|
2022-03-04 22:19:17 -05:00
|
|
|
def container_expiration_policies_historic_entry_enabled?
|
|
|
|
Gitlab::CurrentSettings.container_expiration_policies_enable_historic_entries
|
2020-10-12 11:08:32 -04:00
|
|
|
end
|
2019-12-11 07:08:10 -05:00
|
|
|
end
|