Skip to content

feat(clusterView): Cluster dashboard / home page#753

Open
khelanmodi wants to merge 1 commit into
mainfrom
dev/khelanmodi/cluster-dashboard
Open

feat(clusterView): Cluster dashboard / home page#753
khelanmodi wants to merge 1 commit into
mainfrom
dev/khelanmodi/cluster-dashboard

Conversation

@khelanmodi

Copy link
Copy Markdown
Contributor

feat(clusterView): Cluster dashboard / home page

Summary

Connecting to or selecting a cluster previously dropped users on VS Code's
empty editor. This PR adds a cluster overview dashboard webview that opens
in its place, lists all databases with at-a-glance metrics, and lets users
drill into a database to see its collections — with create flows for both.

Built entirely on the extension's existing patterns: the registry-driven React
webview + tRPC router stack, Fluent UI v9 primitives, and VS Code theme tokens.
No new connection path, no new UI toolkit, no new runtime dependencies.

What ships

Cluster overview (home page)

  • Opens from the cluster tree node (double-click + context menu + inline icon)
    via the new openClusterView command instead of the empty editor.
  • One row per database: Storage size, Collections, Indexes.
  • Live search box and sortable columns.
  • Create database button (top-left) + Refresh next to it, search below.
  • Click a row to drill into the database.

Database drill-in

  • One row per collection: Storage size, Documents, Avg. document
    size
    , Indexes, Total index size.
  • Live search, sortable columns, breadcrumb back-nav to the overview.
  • Create collection button.

Create flows

  • Reuse the existing native AzureWizard commands — the same flows used by
    the tree's right-click Create database / Create collection (native input
    box, name validation, tree refresh). No bespoke webview dialog, so the tree
    and dashboard stay in sync. A pre-flight "not signed in" state surfaces
    inline; wizard-time errors surface natively.

Data layer

  • Reuses ClustersClient (getDatabaseStatsdbStats, getCollectionStats
    collStats). The cheap listDatabases / listCollections calls render
    rows immediately; metrics stream in per row with bounded concurrency
    (METRICS_CONCURRENCY_LIMIT).
  • Metric procedures never fail the whole table: a denied/unsupported stats
    call degrades that row's cells to a "—" placeholder.
  • Results cached in webview state with a manual Refresh button.

Architecture

All UI ↔ backend traffic flows through one file:

src/webviews/documentdb/clusterView/clusterViewRouter.ts

Each procedure is annotated with a BACKEND INTEGRATION POINT block. Procedures:
getClusterInfo, listDatabases, getDatabaseMetrics, listCollections,
getCollectionMetrics, createDatabase, createCollection.

Fixed column widths are applied via Fluent's column-sizing feature so the
database and collection tables stay visually consistent regardless of column
count.

Files changed

File Purpose
src/webviews/documentdb/clusterView/ (new) Dashboard view, table, lists, breadcrumb, router, controller, types, constants, hooks, utils + tests.
src/commands/openClusterView/ (new) Command that opens the dashboard for a cluster.
src/documentdb/ClustersClient.ts getDatabaseStats (dbStats) for db-wide metrics.
src/documentdb/ClustersExtension.ts Registers the openClusterView command.
src/tree/documentdb/ClusterItemBase.ts Opens the dashboard on cluster activation.
src/webviews/_integration/{appRouter,WebviewRegistry}.ts Mounts mongoClusters.clusterView + registers the view.

Verification

  • npm run l10n
  • npm run prettier-fix
  • npm run lint
  • npx jest --no-coverage (2024 passing)
  • npm run build
  • npm run webpack-prod

Adds a cluster overview dashboard that opens from the cluster tree node
instead of the empty editor. Lists databases with storage size,
collection count and index count, drills into a database to list
collections with storage size, document count, average document size,
index count and total index size. Live search, sortable columns, and
create-database / create-collection flows that reuse the existing native
AzureWizard commands (no bespoke webview dialog) so the tree and
dashboard stay in sync.

