feat: DH-19890: Pivot Builder plugin#1351
Draft
vbabich wants to merge 29 commits into
Draft
Conversation
…le Options sidebar
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new pivot-builder middleware plugin that customizes the IrisGrid Table Options menu to provide a unified “Rollup, Aggregate and Pivot” configuration page, and also includes several robustness fixes in the existing pivot plugin (column naming for null keys and transient render/model mismatch handling).
Changes:
- Add a new
@deephaven/js-plugin-pivot-buildermiddleware plugin (widget + panel paths) that injectstransformTableOptions/transformModel, persists config, and drives pivot/rollup/totals via an augmented host proxy model. - Fix pivot generated column/group naming to distinguish “real null” keys from rollup/total placeholders; add regression test.
- Harden pivot rendering/metrics/model code against transient host/model mismatches and potential infinite loops during header-group iteration.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/pivot/src/js/src/PivotUtils.ts | Encode real null pivot keys with a reserved token and adjust column/group naming logic. |
| plugins/pivot/src/js/src/PivotUtils.test.ts | Add regression coverage ensuring real null keys don’t collide with rollup placeholders. |
| plugins/pivot/src/js/src/IrisGridPivotRenderer.ts | Avoid throwing on transient model mismatch and prevent non-progressing header-group loops. |
| plugins/pivot/src/js/src/IrisGridPivotModel.ts | Add additional guards for transient out-of-sync states (and includes temporary DIAG instrumentation). |
| plugins/pivot/src/js/src/IrisGridPivotMetricCalculator.ts | Add non-pivot fallback metrics path (and includes temporary DIAG instrumentation). |
| plugins/pivot/src/js/src/index.ts | Re-export pivot model/util/hooks for downstream plugin consumption. |
| plugins/pivot-builder/src/js/vite.config.ts | New Vite library build config for the pivot-builder plugin bundle. |
| plugins/pivot-builder/src/js/src/tableOptionsTypes.ts | Local “Table Options” contract types until upstream typings are available. |
| plugins/pivot-builder/src/js/src/PivotServiceContext.ts | Context to expose worker PivotService availability to the sidebar page. |
| plugins/pivot-builder/src/js/src/PivotBuilderPlugin.ts | Register the pivot-builder middleware plugin (widget + panel). |
| plugins/pivot-builder/src/js/src/PivotBuilderPanelMiddleware.tsx | Panel-path chained middleware: inject transforms, probe PSP availability, persist config. |
| plugins/pivot-builder/src/js/src/pivotBuilderModel.ts | Core proxy augmentation + atomic apply method for pivot/rollup/totals orchestration. |
| plugins/pivot-builder/src/js/src/PivotBuilderMiddleware.tsx | Widget-path chained middleware wiring for transforms and pivot-only view overrides. |
| plugins/pivot-builder/src/js/src/modelTypes.ts | Local model-transform/view-props typings until upstream packages publish them. |
| plugins/pivot-builder/src/js/src/makePivotModelTransform.ts | Build a stable model transform that augments the host proxy and hydrates persisted config. |
| plugins/pivot-builder/src/js/src/makeCreatePivotTransform.ts | Table Options transform that hides built-ins and appends the Create/Edit Pivot entry. |
| plugins/pivot-builder/src/js/src/index.ts | Public entry point exports for pivot-builder plugin and utilities. |
| plugins/pivot-builder/src/js/src/CreatePivotPage.tsx | Sidebar configuration page; reconciles UI state into applyPivotBuilderConfig. |
| plugins/pivot-builder/src/js/src/createPivotItemType.ts | Stable namespaced item type key for the contributed Table Options entry. |
| plugins/pivot-builder/src/js/src/createMiddleware.tsx | Vendored middleware helper factories until upstream @deephaven/plugin exports exist. |
| plugins/pivot-builder/src/js/package.json | New npm package definition for @deephaven/js-plugin-pivot-builder. |
| plugins/pivot-builder/src/js/.gitignore | Ignore build output and local install artifacts. |
| plugins/pivot-builder/README.md | Plugin README (currently needs updates to match the new chained implementation). |
| plugins/pivot-builder/LICENSE | Apache 2.0 license file for the new plugin. |
| plugins/manifest.json | Register pivot-builder plugin and add package metadata for pivot. |
| plans/DH-21476-pivot-builder-sort-filter-hydration.md | Design/notes for hydration behavior across pivot-builder transitions. |
| plans/DH-21476-pivot-builder-rollup-rows-wiring.md | Design/notes for rollup rows wiring phase. |
| plans/DH-21476-pivot-builder-plugin.md | Design/notes for pivot-builder plugin scope and approach. |
| plans/DH-21476-pivot-builder-pivot-columns-wiring.md | Design/notes for pivot columns wiring phase. |
| plans/DH-21476-pivot-builder-config-ui.md | Design/notes for the card-based config UI. |
| plans/DH-21476-pivot-builder-architecture-recommendations.md | Architecture recommendations for extending IrisGrid and pivot-builder. |
| plans/DH-21476-pivot-builder-aggregate-values-wiring.md | Design/notes for aggregate values wiring phase. |
Comments suppressed due to low confidence (1)
plugins/pivot/src/js/src/IrisGridPivotMetricCalculator.ts:96
getColumnHeaderCoordinatescan currently throw when a header group has nochildIndexes. Other changes in this PR acknowledge that transient out-of-sync states can produce groups with no children; throwing here will crash rendering instead of gracefully skipping that group for the frame.
const firstChildIndex = childIndexes[0];
const lastChildIndex = childIndexes[childIndexes.length - 1];
if (firstChildIndex == null || lastChildIndex == null) {
throw new Error('Group has no child columns');
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
pivot-builderplugin that replaces the built-inTableOptions "Rollup Rows" and "Aggregations" items with a new "Rollup, Aggregate and Pivot" page.
Changes
plugins/pivot-builder— JS plugin built on the chainedpanel-middleware pattern:
PivotBuilderPlugin/index.ts— plugin registrationmakeCreatePivotTransform— registers the "Rollup, Aggregate and Pivot"sidebar item (
configPage-backed)CreatePivotPage/PivotConfigSection— the sidebar config UIPivotBuilderMiddleware/PivotBuilderPanelMiddleware/createMiddleware— panel/model middleware wiringpivotBuilderModel/makePivotModelTransform— pivot model transformpackage.json,vite.config.ts,README.md,Apache-2.0
LICENSE)plugins/manifest.json— registers thepivot-builderplugin.Notes