Module: ArfReportDashboardHelper

Defined in:
app/helpers/arf_report_dashboard_helper.rb

Constant Summary collapse

COLORS =
{
  :passed => '#89A54E',
  :failed => '#AA4643',
  :othered => '#DB843D',
}.freeze

Instance Method Summary collapse

Instance Method Details

#arf_report_status_chart_data(status) ⇒ Object



23
24
25
26
27
28
29
# File 'app/helpers/arf_report_dashboard_helper.rb', line 23

def arf_report_status_chart_data(status)
  {
    :data => status.to_a,
    :yAxisLabel => _("Number of Events"),
    :xAxisLabel => _("Rule Results"),
  }
end

#breakdown_chart_data(categories, report, colors = COLORS) ⇒ Object



8
9
10
11
12
# File 'app/helpers/arf_report_dashboard_helper.rb', line 8

def breakdown_chart_data(categories, report, colors = COLORS)
  categories.reduce([]) do |memo, (key, value)|
    memo << [value, report[key], colors[key]]
  end
end

#donut_breakdown_chart_data(report) ⇒ Object



14
15
16
17
18
19
20
21
# File 'app/helpers/arf_report_dashboard_helper.rb', line 14

def donut_breakdown_chart_data(report)
  categories = {
    :failed => _('Failed'),
    :passed => _('Passed'),
    :othered => _('Other')
  }
  breakdown_chart_data categories, report
end