Sha256: 61f2315548d2140f7261e790588beff3f058bf4970ae36b2d7b662811a079a5e

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

object @environment => :environment

extends 'katello/api/v2/common/identifier'
extends 'katello/api/v2/common/org_reference'

attributes :library

node :prior do |env|
  if env.prior
    {name: env.prior.name, :id => env.prior.id}
  end
end

node :successor do |env|
  if !env.library && env.successor
    {name: env.successor.name, :id => env.successor.id}
  end
end

node :counts do |env|
  counts = {
    :content_hosts => env.systems.readable.count,
    :content_views => env.content_views.non_default.count
  }
  if env.library?
    repos = env.repositories.in_default_view
    counts[:packages] = Katello::Rpm.total_for_repositories(repos)
    counts[:puppet_modules] = Katello::PuppetModule.in_repositories(repos).count
    counts[:errata] = partial('katello/api/v2/errata/counts', :object => Katello::RelationPresenter.new(Katello::Erratum.in_repositories(repos)))
    counts[:yum_repositories] = repos.yum_type.count
    counts[:docker_repositories] = repos.docker_type.count
    counts[:products] = env.organization.products.enabled.count
  end
  counts
end

node :permissions do |env|
  {
    :view_lifecycle_environments => env.readable?,
    :edit_lifecycle_environments => env.editable?,
    :destroy_lifecycle_environments => env.deletable?,
    :promote_or_remove_content_views_to_environments => env.promotable_or_removable?
  }
end

extends 'katello/api/v2/common/timestamps'

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.4 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.3 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.2 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.1 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.0 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.0.rc3 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.0.rc2 app/views/katello/api/v2/environments/show.json.rabl
katello-2.4.0.rc1 app/views/katello/api/v2/environments/show.json.rabl