Built on the existing registry-driven React webview + tRPC router
pattern (Fluent UI v9, VS Code theme tokens); metrics stream in per row
with bounded concurrency and degrade to a placeholder when stats calls
are denied or unsupported.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@khelanmodi khelanmodi requested a review from a team as a code owner June 19, 2026 02:18
Copilot AI review requested due to automatic review settings June 19, 2026 02:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Cluster Overview (dashboard/home) webview that opens when a cluster is activated, replacing the previously empty editor experience. It adds a React/Fluent UI v9 dashboard with database and collection drill-in views, backed by new tRPC procedures and a small backend addition to fetch database-wide stats.

Changes:

  • Added a new clusterView webview (overview + drill-in) with reusable table, sorting/filtering, formatting utilities, and bounded-concurrency metric streaming.
  • Added openClusterView commands and wiring so cluster activation (double-click/context/inline) opens the dashboard.
  • Extended backend integration with a dbStats-based getDatabaseStats method and a dedicated tRPC router for the dashboard’s data + create flows.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/webviews/documentdb/clusterView/utils/sort.ts Generic compare + filter/sort helpers for dashboard tables.
src/webviews/documentdb/clusterView/utils/sort.test.ts Unit tests for sorting/filtering behavior (including undefined-last).
src/webviews/documentdb/clusterView/utils/format.ts Byte/count formatting and metric-cell display helpers.
src/webviews/documentdb/clusterView/utils/format.test.ts Unit tests for formatting helpers.
src/webviews/documentdb/clusterView/types.ts Shared UI types for rows, metrics, sorting, and create results.
src/webviews/documentdb/clusterView/hooks/useBoundedMetrics.ts Hook to stream per-row metrics with bounded concurrency + abort handling.
src/webviews/documentdb/clusterView/constants.ts Shared dashboard constants (column widths, concurrency limit).
src/webviews/documentdb/clusterView/components/DatabaseList.tsx Cluster overview page listing databases with streamed metrics + create/refresh.
src/webviews/documentdb/clusterView/components/DashboardTable.tsx Shared sortable table implementation with column sizing + optional row activation.
src/webviews/documentdb/clusterView/components/CollectionList.tsx Database drill-in page listing collections with streamed metrics + create/refresh.
src/webviews/documentdb/clusterView/components/Breadcrumb.tsx Breadcrumb navigation between overview and drill-in.
src/webviews/documentdb/clusterView/clusterViewRouter.ts tRPC backend integration surface for cluster dashboard (list/metrics/create).
src/webviews/documentdb/clusterView/clusterViewController.ts Webview controller + tRPC context setup for cluster dashboard.
src/webviews/documentdb/clusterView/ClusterView.tsx Top-level React view managing overview vs drill-in page state.
src/webviews/documentdb/clusterView/clusterView.scss Styling for dashboard layout, toolbar, and table visuals.
src/webviews/_integration/WebviewRegistry.ts Registers clusterView React entrypoint in the webview registry.
src/webviews/_integration/appRouter.ts Mounts mongoClusters.clusterView into the app tRPC router.
src/tree/documentdb/ClusterItemBase.ts Updates cluster tree item activation to open the cluster dashboard.
src/documentdb/ClustersExtension.ts Registers clusterView commands (internal + double-click + context + inline).
src/documentdb/ClustersClient.ts Adds getDatabaseStats() wrapper over dbStats for dashboard metrics.
src/commands/openClusterView/openClusterView.ts New command to open cluster dashboard (tree node + internal entrypoint).
package.json Contributes new commands and menus for opening cluster overview (context/inline).
l10n/bundle.l10n.json Adds localized strings used by the new dashboard UI.

Comment on lines +164 to +165
tabIndex={interactive ? 0 : undefined}
role={interactive ? 'button' : undefined}
Comment on lines +173 to +175
{col.showSpinnerWhileLoading && loading ? (
<Spinner size="tiny" aria-label={col.label} />
) : (
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.

2 participants