Module: PolicyDashboardHelper
- Defined in:
- app/helpers/policy_dashboard_helper.rb
Constant Summary collapse
- COLORS =
{ :compliant_hosts => ArfReportDashboardHelper::COLORS[:passed], :incompliant_hosts => ArfReportDashboardHelper::COLORS[:failed], :inconclusive_hosts => ArfReportDashboardHelper::COLORS[:othered], :report_missing => '#92A8CD', }.freeze
Instance Method Summary collapse
- #assigned_icon(policy, arf_report) ⇒ Object
- #compliance_widget(opts) ⇒ Object
- #policy_breakdown_chart_data(report) ⇒ Object
- #status_link(name, label, path) ⇒ Object
- #unassigned_hosts_link ⇒ Object
Instance Method Details
#assigned_icon(policy, arf_report) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'app/helpers/policy_dashboard_helper.rb', line 38 def assigned_icon(policy, arf_report) if arf_report.host.combined_policies.include? policy icon = 'check' tooltip_text = _('Host is assigned to policy') else icon = 'close' tooltip_text = _('Host is not assigned to policy but reports were found. You may want to delete the reports or assign the policy again.') end trunc_with_tooltip icon_text(icon, '', :kind => 'fa'), 32, tooltip_text, false end |
#compliance_widget(opts) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/helpers/policy_dashboard_helper.rb', line 29 def (opts) name = opts.delete(:name) template = opts.delete(:template) = Widget.new(opts) .name = name .template = template end |
#policy_breakdown_chart_data(report) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/policy_dashboard_helper.rb', line 9 def policy_breakdown_chart_data(report) categories = { :compliant_hosts => _('Compliant hosts'), :incompliant_hosts => _('Incompliant hosts'), :inconclusive_hosts => _('Inconclusive'), :report_missing => _('Not audited'), } breakdown_chart_data categories, report, COLORS end |
#status_link(name, label, path) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/helpers/policy_dashboard_helper.rb', line 20 def status_link(name, label, path) content_tag :li do content_tag(:i, raw(' '), :class => 'label', :style => 'background-color:' + COLORS[label]) + raw(' ') + link_to(name, path, :class => 'dashboard-links') + content_tag(:h4, @report[label]) end end |
#unassigned_hosts_link ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/helpers/policy_dashboard_helper.rb', line 49 def unassigned_hosts_link trunc_with_tooltip( link_to( _("Hosts no longer assigned: %s") % @report[:unassigned_hosts], hosts_path(:search => "removed_from_policy = \"#{@policy.name}\"") ), 32, _("Total hosts with reports where policy is no longer assigned."), false ) end |