Skip to content

[FEATURE] Scope TimeSeriesChart annotations to the panel#754

Draft
nicolastakashi wants to merge 1 commit into
perses:mainfrom
nicolastakashi:draft/panel-level-annotations-consumer
Draft

[FEATURE] Scope TimeSeriesChart annotations to the panel#754
nicolastakashi wants to merge 1 commit into
perses:mainfrom
nicolastakashi:draft/panel-level-annotations-consumer

Conversation

@nicolastakashi

Copy link
Copy Markdown

What this does

This makes TimeSeriesChart honor panel-level annotations. TimeSeriesChartPanel now reads annotations through the new usePanelAnnotationsWithData hook, fed the panel's config from props.definition.spec.annotations, instead of the global useAnnotationsWithData.

The effect: a panel can turn dashboard annotations off for itself, and it renders any annotations defined locally on the panel. The conversion (convertAnnotationToTimeSeriesAnnotation) and the chart rendering are untouched, so this is a two-line change to the data source feeding them.

Dependency

This is stacked on two other PRs:

  1. [FEATURE] Add panel-level annotations to the data model spec#61, which adds PanelSpec.Annotations to the data model.
  2. The usePanelAnnotationsWithData hook in perses/shared.

It will not compile until both land and @perses-dev/spec and @perses-dev/dashboards are bumped here.

Testing

The behavior of the hook itself is tested in the perses/shared PR. I have not stood up the full plugins build to compile this in isolation, since it needs the spec, dashboards, and plugin-system packages from the two PRs above. The change is a straight swap of the annotations source, with the same shape flowing into the existing conversion.

Rewire TimeSeriesChartPanel to consume annotations through the new panel-scoped
usePanelAnnotationsWithData hook, fed the panel's annotations config from
props.definition.spec.annotations, instead of the global useAnnotationsWithData.
This makes the panel honor its dashboard-annotation toggle and render its own
panel-local annotation definitions. The conversion and chart rendering are
unchanged.

Depends on perses/spec#61 (data model) and the usePanelAnnotationsWithData hook
in perses/shared.

Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
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.

1 participant