Class: SolidQueueMonitor::ChartPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/services/solid_queue_monitor/chart_presenter.rb

Constant Summary collapse

CHART_WIDTH =
1200
CHART_HEIGHT =
280
PADDING =
{ top: 40, right: 30, bottom: 60, left: 60 }.freeze
COLORS =
{
  created: '#3b82f6',   # Blue
  completed: '#10b981', # Green
  failed: '#ef4444'     # Red
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(chart_data) ⇒ ChartPresenter

Returns a new instance of ChartPresenter.



14
15
16
17
18
# File 'app/services/solid_queue_monitor/chart_presenter.rb', line 14

def initialize(chart_data)
  @data = chart_data
  @plot_width = CHART_WIDTH - PADDING[:left] - PADDING[:right]
  @plot_height = CHART_HEIGHT - PADDING[:top] - PADDING[:bottom]
end

Instance Method Details

#renderObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/services/solid_queue_monitor/chart_presenter.rb', line 20

def render
  <<-HTML
    <div class="chart-section" id="chart-section">
      <div class="chart-header">
        <div class="chart-header-left">
          <button class="chart-toggle-btn" id="chart-toggle-btn" title="Toggle chart">
            <svg class="chart-toggle-icon" id="chart-toggle-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <polyline points="6 9 12 15 18 9"></polyline>
            </svg>
          </button>
          <h3>Job Activity</h3>
          #{render_summary}
        </div>
        #{render_time_select}
      </div>
      <div class="chart-collapsible" id="chart-collapsible">
        <div class="chart-container">
          #{render_svg}
        </div>
        #{render_legend}
      </div>
    </div>
    #{render_tooltip}
  HTML
end