aggregation builder v1#230
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds an initial “Aggregation” UI and supporting API endpoint so users can build MongoDB aggregation pipelines in the Studio UI and preview outputs at each stage (Compass-inspired), addressing the core of issue #189.
Changes:
- Adds a new
aggregationBuilderroute and navbar entries for a new Aggregation tab. - Introduces a new frontend
aggregation-buildercomponent with stage editing, per-stage output previews, and auto-run results. - Adds a backend
Model.aggregateaction and frontend API bindings to execute aggregation pipelines with a server-enforced result limit.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/routes.js | Adds aggregationBuilder route and updates role/route allowlists. |
| frontend/src/navbar/navbar.js | Adds route-name detection for the Aggregation tab active state. |
| frontend/src/navbar/navbar.html | Adds Aggregation tab links (desktop + mobile) gated by hasAccess(). |
| frontend/src/api.js | Adds api.Model.aggregate() for both lambda and non-lambda modes. |
| frontend/src/aggregation-builder/aggregation-builder.js | New aggregation builder component logic (stages, auto-run, per-stage preview queries). |
| frontend/src/aggregation-builder/aggregation-builder.html | New UI layout for stage editor, pipeline JSON preview, and results list. |
| frontend/src/aggregation-builder/aggregation-builder.css | New styles for code/result panels and preview cards. |
| backend/authorize.js | Allows readonly (and other roles) to call Model.aggregate. |
| backend/actions/Model/index.js | Exports the new aggregate action. |
| backend/actions/Model/aggregate.js | Implements server-side aggregation execution with pipeline validation and limit clamping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: 'aggregationBuilder', | ||
| component: 'aggregation-builder', | ||
| meta: { | ||
| authorized: true |
There was a problem hiding this comment.
meta.authorized is set to true for the new aggregationBuilder route, but the global navigation guard in frontend/src/index.js only enforces hasAccess() when to.meta.authorized is falsy. As-is, users can deep-link to #/aggregation-builder even when hasAccess(roles, 'aggregationBuilder') is false (navbar hides it, but the route guard won't redirect). Set meta.authorized: false for this route (or adjust the guard logic) so RBAC is enforced consistently.
| authorized: true | |
| authorized: false |
vkarpov15
left a comment
There was a problem hiding this comment.
- Evaluating for syntax errors on every keystroke is a little aggressive, better to wait until blur or clicking "preview" or "run" to show syntax errors. So you don't get blaring errors when you're typing.
- Pipeline errors hides very valuable screen real estate
- In general, the "Pipeline Stages" panel is too small and difficult to work with. Instead of having a fixed height "Pipeline Stages" panel with "Stage 1" , "Stage 2" etc. subpanels, let's have "Stage 1", "Stage 2", etc. be separate top level panels and then have the result panel always at the bottom. That makes it easier to scroll through.
closes #189