debian-mirror-gitlab/app/helpers/container_expiration_policies_helper.rb

28 lines
701 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
module ContainerExpirationPoliciesHelper
def cadence_options
ContainerExpirationPolicy.cadence_options.map do |key, val|
2020-03-13 15:44:24 +05:30
{ key: key.to_s, label: val }.tap do |base|
base[:default] = true if key.to_s == '1d'
end
2020-01-01 13:55:28 +05:30
end
end
def keep_n_options
ContainerExpirationPolicy.keep_n_options.map do |key, val|
2020-03-13 15:44:24 +05:30
{ key: key, label: val }.tap do |base|
base[:default] = true if key == 10
end
2020-01-01 13:55:28 +05:30
end
end
def older_than_options
ContainerExpirationPolicy.older_than_options.map do |key, val|
2020-03-13 15:44:24 +05:30
{ key: key.to_s, label: val }.tap do |base|
2020-04-22 19:07:51 +05:30
base[:default] = true if key.to_s == '90d'
2020-03-13 15:44:24 +05:30
end
2020-01-01 13:55:28 +05:30
end
end
end