Module: RailsErrorDashboard::OverviewHelper

Defined in:
app/helpers/rails_error_dashboard/overview_helper.rb

Instance Method Summary collapse

Instance Method Details

#error_rate_border_class(rate) ⇒ Object

All helper methods return Bootstrap semantic classes (success, warning, danger) These automatically map to Catppuccin Mocha colors in dark theme via CSS variables:

  • success → –ctp-green

  • warning → –ctp-peach

  • danger → –ctp-red



10
11
12
13
14
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 10

def error_rate_border_class(rate)
  return "border-success" if rate < 1.0
  return "border-warning" if rate < 5.0
  "border-danger"
end

#error_rate_text_class(rate) ⇒ Object



16
17
18
19
20
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 16

def error_rate_text_class(rate)
  return "text-success" if rate < 1.0
  return "text-warning" if rate < 5.0
  "text-danger"
end

#health_status_color(status) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 56

def health_status_color(status)
  case status
  when :healthy
    "success"
  when :warning
    "warning"
  else
    "danger"
  end
end

#health_status_text(status) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 67

def health_status_text(status)
  case status
  when :healthy
    "✅ Healthy"
  when :warning
    "⚠️ Warning"
  else
    "🔴 Critical"
  end
end

#severity_icon(severity) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 43

def severity_icon(severity)
  case severity
  when :critical
    "🔴"
  when :high
    "🟠"
  when :medium
    "🟡"
  else
    ""
  end
end

#trend_arrow(value) ⇒ Object



22
23
24
25
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 22

def trend_arrow(value)
  return "" if value.zero?
  value > 0 ? "" : ""
end

#trend_color_class(value) ⇒ Object



27
28
29
30
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 27

def trend_color_class(value)
  return "text-muted" if value.zero?
  value > 0 ? "text-danger" : "text-success"
end

#trend_text(direction) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/rails_error_dashboard/overview_helper.rb', line 32

def trend_text(direction)
  case direction
  when :increasing
    "Increasing"
  when :decreasing
    "Decreasing"
  else
    "Stable"
  end
end