Module: Katello::HostDisplayHelper

Included in:
HostsAndHostgroupsHelper
Defined in:
app/helpers/katello/host_display_helper.rb

Instance Method Summary collapse

Instance Method Details

#errata_counts(host) ⇒ Object



21
22
23
24
# File 'app/helpers/katello/host_display_helper.rb', line 21

def errata_counts(host)
  counts = host.content_facet_attributes&.errata_counts || {}
  render partial: 'katello/hosts/errata_counts', locals: { counts: counts, host: host }
end

#host_checkin_time(host) ⇒ Object



32
33
34
35
36
# File 'app/helpers/katello/host_display_helper.rb', line 32

def host_checkin_time(host)
  return ''.html_safe unless host.subscription_facet_attributes&.last_checkin

  date_time_relative_value(host.subscription_facet_attributes.last_checkin)
end

#host_registered_time(host) ⇒ Object



26
27
28
29
30
# File 'app/helpers/katello/host_display_helper.rb', line 26

def host_registered_time(host)
  return ''.html_safe unless host.subscription_facet_attributes&.registered_at

  date_time_relative_value(host.subscription_facet_attributes.registered_at)
end

#host_status_icon(status) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/katello/host_display_helper.rb', line 7

def host_status_icon(status)
  colours = [:green, :yellow, :red]

  colour = colours[status] || :red

  icons = {
    green: "#{colour} host-status pficon pficon-ok status-ok",
    yellow: "#{colour} host-status pficon pficon-info status-warn",
    red: "#{colour} host-status pficon pficon-error-circle-o status-error",
  }

  (:span, '', class: icons[colour])
end

#hosts_change_content_sourceObject



3
4
5
# File 'app/helpers/katello/host_display_helper.rb', line 3

def hosts_change_content_source
  [{ action: [_('Change Content Source'), '/change_host_content_source', false], priority: 100 }]
end