Sha256: b7df0052b47b7740991dde3c207989627f1a86fc4e703aa4abf9e198b38657aa

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

#
# Copyright (c) 2014 Red Hat Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 3 (GPLv3). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3
# along with this software; if not, see http://www.gnu.org/licenses/gpl.txt
#

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

  def policy_widget_list
    ForemanOpenscap::PolicyDashboard::Manager.widgets
  end

  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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_openscap-0.5.4 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.5.3 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.5.2 app/helpers/policy_dashboard_helper.rb
foreman_openscap-0.5.1 app/helpers/policy_dashboard_helper.rb