Skip to content

feat: Simple / Aggregation / Shell query modes#3

Merged
ByteExceptionM merged 1 commit into
mainfrom
develop
May 7, 2026
Merged

feat: Simple / Aggregation / Shell query modes#3
ByteExceptionM merged 1 commit into
mainfrom
develop

Conversation

@ByteExceptionM
Copy link
Copy Markdown
Owner

Add a three-way mode picker in place of the old redundant db.coll
header so each tab can be driven by one of:

  • Simple — existing filter/sort/projection/limit/export
  • Aggregation — single editor for an EJSON pipeline array, dispatched
    through a new query.aggregate IPC channel + QueryService method
  • Shell — mongosh-flavoured one-liner like
    db.coll.find({…}, {…}).sort({…}).skip(n).limit(n) or
    db.coll.aggregate([…]); parsed in the renderer (new shellParser
    with 12 tests) and dispatched to the existing find / aggregate APIs

The mode picker uses an underline-indicator style flush against the
toolbar body, with Run / Limit / Export on the right of the same bar.
Active collection tab in the TabBar above gets a 2px primary top-border,
font-medium, and a tinted db. prefix so it's clearly distinguishable.

Other UX fixes bundled in:

  • Run morphs into a destructive Cancel (X) while a query is in flight;
    click soft-cancels via queryClient.cancelQueries.
  • Sort and Projection editors share their height — whichever's content
    is taller pushes the other to match (QueryEditor reports its natural
    content height; SimpleBody feeds max() back as both editors' minHeight).
  • Switching tabs no longer re-runs the query: refetchOnMount: false +
    staleTime: Infinity on the active query. Initial open still fetches
    (no cache for that key).
  • Run is always clickable when not loading; bumping a per-tab runEpoch
    on every Run guarantees a fresh fetch even when none of the
    mode-specific params changed.

Add a three-way mode picker in place of the old redundant db.coll
header so each tab can be driven by one of:

- Simple — existing filter/sort/projection/limit/export
- Aggregation — single editor for an EJSON pipeline array, dispatched
  through a new query.aggregate IPC channel + QueryService method
- Shell — mongosh-flavoured one-liner like
  db.coll.find({…}, {…}).sort({…}).skip(n).limit(n) or
  db.coll.aggregate([…]); parsed in the renderer (new shellParser
  with 12 tests) and dispatched to the existing find / aggregate APIs

The mode picker uses an underline-indicator style flush against the
toolbar body, with Run / Limit / Export on the right of the same bar.
Active collection tab in the TabBar above gets a 2px primary top-border,
font-medium, and a tinted db. prefix so it's clearly distinguishable.

Other UX fixes bundled in:

- Run morphs into a destructive Cancel (X) while a query is in flight;
  click soft-cancels via queryClient.cancelQueries.
- Sort and Projection editors share their height — whichever's content
  is taller pushes the other to match (QueryEditor reports its natural
  content height; SimpleBody feeds max() back as both editors' minHeight).
- Switching tabs no longer re-runs the query: refetchOnMount: false +
  staleTime: Infinity on the active query. Initial open still fetches
  (no cache for that key).
- Run is always clickable when not loading; bumping a per-tab runEpoch
  on every Run guarantees a fresh fetch even when none of the
  mode-specific params changed.
@ByteExceptionM ByteExceptionM merged commit 96429f2 into main May 7, 2026
4 checks passed
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