mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PluginExtensions: Expose scopedVars via the context to plugins that extends the dashboard panel menu (#67917)
* Exposes the scoped vars to UI extensions via context. * reverted the interpolation when running a query via the query runner. * adding scoped vars to test.#
This commit is contained in:
parent
94a8d15b29
commit
5605d2f4a5
@ -1,5 +1,6 @@
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
|
||||
import { ScopedVars } from './ScopedVars';
|
||||
import { RawTimeRange, TimeZone } from './time';
|
||||
|
||||
// Plugin Extensions types
|
||||
@ -76,6 +77,7 @@ export type PluginExtensionPanelContext = {
|
||||
timeZone: TimeZone;
|
||||
dashboard: Dashboard;
|
||||
targets: DataQuery[];
|
||||
scopedVars?: ScopedVars;
|
||||
};
|
||||
|
||||
type Dashboard = {
|
||||
|
@ -201,6 +201,12 @@ describe('getPanelMenu()', () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
scopedVars: {
|
||||
a: {
|
||||
text: 'a',
|
||||
value: 'a',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const dashboard = createDashboardModelFixture({
|
||||
@ -238,6 +244,12 @@ describe('getPanelMenu()', () => {
|
||||
uid: '123',
|
||||
title: 'My dashboard',
|
||||
},
|
||||
scopedVars: {
|
||||
a: {
|
||||
text: 'a',
|
||||
value: 'a',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
expect(getPluginExtensions).toBeCalledWith(expect.objectContaining({ context }));
|
||||
|
@ -341,5 +341,6 @@ function createExtensionContext(panel: PanelModel, dashboard: DashboardModel): P
|
||||
tags: Array.from<string>(dashboard.tags),
|
||||
},
|
||||
targets: panel.targets,
|
||||
scopedVars: panel.scopedVars,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user