SceneDataTransformer: support system and URL provided transformations - #1614
SceneDataTransformer: support system and URL provided transformations#1614dprokop wants to merge 32 commits into
Conversation
…rmer
Adds SceneDataTransformer.setSystemTransformations so runtime transformations can
be combined with the user configured ones without replacing them. Entries are
tagged with an origin ('system' for panel provided, 'url' for url provided) and a
position, are replaced per origin so different providers do not clobber each
other, and can be filtered out via the exported isSystemTransformation guard
before persisting or editing. Also fixes variable interpolation dropping the
operator function from object form custom transformers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds `PanelPlugin.setDataTransformations(supplier)`, so a panel can declare the transformations it needs in order to render its data — extracting fields out of a JSON column, reshaping long frames into wide ones — without giving up field overrides or the user's own transformation pipeline. Prepended transformations run before every user transformation and before field overrides, so the fields they produce are matchable by overrides and targetable by the user; appended ones run after all of them. The supplier is handed the query result frames, so it can branch on frame shape or `meta`, and it is evaluated inside the pipeline rather than pushed from a panel render, which keeps it free of a render -> setState -> data -> render loop. They are carried in `SceneDataTransformer.transformations` tagged `origin: 'system'` and filtered out of editors and save models by the `isSystemTransformation` guard, so they are never persisted, never editable, and dashboard JSON is unchanged. The transformations tab shows them as read-only rows badged `System`, and the editors replay the prepended stage so each row is configured against the field shape it will actually receive. Gated behind the `grafana.panelPluginTransformations` feature toggle. No existing panel changes behavior. Requires @grafana/scenes 8.15.0 (grafana/scenes#1614). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ransform state on every call to setSystemTransformations
|
@dprokop I made a few minor changes while working on the grafana implementation and PoCs
Other then that everything looks good, marking as ready for review |
…transformations
…transformations
…ead pull system transformation provider from parent of SceneDataTransformer, e.g. VizPanel
|
Rewritten to check for parents of |
torkelo
left a comment
There was a problem hiding this comment.
Looks good except the duplicate plugin loading in VizPanel and some I think faulty comment changes
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7170dbf. Configure here.

Adds support for system transformations in scenes.
System transformations are currently:
SceneDataTransformerparent (e.g.VizPanel, gated withapplyPluginTransformationsstate flag)state.transformationsgetResolvedSystemTransformationsSceneDataTransformeractivationorigin(i.e.plugin) andposition(prepend,append)Also fixes variable interpolation dropping the
operatorfunction from object-form custom transformers.🤖 Generated with Claude Code
📦 Published PR as canary version:
9.0.0--canary.1614.34603085399.0✨ Test out this PR locally via:
npm install @grafana/scenes@9.0.0--canary.1614.34603085399.0 npm install scenes-app@9.0.0--canary.1614.34603085399.0 npm install @grafana/scenes-react@9.0.0--canary.1614.34603085399.0 # or yarn add @grafana/scenes@9.0.0--canary.1614.34603085399.0 yarn add scenes-app@9.0.0--canary.1614.34603085399.0 yarn add @grafana/scenes-react@9.0.0--canary.1614.34603085399.0