Skip to content

[Draft/PoC] Architecture for async loadingtablelist (via jobservice)#936

Draft
SuperCoolPencil wants to merge 1 commit into
goharbor:mainfrom
SuperCoolPencil:job-service-cmds
Draft

[Draft/PoC] Architecture for async loadingtablelist (via jobservice)#936
SuperCoolPencil wants to merge 1 commit into
goharbor:mainfrom
SuperCoolPencil:job-service-cmds

Conversation

@SuperCoolPencil
Copy link
Copy Markdown

@SuperCoolPencil SuperCoolPencil commented May 16, 2026

This PR introduces the harbor jobservice (or harbor js) command suite, bringing the functionality of the Harbor Jobservice UI Dashboard directly to the terminal.

While implementing these commands, I noticed some UX bottlenecks inherent to synchronous API calls in CLI applications. To resolve this, this PR introduces two new unified TUI abstractions (loadingtable and logviewer) that handle asynchronous data fetching, ensuring the terminal never freezes on slow network requests.


I noticed there is already an active PR for the jobservice feature (#796), which is great! I am applying for the LFX TUI refactor mentorship, so instead of competing with that PR, I used the jobservice commands as a sandbox to build a Proof of Concept for the loadingtablelist abstraction mentioned in the LFX roadmap.

Technical Achievements:

loadingtable (pkg/views/base/loadingtable)

A reusable async table component for Bubble Tea views. Key improvements include:

  • Cobra commands no longer block on api.Get... calls.
  • API requests now run through tea.Cmd, allowing the TUI to start instantly with a loading spinner while data is fetched in the background.
  • Combines table rendering and interactive selection into a single abstraction. Commands that need selection flows (such as queue clear) can now reuse the same component instead of switching between different views.

logviewer (pkg/views/base/logviewer)

A new async log viewer built on top of Charm’s viewport.Model. Improvements include:

  • Replaces the old blocking for { time.Sleep() } loop used for streaming logs.
  • --follow mode now polls asynchronously using tea.Tick.
  • Supports scrolling, window resizing (tea.WindowSizeMsg), and clean exits (Ctrl+C / q).
  • Keeps the UI responsive even during long-running log streams.

Other Improvements:

  • Unified JobAction constants and type aliases for improved maintainability.
  • Optimized and extracted data mapping logic to eliminate code duplication.

This POC demonstrates how we can eliminate terminal blocking across the entire CLI by adopting this async pattern.

Signed-off-by: SuperCoolPencil <thesupercoolpencil@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant