Sha256: d10296704e9defc4b63e1af43bfa60caf9e278f727945bafca7a62fa18162722

Contents?: true

Size: 1.19 KB

Versions: 22

Compression:

Stored size: 1.19 KB

Contents

module PolicyDashboardHelper
  COLORS = {
    :compliant_hosts => ArfReportDashboardHelper::COLORS[:passed],
    :incompliant_hosts => ArfReportDashboardHelper::COLORS[:failed],
    :inconclusive_hosts => ArfReportDashboardHelper::COLORS[:othered],
    :report_missing => '#92A8CD',
  }.freeze

  def host_breakdown_chart(report, options = {})
    data = []
    [[:compliant_hosts, _('Compliant hosts')],
     [:incompliant_hosts, _('Incompliant hosts')],
     [:inconclusive_hosts, _('Inconclusive')],
     [:report_missing, _('Not audited')],].each do |i|
      data << { :label => i[1], :data => report[i[0]], :color => COLORS[i[0]] }
    end
    flot_pie_chart 'overview', _('Compliance Status'), data, options
  end

  def status_link(name, label, path)
    content_tag :li do
      content_tag(:i, raw('&nbsp;'), :class => 'label', :style => 'background-color:' + COLORS[label]) +
      raw('&nbsp;') +
      link_to(name, path, :class => 'dashboard-links') +
      content_tag(:h4, @report[label])
    end
  end

  def compliance_widget(opts)
    name = opts.delete(:name)
    template = opts.delete(:template)
    widget = Widget.new(opts)
    widget.name = name
    widget.template = template
    widget
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman_openscap-0.12.3 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.11.5 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.12.2 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.12.1 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.12.0 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.11.4 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.11.3 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.11.2 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.11.1 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.11.0 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.10.4 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.10.3 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.10.2 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.10.1 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.9.3 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.10.0 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.8.6 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.9.2 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.9.1 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.8.5 app/helpers/policy_dashboard_helper.rb