Sha256: e1d4b4eefb2ad026ef743e029a7c33508302eb9429be547d45172aa617af1e10

Contents?: true

Size: 1.03 KB

Versions: 16

Compression:

Stored size: 1.03 KB

Contents

module ComplianceHostsHelper

  def host_policy_breakdown_chart(report, options = {})
    data = []
    [[:passed, _('Passed')],
     [:failed, _('Failed')],
     [:othered, _('Other')],].each do |i|
      data << {:label => i[1], :data => report[i[0]], :color => ArfReportDashboardHelper::COLORS[i[0]]}
    end
    flot_pie_chart 'overview', _('Compliance reports breakdown'), data, options
  end

  def host_arf_reports_chart(policy_id)
    passed = []
    failed = []
    othered = []
    @host.arf_reports.of_policy(policy_id).each do |report|
      passed  << [report.created_at.to_i*1000, report.passed]
      failed  << [report.created_at.to_i*1000, report.failed]
      othered << [report.created_at.to_i*1000, report.othered]
    end
    [{:label => _("Passed"), :data => passed, :color => ArfReportDashboardHelper::COLORS[:passed]},
     {:label => _("Failed"), :data => failed, :color => ArfReportDashboardHelper::COLORS[:failed]},
     {:label => _("Othered"), :data => othered, :color => ArfReportDashboardHelper::COLORS[:othered]}]
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_openscap-0.7.13 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.12 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.11 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.10 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.8.3 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.9 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.8 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.7 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.8.2 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.6 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.8.1 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.5 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.8.0 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.4 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.3 app/helpers/compliance_hosts_helper.rb
foreman_openscap-0.7.2 app/helpers/compliance_hosts_helper.rb