foreman/app/helpers/hosts_helper.rb @ fee0b7af
2f077f63 | Ohad Levy | module HostsHelper
|
|
eafaf5f1 | Ohad Levy | def last_report_column(record)
|
|
7767028b | Ohad Levy | return nil if record.last_report.nil?
|
|
time = time_ago_in_words(record.last_report.getlocal)
|
|||
image_tag("#{not (record.error_count > 0 or record.no_report)}.png", :size => "18x18") +
|
|||
fee0b7af | Ohad Levy | link_to_if(@last_reports[record.id], time, report_path(@last_reports[record.id].to_i))
|
|
c439b058 | Ohad Levy | end
|
|
767bbf03 | Ohad Levy | ||
766e0f38 | Ohad Levy | # method that reformats the hostname column by adding the status icons
|
|
def name_column(record)
|
|||
2ce2046f | Ohad Levy | if record.build and not record.installed_at.nil?
|
|
image ="attention_required.png"
|
|||
title = "Pending Installation"
|
|||
elsif (os=record.fv(:kernel)).nil?
|
|||
image = "warning.png"
|
|||
title = "No Inventory Data"
|
|||
else
|
|||
image = "#{os}.jpg"
|
|||
title = os
|
|||
end
|
|||
3446abb6 | Ohad Levy | image_tag("hosts/#{image}", :size => "18x18", :title => title) +
|
|
72e65b31 | Ohad Levy | link_to(record.shortname, host_path(record))
|
|
766e0f38 | Ohad Levy | end
|
|
c439b058 | Ohad Levy | ||
72e65b31 | Ohad Levy | def days_ago time
|
|
((Time.now - time) / 1.day).round.to_i
|
|||
end
|
|||
7c0c8e06 | Ohad Levy | ||
b09b4515 | Ohad Levy | def searching?
|
|
params[:search].empty?
|
|||
end
|
|||
52538203 | Ohad Levy | def selected? host
|
|
return false if host.nil? or not host.is_a?(Host) or session[:selected].nil?
|
|||
session[:selected].include?(host.id.to_s)
|
|||
end
|
|||
def hosts_controller?
|
|||
controller.controller_name == "hosts"
|
|||
end
|
|||
2f077f63 | Ohad Levy | end
|