Module: ScaptimonyPolicyDashboardHelper

Defined in:
app/helpers/scaptimony_policy_dashboard_helper.rb

Overview

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

Constant Summary collapse

Colors =
{
  :compliant_hosts => '#89A54E',
  :incompliant_hosts => '#AA4643',
  :inconclusive_hosts => '#DB843D',
  :report_missing => '#92A8CD',
}

Instance Method Summary collapse

Instance Method Details

#host_breakdown_chart(report, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/scaptimony_policy_dashboard_helper.rb', line 23

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

#policy_widget_list ⇒ Object



19
20
21
# File 'app/helpers/scaptimony_policy_dashboard_helper.rb', line 19

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


35
36
37
38
39
40
41
42
# File 'app/helpers/scaptimony_policy_dashboard_helper.rb', line 35

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