Sha256: 7e8bdd3ecb677a539a80a47dfb8e7889135b1c997950d0dc130233295a0d56b1
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
module ForemanOpenscap module HostsHelperExtensions extend ActiveSupport::Concern included do alias_method_chain :multiple_actions, :scap end Colors = { :passed => '#89A54E', :failed => '#AA4643', :othered => '#DB843D', } def multiple_actions_with_scap multiple_actions_without_scap + [[_('Assign Compliance Policy'), select_multiple_hosts_scaptimony_policies_path], [_('Unassign Compliance Policy'), disassociate_multiple_hosts_scaptimony_policies_path]] end def host_policy_breakdown_chart(report, options = {}) data = [] [[:passed, _('Passed')], [:failed, _('Failed')], [:othered, _('Other')], ].each { |i| data << {:label => i[1], :data => report[i[0]], :color => Colors[i[0]]} } 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 => Colors[:passed]}, {:label => _("Failed"), :data => failed, :color => Colors[:failed]}, {:label => _("Othered"), :data => othered, :color => Colors[:othered]}] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_openscap-0.4.1 | app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb |
foreman_openscap-0.4.0 | app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb |