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



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

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

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



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

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

  data.to_json
end

#donut_breakdown_chart_data(report) ⇒ Object



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

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