React panel plugin dashboard interactions


I would need my panel to be able to see what queries the other panels on the dashboard are doing.

With the angular style plugins implementing a MetricsPanelCtrl class, I could interact with the dashboard and other panels in it trough the “dashboard” attribute.

How can I achieve this with react plugins? The panel props do not contain the information I need about the other panels in the dashboard. In a week of searching, I have not found a way to do this with react plugins.

The closest behavior I see is the dashboard datasource, but that is limited to only selecting one panel. Additionally I don’t see a way to dynamically change that panel selection trough my panels code.


Hi , yesterday we figured out a way to use getLegacyAngularInjector to get access to the Angular injector and the dashboard class from React:

import { getLegacyAngularInjector } from ‘@grafana/runtime’;
const injector = getLegacyAngularInjector();
const dashboardSrv = injector.get(‘dashboardSrv’);
const dashboard = dashboardSrv.dashboard;

Hope it helps!