Class: SolidQueueTui::Components::JobTable

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_queue_tui/components/job_table.rb

Constant Summary collapse

STATUS_COLORS =
{
  "ready" => :green,
  "claimed" => :yellow,
  "scheduled" => :blue,
  "failed" => :red,
  "blocked" => :magenta,
  "completed" => :dark_gray,
  "active" => :green,
  "paused" => :red,
  "delayed" => :red,
  "pending" => :dark_gray,
  "unknown" => :white
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(tui, title:, columns:, rows:, selected_row: nil, total_count: nil, empty_message: "No data") ⇒ JobTable

Returns a new instance of JobTable.



20
21
22
23
24
25
26
27
28
# File 'lib/solid_queue_tui/components/job_table.rb', line 20

def initialize(tui, title:, columns:, rows:, selected_row: nil, total_count: nil, empty_message: "No data")
  @tui = tui
  @title = title
  @columns = columns
  @rows = rows
  @selected_row = selected_row
  @total_count = total_count
  @empty_message = empty_message
end

Instance Method Details

#render(frame, area, table_state) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/solid_queue_tui/components/job_table.rb', line 30

def render(frame, area, table_state)
  if @rows.empty?
    render_empty(frame, area)
    return
  end

  render_table(frame, area, table_state)
end