Module: OmahaHostsHelper

Defined in:
app/helpers/omaha_hosts_helper.rb

Instance Method Summary collapse

Instance Method Details

#last_omaha_report_column(record) ⇒ Object



4
5
6
7
8
9
# File 'app/helpers/omaha_hosts_helper.rb', line 4

def last_omaha_report_column(record)
  time = record.omaha_facet.last_report? ? _('%s ago') % time_ago_in_words(record.omaha_facet.last_report) : ''
  link_to_if_authorized(time,
                        hash_for_host_omaha_report_path(:host_id => record.to_param, :id => 'last'),
                        last_omaha_report_tooltip(record))
end

#last_omaha_report_tooltip(record) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/omaha_hosts_helper.rb', line 11

def last_omaha_report_tooltip(record)
  opts = { :rel => 'twipsy' }
  if @last_report_ids[record.id]
    opts['data-original-title'] = _('View last report details')
  else
    opts.merge!(:disabled => true, :class => 'disabled', :onclick => 'return false')
    opts['data-original-title'] = _('Report Already Deleted') unless record.omaha_facet.last_report.nil?
  end
  opts
end

#list_view_class_for_omaha_status(status) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/helpers/omaha_hosts_helper.rb', line 22

def list_view_class_for_omaha_status(status)
  klasses = [
    iconclass_for_omaha_status(status),
    'list-view-pf-icon-md'
  ]
  klasses << case status.to_sym
             when :complete
               'list-view-pf-icon-success'
             when :downloading
               'list-view-pf-icon-info'
             when :downloaded
               'list-view-pf-icon-success'
             when :installed
               'fa fa-sign-in text-success'
             when :instance_hold
               'list-view-pf-icon-warning'
             when :error
               'list-view-pf-icon-danger'
             else
               'list-view-pf-icon-info'
             end
  klasses.join(' ')
end