feat(desktop): move workspace ports into the workspace item

Merged
KI
4mo ago
+850-328

What

Moves the workspace ports out of the standalone "Ports" panel pinned at the bottom of the v2 sidebar and into each workspace item as an inline, collapsible section.

Before

A single consolidated "Ports" panel sat at the bottom of the sidebar, grouping ports by workspace separately from the workspace list.

After

  • Each workspace item renders its own ports inline, within the item block — sharing the active/hover background and the accent stripe.
  • Ports lay out in up to 2 rows of badges (horizontal scroll on overflow), matching the previous badge layout.
  • A per-workspace disclosure toggle (chevron + summary, e.g. 2 ports) shows/hides the section. Collapse state is persisted per workspace and defaults to expanded, so behavior is unchanged on first run.

How

  • DashboardSidebarPortsProvider runs the existing useDashboardSidebarPortsData() once at the sidebar root and exposes a Map<workspaceId, group> via context, so each workspace row looks up its own ports instead of every item re-fetching.
  • DashboardSidebarExpandedWorkspaceRow was restructured into an outer container (active/hover background + full-height accent stripe) with an inner clickable header, and renders children (the details section) below the header. Port badges live in the container but outside the clickable header, so clicking a badge does its own navigation without also triggering the row click.
  • DashboardSidebarWorkspaceDetails is a collapsible container with a section registry — each detail type calls its hook and pushes a { key, summary, content } entry when it has something to show. Adding new rows (e.g. running agents) is a few lines in one place; the toggle, combined summary, persisted collapse state, and empty handling are already wired.
  • useWorkspaceDetailsStore persists only explicitly-collapsed workspace ids (default expanded).
  • Removed the bottom DashboardSidebarPortsList and the now-unused DashboardSidebarPortGroup. The shared data hook, kill hook, and DashboardSidebarPortBadge are reused.

Notes

  • The old global "Ports" header/count/docs link (part of the bottom panel) and its global usePortsStore collapse flag are no longer used by v2 (v1 sidebar untouched).
  • The old per-group workspace-name button and Local/Remote badge are dropped as redundant under each item; the per-port tooltip still shows the host label.

Test plan

  • Workspaces with ports show an inline section under the row; the toggle expands/collapses and persists across reloads.
  • Ports overflow into 2 rows with horizontal scroll.
  • Clicking a port badge / open-in-browser / close still works and doesn't double-navigate.
  • Workspaces without ports render no section/toggle.
  • Active workspace highlight + accent stripe span the whole item including the ports.

🤖 Generated with Claude Code


Open in Stage

Summary by cubic

Moves workspace ports into each workspace item behind an experimental toggle, with a collapsible details section and a “Close all ports” action. The toggle defaults off (bottom Ports panel); both modes fetch once via a shared provider, and port polling pauses when the sidebar is collapsed.

  • New Features

    • Inline ports under each workspace (2 rows, horizontal scroll).
    • Collapsible per-workspace details (state persists) with “Close all ports”.
    • Shared DashboardSidebarPortsProvider; toggle centralized via useInlineWorkspacePortsEnabled (bottom panel only when inline is disabled).
  • Bug Fixes

    • Skip port queries/subscriptions while the sidebar is collapsed.
    • Prevent drag-reorder when interacting in the details area; hover now scoped to the header; actions also reveal on keyboard focus.
    • Added aria-labels to ports docs and “Close all ports”; tooltip delayed (700ms) with improved contrast.

Summary by CodeRabbit

  • New Features

    • Added an experimental “Inline workspace ports” toggle (v2-only) to show detected ports directly under each workspace in the dashboard sidebar.
    • Enhanced workspace expansion to reveal port details (with “close all ports” when ports exist), based on workspace status.
  • Bug Fixes

    • Fixed sidebar ports rendering to respect sidebar collapse, pending workspaces, and the inline ports setting; preserved expanded/collapsed state across sessions.
  • UI Polish

    • Improved port badge tooltip timing and styling for clearer host/port/process info.