Welcome to mirror list, hosted at ThFree Co, Russian Federation.

container_expiration_policies_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0005682e979560aa8117fa2f5de8cb79ca4d14b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module ContainerExpirationPoliciesHelper
  def cadence_options
    ContainerExpirationPolicy.cadence_options.map do |key, val|
      { key: key.to_s, label: val }.tap do |base|
        base[:default] = true if key.to_s == '1d'
      end
    end
  end

  def keep_n_options
    ContainerExpirationPolicy.keep_n_options.map do |key, val|
      { key: key, label: val }.tap do |base|
        base[:default] = true if key == 10
      end
    end
  end

  def older_than_options
    ContainerExpirationPolicy.older_than_options.map do |key, val|
      { key: key.to_s, label: val }.tap do |base|
        base[:default] = true if key.to_s == '90d'
      end
    end
  end

  def container_expiration_policies_historic_entry_enabled?
    Gitlab::CurrentSettings.container_expiration_policies_enable_historic_entries
  end
end