Sha256: 9d7e0ef2d79bca6954b334c5774150fc8047c0bf34f742691c2e42701e26329b

Contents?: true

Size: 1.66 KB

Versions: 39

Compression:

Stored size: 1.66 KB

Contents

module Actions
  module Katello
    module ContentView
      module Presenters
        class IncrementalUpdatesPresenter < Helpers::Presenter::Base
          HUMANIZED_TYPES = {
            ::Katello::Erratum::CONTENT_TYPE => "Errata",
            ::Katello::ModuleStream::CONTENT_TYPE => "Module Streams",
            ::Katello::Rpm::CONTENT_TYPE => "Packages",
            ::Katello::PuppetModule::CONTENT_TYPE => "Puppet Modules"
          }.freeze

          def humanized_output
            if action.output[:changed_content]
              humanized_content
            else
              _("Incremental Update incomplete.")
            end
          end

          def humanized_content
            humanized_lines = []

            action.output[:changed_content].each do |output|
              cvv = ::Katello::ContentViewVersion.find_by(:id => output[:content_view_version][:id])
              if cvv
                humanized_lines << "Content View: #{cvv.content_view.name} version #{cvv.version}"
                humanized_lines << _("Added Content:")
                [::Katello::Erratum, ::Katello::ModuleStream, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
                  unless output[:added_units][content_type::CONTENT_TYPE].blank?
                    humanized_lines << "  #{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
                    humanized_lines += output[:added_units][content_type::CONTENT_TYPE].sort.map { |unit| "        #{unit}" }
                  end
                end
                humanized_lines << ''
              end
            end
            humanized_lines.join("\n")
          end
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
katello-4.0.3 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.5 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.2.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.2 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.4 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.1.2 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.3.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.1.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.3 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.0 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.0.rc3.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.0.rc3 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.2.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.2 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.17.3 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.0.rc2 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.18.1.1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-3.17.2 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb
katello-4.0.0.rc1 app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb