module Swarmy::Views

Extended Modules

Defined in:

swarmy/views.cr

Instance Method Summary

Instance Method Detail

def columns : Array(Tui::Table::Column) #

def filter_badge(filter : String | Nil, hint_color : String) : String #

Renders the "· filter: x" badge shown next to the service count when a filter is active, or "" when there is none.


def header(table : Tui::Table) : String #

def row_cells(svc : Service) : Array(String) #

def scroll_window(total : Int32, cursor : Int32, visible : Int32) : Tuple(Int32, Int32) #

Computes the [first, last) row range to render so that cursor stays visible within a window of visible rows out of total, scrolling only as needed (keeps the cursor centered once it outgrows the top or bottom edge) rather than jumping straight to either end.


def search_prompt(buffer : String, key_color : String, hint_color : String) : String #

Renders the inline "/query any key applies esc cancels" prompt shown while editing the filter.


def server_columns : Array(Tui::Table::Column) #

def server_row(table : Tui::Table, name : String, hint : String, active : Bool, selected : Bool) : String #

def server_table(rows : Array(Array(String)), term_width : Int32) : Tui::Table #

def service_detail(svc : Service, tasks : Array(Task), running : Array(Task), task_cursor : Int32, width : Int32 = 60) : String #

def service_row(table : Tui::Table, svc : Service, selected : Bool) : String #

def table(services : Array(Service), term_width : Int32) : Tui::Table #