Class: SolidQueueTui::Components::JobTable

Inherits:
Object
  • Object
show all
Includes:
FormattingHelpers
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

Methods included from FormattingHelpers

#format_duration, #format_number, #format_time, #humanize_duration, #time_ago, #time_until, #truncate

Constructor Details

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



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

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



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

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

  render_table(frame, area, table_state)
end