diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-12 23:05:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-12 23:05:32 +0300 |
| commit | 15338e6d4253fc8f4871a68ddcc41c6e3ce58220 (patch) | |
| tree | 1bc84a277b7e45443658a5aad97d21f79359598e /internal/runtime | |
| parent | 9f8096551ecf7184693b786a8e0b77d290086eac (diff) | |
extract dashboard tab framework into Tab registry for OCP compliance
Introduce tabDescriptor struct and tabDescriptors map in new
tabregistry.go. Each tab registers its name, short name, ordered
position, allowed viz modes, render function, scroll handler, and
optional init tick command. Adding a new tab now requires only a
single registry entry — no existing switch/if chains need editing.
Key changes:
- Tab.String() and tabLabel() use lookupTab() instead of a switch
- renderActiveTabContent() dispatches via d.Render (replaces renderActiveTab switch)
- handleScrollKey() dispatches via d.HandleScroll (replaces tab switch)
- Init() and postKeyTransitionCmd() use d.InitCmd (replaces stream/flame tab checks)
- allowedVizModes() delegates to tabAllowedVizModes() from registry
- orderedTabs() replaces hardcoded allTabs slice, derived from Position field
- bubbleChartFor() helper eliminates 5 repeated switch-on-tab for chart ops
- toggleBubbleMetric, tickActiveBubbleChart, moveBubbleSelection,
activeBubbleChartHasNodes all use bubbleChartFor()
- refreshBubbleData split into two focused functions under 50 lines
- Two pre-existing test functions over 50 lines refactored
All tests pass; go build ./internal/tui/... clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/runtime')
0 files changed, 0 insertions, 0 deletions
