Expand description
The interactive profiles screen (doc 19b, section 18.11.2): a list and a form navigated with
the arrows. The logic (screen, form, keys) is pure and tested; term is the thin part that puts the
terminal in raw mode.
Re-exports§
pub use keys::Key;
Modules§
- api
- The routes the screens call (doc 34, section 3), typed, over
Client::call: eachApiCallbecomes ataba_client::Calland each reply is read into a small struct. Nothing is added totaba-client. - app
- The interactive loop (doc 34, section 4): prepares the terminal (and gives it back on exit and on panic), turns
keys, the clock and the workers’ replies into
Msgs, runsupdate, carries out its effects and draws. - editor
- A small form of text fields and checkboxes (doc 34, sections 6.5 and 6.7): creating and editing a token, a
profile. It is plain state: the keys change it and say what the person asked for (
Outcome); the screens decide what that means, and the popup draws it. - effect
- What
updateasks the outside world to do (doc 34, section 4).updatenever does it itself: the loop runs the effects and brings the outcome back as aMsg. - form
- A profile’s form: text fields, the
outputchoice, the “Default profile” box and the buttons. A pure state machine: receives keys and draws lines, without touching the terminal. - history
- The history of the session (doc 34, D-TUI-5 and section 7): circular buffers, one per series, filled by the sampler from the cluster reads. Nothing goes to disk; closing the app forgets everything.
- i18n
- The interface languages (doc 34, section 8): the catalogs in
locales/, the choice of language and the formats that depend on it (numbers, sizes, durations, dates). - keymap
- The one table of keys (doc 34, section 5): action ⇄ keys. The program reads its keys from here, and the help
(
?), the footer and the command palette (:) are generated from the same table, so they never disagree. - keys
- The keys: decodes the bytes the raw-mode terminal delivers (UTF-8 text and ANSI sequences for arrows and the like).
- menu
- The menu of an item (
Enteron a row of a list): the actions that can be done to the selected topic, token, profile or node, each named after what it acts on (Edit the topic,Publish a message), so a topic is never mistaken for a message. The keys of the screens keep working; the menu only lists them. - model
- The state of the whole interface (doc 34, section 4): everything the screens show, with no input or output.
updatechanges it andviewonly reads it, so both are tested without a terminal or a network. - msg
- Everything that can happen to the interface (doc 34, section 4): a key, a tick of the clock, a reply that came
back from a worker.
updatetakes one at a time. - prom
- Reader of the Prometheus text a node serves at
GET /nodes/{id}/metrics(doc 34, section 7): names, labels and values, plus the# TYPEof each family so counters can be told from gauges. - screen
- The profiles screen: the list and, over it, the form. Also a pure state machine;
saving the file and testing the connection are left to whoever drives it (
Services). - screens
- The screens of the interface, one per tab (doc 34, section 6): state, keys and drawing of each.
- term
- The real terminal, in raw mode and with no library:
sttyon Linux and macOS, the console’sSetConsoleModeon Windows (with virtual sequences, Windows 10 and later). - theme
- Colors and symbols of the interface (doc 34, TUI-FRM-09):
NO_COLORtakes the colors away andTABA_CLI_ASCII(or a locale that is not UTF-8) swaps the symbols for ASCII. A state is always a word and a symbol, never only a color. - update
update(model, msg) -> effects(doc 34, section 4): the whole behavior of the interface as a function of one input at a time. It never blocks and never touches the terminal or the network; the calls it wants made come out asEffects.- view
view(model) -> frame(doc 34, section 4): draws the whole interface from the model and changes nothing. The frame is a status line, the tabs, the screen of the tab, a footer, and at most one popup over them (TUI-FRM-*).- worker
- The workers (doc 34, section 4):
taba-clientis blocking, so the callsupdateasks for run on a few threads and come back as aMsg::Replymarked with the request and the generation they were asked in.
Structs§
- Frame
- What to draw: the lines (with ANSI color sequences, if
Style.color) and where the cursor is. - Style
Traits§
- Terminal
- The terminal in raw mode. When dropped, it gives the terminal back as it was.
Functions§
- run
- Runs the screen until the person quits.