3 min read
gat-tui Architecture
The terminal UI is intentionally small but composable so panes can be rearranged without touching the rendering glue. Everything hangs off a shared PaneContext that carries default tooltips and the command modal, and is passed into every pane when the navigation menu is built.
Seven-Pane Layout
| Pane | Hotkey | Description |
|---|---|---|
| Dashboard | 1 | System health, KPIs, quick actions |
| Commands | 2 | Snippet library, execution history |
| Datasets | 3 | Catalog browser, uploads, scenarios |
| Pipeline | 4 | Workflow DAG visualization |
| Operations | 5 | Batch job monitor, allocation results |
| Analytics | 6 | Seven analysis tabs (see below) |
| Settings | 7 | Display, data, execution preferences |
Analytics Pane Tabs
The Analytics pane provides comprehensive grid analysis in the terminal:
| Tab | Key | Description |
|---|---|---|
| Reliability | Tab | LOLE, EUE, thermal violations |
| Deliverability | Delivery capability by zone | |
| ELCC | Effective load carrying capability | |
| Power Flow | Congestion hotspots, voltage violations | |
| Contingency | c | N-1 security screening |
| PTDF | p | Transfer sensitivity factors |
| Y-bus | y | Admittance matrix explorer |
N-1 Contingency Tab
Systematic single-branch outage screening:
- Summary: total contingencies, violations, failed solves
- Status badge: "SECURE" (green) or "N VIOLATIONS" (red)
- Sortable results table: outage branch, max loading %, violation count
PTDF Tab
Power Transfer Distribution Factor analysis:
- Bus selection: injection (
i) and withdrawal (w) buses - Transfer sensitivity: PTDF factors for each branch (-1 to +1)
- Flow change preview: MW impact for 100 MW transfer
- Branch ranking by absolute PTDF factor
Y-bus Matrix Tab
Interactive admittance matrix visualization:
- Three view modes (cycle with
v):- Heatmap: ASCII grid with
โโโโby magnitude - List: Table of (row, col, G, B, magnitude)
- Sparsity: Pattern with
ยทfor zero,โfor non-zero
- Heatmap: ASCII grid with
Application Shell Layout
App::newseeds aCommandModalwith starter text, wraps it in aPaneContext, and hands that context to aPanelRegistry.PanelRegistry::registercollectsPaneViewimplementations and turns them intoMenuItementries (label, hotkey, tooltip, context buttons) with pre-computedPaneLayouttrees.PanelRegistry::into_shellproduces anAppShellthat knows how to render the menu bar, active layout, fallback tooltip, and command modal output at a fixed viewport for snapshots.- The
NavMenudrives focus changes via hotkeys and exposes the active tooltip so tooltips can come from either the shell default or the current pane.
Adding a Pane
- Implement
PaneViewfor a new struct incrates/gat-tui/src/panes/.- Provide a unique
id, a conciselabel, and a single-characterhotkey. - Build the visual tree in
layoutusingPaneLayout::new,Pane,Sidebar,SubTabs, orTableViewas needed. - Return optional
Tooltiptext andContextButtons so the menu bar can hint at shortcuts.
- Provide a unique
- Register the pane in
App::newby chaining another.register(NewPane)call on thePanelRegistry. - If the pane needs modal access, read it from the
PaneContext(which already owns the command modal) rather than creating a duplicate.
Adding an Analytics Tab
- Add variant to
AnalyticsTabenum inanalytics_pane.rs - Add result struct (e.g.,
NewAnalysisResultRow) - Add state fields to
AnalyticsPaneState - Update
next_tab()/prev_tab()cycle count - Add
is_*_tab()query method - Add selection/detail methods
- Update
update_metrics_list()andformat_summary()
GridService for Analysis
The GridService manages loaded networks and provides analysis methods:
let service = new;
let grid_id = service.load_grid_from_arrow?;
// Y-bus admittance matrix
let = service.get_ybus?;
// PTDF for a transfer (bus 1 โ bus 5)
let ptdf_results = service.compute_ptdf?;
// N-1 contingency screening
let contingencies = service.run_n1_contingency?;
UX Rules of Thumb
- Every pane should render with readable defaults in an 110ร32 viewport: prefer short sentences, compact tables, and minimal nesting.
- Hotkeys must be unique across the menu and context buttons; the menu bar should show the active item with
[*]and a short actions list when available. - Tooltips should tell operators which focus switches are available (e.g., when a layout will swap visualizers on wide screens).
- Secondary content should collapse gracefully: use
ResponsiveRulesto hide visuals first, and keep empty states explicit withEmptyStateso gaps are intentional. - The command modal is the only place to run commands. Keep pane text focused on navigation and discovery; use the modal help and examples to teach invocation patterns.