Skip to content

feat: DH-19890: Pivot Builder plugin#1351

Draft
vbabich wants to merge 29 commits into
deephaven:mainfrom
vbabich:example-table-options-plugin
Draft

feat: DH-19890: Pivot Builder plugin#1351
vbabich wants to merge 29 commits into
deephaven:mainfrom
vbabich:example-table-options-plugin

Conversation

@vbabich

@vbabich vbabich commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new pivot-builder plugin that replaces the built-in
TableOptions "Rollup Rows" and "Aggregations" items with a new "Rollup, Aggregate and Pivot" page.

Changes

  • New plugin plugins/pivot-builder — JS plugin built on the chained
    panel-middleware pattern:
    • PivotBuilderPlugin / index.ts — plugin registration
    • makeCreatePivotTransform — registers the "Rollup, Aggregate and Pivot"
      sidebar item (configPage-backed)
    • CreatePivotPage / PivotConfigSection — the sidebar config UI
    • PivotBuilderMiddleware / PivotBuilderPanelMiddleware /
      createMiddleware — panel/model middleware wiring
    • pivotBuilderModel / makePivotModelTransform — pivot model transform
    • Standard plugin scaffolding (package.json, vite.config.ts, README.md,
      Apache-2.0 LICENSE)
  • plugins/manifest.json — registers the pivot-builder plugin.

Notes

@vbabich vbabich self-assigned this May 21, 2026
@vbabich vbabich requested a review from Copilot June 15, 2026 22:21
@vbabich vbabich changed the title feat: DH-21476: Example table options plugin feat: DH-19890: Pivot Builder plugin Jun 15, 2026

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 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-builder middleware plugin (widget + panel paths) that injects transformTableOptions/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

  • getColumnHeaderCoordinates can currently throw when a header group has no childIndexes. 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.

Comment thread plugins/pivot/src/js/src/IrisGridPivotModel.ts Outdated
Comment thread plugins/pivot/src/js/src/IrisGridPivotMetricCalculator.ts Outdated
Comment thread plugins/pivot-builder/src/js/src/PivotBuilderPanelMiddleware.tsx
Comment thread plugins/pivot-builder/README.md Outdated
Comment thread plugins/pivot-builder/README.md Outdated
Comment thread plugins/pivot-builder/src/js/package.json Outdated
Comment thread plugins/pivot-builder/src/js/src/makeCreatePivotTransform.ts

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

Copilot reviewed 33 out of 34 changed files in this pull request and generated 1 comment.

Comment thread plugins/pivot-builder/src/js/vite.config.ts
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