Class: SolidQueueTui::Components::Header

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

Constant Summary collapse

LOGO =
[
  " ____        _ _     _    ___                        ",
  "/ ___|  ___ | (_) __| |  / _ \\ _   _  ___ _   _  ___ ",
  "\\___ \\ / _ \\| | |/ _` | | | | | | | |/ _ \\ | | |/ _ \\",
  " ___) | (_) | | | (_| | | |_| | |_| |  __/ |_| |  __/",
  "|____/ \\___/|_|_|\\__,_|  \\___/\\__,_|\\___|\\__,_|\\___|"
].freeze
VIEWS =
[
  { key: "1", label: "Dashboard" },
  { key: "2", label: "Queues" },
  { key: "3", label: "Failed" },
  { key: "4", label: "In Progress" },
  { key: "5", label: "Blocked" },
  { key: "6", label: "Scheduled" },
  { key: "7", label: "Finished" },
  { key: "8", label: "Workers" }
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(tui, current_view:) ⇒ Header



25
26
27
28
# File 'lib/solid_queue_tui/components/header.rb', line 25

def initialize(tui, current_view:)
  @tui = tui
  @current_view = current_view
end

Instance Method Details

#render(frame, area) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/solid_queue_tui/components/header.rb', line 30

def render(frame, area)
  left_area, right_area = @tui.layout_split(
    area,
    direction: :horizontal,
    constraints: [
      @tui.constraint_percentage(50),
      @tui.constraint_percentage(50)
    ]
  )

  render_info(frame, left_area)
  render_nav(frame, right_area)
end