app/views/katello/api/v2/capsule_content/sync_status.json.rabl in katello-3.18.5 vs app/views/katello/api/v2/capsule_content/sync_status.json.rabl in katello-4.0.0.rc1

- old
+ new

@@ -15,35 +15,32 @@ attributes :library node :syncable do |env| @capsule.environment_syncable?(env) end - node :counts do |env| - counts = { - :content_hosts => env.hosts.authorized("view_hosts").count, - :content_views => env.content_views.non_default.count, - :products => env.products.enabled.count - } - repo_data = @capsule.smart_proxy_service.current_repositories_data(env) - counts.merge!(Katello::Pulp::ContentCountsCalculator.new(repo_data).calculate) - end - node :content_views do |env| - env.content_views.map do |content_view| - attributes = { - :id => content_view.id, - :label => content_view.label, - :name => content_view.name, - :composite => content_view.composite, - :last_published => content_view.versions.empty? ? nil : content_view.versions.last.created_at, - :default => content_view.default, - :counts => { - :content_hosts => content_view.hosts.authorized("view_hosts").count, - :products => content_view.products.enabled.count - } + if @capsule.has_feature?(SmartProxy::PULP_NODE_FEATURE) || @capsule.has_feature?(SmartProxy::PULP3_FEATURE) + node :counts do |env| + { + :content_views => env.content_views.non_default.count } - repo_data = @capsule.smart_proxy_service.current_repositories_data(env, content_view) - attributes[:counts].merge!(Katello::Pulp::ContentCountsCalculator.new(repo_data).calculate) - attributes + end + + node :content_views do |env| + env.content_views.map do |content_view| + attributes = { + :id => content_view.id, + :label => content_view.label, + :name => content_view.name, + :composite => content_view.composite, + :last_published => content_view.versions.empty? ? nil : content_view.versions.last.created_at, + :default => content_view.default, + :up_to_date => @capsule.repos_pending_sync(env, content_view).empty?, + :counts => { + :repositories => @capsule.current_repositories_data(env, content_view).try(:count) + } + } + attributes + end end end end