Type DataFrame in panel with panel's custom options #53938
Labels
area/schema
Related to canonical Grafana entity schemas
mob-friendly
A good issue to be worked on by mob
prio/future
Used by the dashboards squad to prioritise their backlog
team/grafana-dashboards
Dashboards squad
Panel plugins define custom options for controlling the panel's behaviour. We specify these schemas with cue, and generate typescript interfaces from them.
At the moment, panel components use the
PanelProps<PanelOptions>
interface, which types the options property via the generic, but panel options can also be present in the DataFrames (because field overrides can set different options per frame/series/field). We should update the type of theDataFrame
to accept aTOptions
generic to type this as well.This is useful because at the moment panels must use type assertions to change the type to their specific panel options https://github.com/grafana/grafana/blob/a87c6853453c51b3c5e1159b94d44f60dc97e81a/public/app/plugins/panel/heatmap/utils.ts/#L260-L261
I'm not 100% certain on the best way to do this, but we could rely on codegen as much as possible to reduce the chance for inconsistency between plugins. I'm also not sure what level of change we need above plugins, when we generate overrides and pass them to plugins.
Possible tasks:
TOptions
more specific than justany
inFieldConfig
. Perhapsunknown
, orRecord<string, unknown>
.DataFrame
to accept generic type argument to pass through toFieldConfig
.DataFrame
>Field
>FieldConfig
Going further:
The text was updated successfully, but these errors were encountered: