Class: Katello::ContentViewHistory
- Includes:
- Authorization::ContentViewHistory
- Defined in:
- app/models/katello/content_view_history.rb
Constant Summary collapse
- IN_PROGRESS =
'in progress'
- FAILED =
'failed'
- SUCCESSFUL =
'successful'
- STATUSES =
[IN_PROGRESS, FAILED, SUCCESSFUL]
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Model
Class Method Details
.in_organization(organization) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/models/katello/content_view_history.rb', line 28 def self.in_organization(organization) content_views = ContentView.where(:organization_id => organization.id) self.joins(:content_view_version => :content_view). where("#{ContentView.table_name}.id" => content_views). order("#{self.table_name}.updated_at DESC") end |
.in_organizations(organizations) ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/models/katello/content_view_history.rb', line 36 def self.in_organizations(organizations) content_views = ContentView.where(:organization_id => organizations) self.joins(:content_view_version => :content_view). where("#{ContentView.table_name}.id" => content_views). order("#{self.table_name}.updated_at DESC") end |
Instance Method Details
#content_view ⇒ Object
24 25 26 |
# File 'app/models/katello/content_view_history.rb', line 24 def content_view self.content_view_version.try(:content_view) end |
#humanized_action ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/models/katello/content_view_history.rb', line 44 def humanized_action case self.task.try(:label) when "Actions::Katello::ContentViewVersion::Export" _("Exported version") when "Actions::Katello::ContentView::Publish" _("Published new version") when "Actions::Katello::ContentView::Promote" _("Promoted to %{environment}") % { :environment => self.environment.try(:name) || _('Unknown') } when "Actions::Katello::ContentView::Remove" _("Deleted from %{environment}") % { :environment => self.environment.try(:name) || _('Unknown')} else _("Unknown Action") end end |
#humanized_status ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'app/models/katello/content_view_history.rb', line 59 def humanized_status case self.status when ContentViewHistory::IN_PROGRESS _("In Progress") when ContentViewHistory::FAILED _("Failed") when ContentViewHistory::SUCCESSFUL _("Success") end end |