mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove deprecated dashboardId from panel query runner (#64786)
This commit is contained in:
parent
d43482a463
commit
39c04a8e36
@ -43,7 +43,7 @@ export class AnnotationChangeEvent extends BusEventWithPayload<Partial<Annotatio
|
|||||||
|
|
||||||
// Loaded the first time a dashboard is loaded (not on every render)
|
// Loaded the first time a dashboard is loaded (not on every render)
|
||||||
export type DashboardLoadedEventPayload<T> = {
|
export type DashboardLoadedEventPayload<T> = {
|
||||||
dashboardId: string;
|
dashboardId: string; // eeep, this should be UID
|
||||||
orgId?: number;
|
orgId?: number;
|
||||||
userId?: number;
|
userId?: number;
|
||||||
grafanaVersion?: string;
|
grafanaVersion?: string;
|
||||||
|
@ -514,8 +514,6 @@ export interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {
|
|||||||
rangeRaw?: RawTimeRange;
|
rangeRaw?: RawTimeRange;
|
||||||
timeInfo?: string; // The query time description (blue text in the upper right)
|
timeInfo?: string; // The query time description (blue text in the upper right)
|
||||||
panelId?: number;
|
panelId?: number;
|
||||||
/** @deprecate */
|
|
||||||
dashboardId?: number;
|
|
||||||
dashboardUID?: string;
|
dashboardUID?: string;
|
||||||
publicDashboardAccessToken?: string;
|
publicDashboardAccessToken?: string;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export interface QueryRunnerOptions {
|
|||||||
datasource: DataSourceRef | DataSourceApi | null;
|
datasource: DataSourceRef | DataSourceApi | null;
|
||||||
queries: DataQuery[];
|
queries: DataQuery[];
|
||||||
panelId?: number;
|
panelId?: number;
|
||||||
dashboardId?: number;
|
dashboardUID?: string;
|
||||||
timezone: TimeZone;
|
timezone: TimeZone;
|
||||||
timeRange: TimeRange;
|
timeRange: TimeRange;
|
||||||
timeInfo?: string; // String description of time range for display
|
timeInfo?: string; // String description of time range for display
|
||||||
|
@ -9,6 +9,7 @@ import { EchoEvent, EchoEventType } from '../services/EchoSrv';
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface DashboardInfo {
|
export interface DashboardInfo {
|
||||||
|
/** @deprecated -- use UID not internal ID */
|
||||||
dashboardId: number;
|
dashboardId: number;
|
||||||
dashboardUid: string;
|
dashboardUid: string;
|
||||||
dashboardName: string;
|
dashboardName: string;
|
||||||
|
@ -140,7 +140,8 @@ func newTestLive(t *testing.T, store db.DB) *live.GrafanaLive {
|
|||||||
func TestDashboardAPIEndpoint(t *testing.T) {
|
func TestDashboardAPIEndpoint(t *testing.T) {
|
||||||
t.Run("Given a dashboard with a parent folder which does not have an ACL", func(t *testing.T) {
|
t.Run("Given a dashboard with a parent folder which does not have an ACL", func(t *testing.T) {
|
||||||
fakeDash := dashboards.NewDashboard("Child dash")
|
fakeDash := dashboards.NewDashboard("Child dash")
|
||||||
fakeDash.ID = 1
|
fakeDash.SetID(1)
|
||||||
|
fakeDash.SetUID("test-uid-one")
|
||||||
fakeDash.FolderID = 1
|
fakeDash.FolderID = 1
|
||||||
fakeDash.HasACL = false
|
fakeDash.HasACL = false
|
||||||
fakeDashboardVersionService := dashvertest.NewDashboardVersionServiceFake()
|
fakeDashboardVersionService := dashvertest.NewDashboardVersionServiceFake()
|
||||||
@ -188,6 +189,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
sc.sqlStore = mockSQLStore
|
sc.sqlStore = mockSQLStore
|
||||||
dash := getDashboardShouldReturn200WithConfig(t, sc, nil, nil, dashboardService, nil)
|
dash := getDashboardShouldReturn200WithConfig(t, sc, nil, nil, dashboardService, nil)
|
||||||
|
|
||||||
|
assert.Equal(t, fakeDash.UID, dash.Dashboard.Get("uid").MustString())
|
||||||
assert.False(t, dash.Meta.CanEdit)
|
assert.False(t, dash.Meta.CanEdit)
|
||||||
assert.False(t, dash.Meta.CanSave)
|
assert.False(t, dash.Meta.CanSave)
|
||||||
assert.False(t, dash.Meta.CanAdmin)
|
assert.False(t, dash.Meta.CanAdmin)
|
||||||
|
@ -14,7 +14,7 @@ export function getQueryOptions<TQuery extends DataQuery>(
|
|||||||
scopedVars: {},
|
scopedVars: {},
|
||||||
timezone: 'browser',
|
timezone: 'browser',
|
||||||
panelId: 1,
|
panelId: 1,
|
||||||
dashboardId: 1,
|
dashboardUID: 'test-uid-1',
|
||||||
interval: '60s',
|
interval: '60s',
|
||||||
intervalMs: 60000,
|
intervalMs: 60000,
|
||||||
maxDataPoints: 500,
|
maxDataPoints: 500,
|
||||||
|
@ -194,7 +194,7 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|||||||
datasource: panel.datasource,
|
datasource: panel.datasource,
|
||||||
queries: panel.targets,
|
queries: panel.targets,
|
||||||
panelId: panel.id,
|
panelId: panel.id,
|
||||||
dashboardId: this.dashboard.id,
|
dashboardUID: this.dashboard.uid,
|
||||||
timezone: this.dashboard.getTimezone(),
|
timezone: this.dashboard.getTimezone(),
|
||||||
timeInfo: this.timeInfo,
|
timeInfo: this.timeInfo,
|
||||||
timeRange: this.range,
|
timeRange: this.range,
|
||||||
|
@ -142,7 +142,6 @@ export function buildQueryTransaction(
|
|||||||
|
|
||||||
const request: DataQueryRequest = {
|
const request: DataQueryRequest = {
|
||||||
app: CoreApp.Explore,
|
app: CoreApp.Explore,
|
||||||
dashboardId: 0,
|
|
||||||
// TODO probably should be taken from preferences but does not seem to be used anyway.
|
// TODO probably should be taken from preferences but does not seem to be used anyway.
|
||||||
timezone: timeZone || DefaultTimeZone,
|
timezone: timeZone || DefaultTimeZone,
|
||||||
startTime: Date.now(),
|
startTime: Date.now(),
|
||||||
|
@ -146,7 +146,6 @@ describe('PanelEditorTableView', () => {
|
|||||||
|
|
||||||
// panel queries should have the updated time range
|
// panel queries should have the updated time range
|
||||||
expect(props.panel.runAllPanelQueries).toHaveBeenNthCalledWith(1, {
|
expect(props.panel.runAllPanelQueries).toHaveBeenNthCalledWith(1, {
|
||||||
dashboardId: props.dashboard.id,
|
|
||||||
dashboardTimezone: '',
|
dashboardTimezone: '',
|
||||||
dashboardUID: props.dashboard.uid,
|
dashboardUID: props.dashboard.uid,
|
||||||
timeData: timeRangeUpdated,
|
timeData: timeRangeUpdated,
|
||||||
@ -167,7 +166,6 @@ describe('PanelEditorTableView', () => {
|
|||||||
|
|
||||||
// panel queries should have the updated time range
|
// panel queries should have the updated time range
|
||||||
expect(props.panel.runAllPanelQueries).toHaveBeenLastCalledWith({
|
expect(props.panel.runAllPanelQueries).toHaveBeenLastCalledWith({
|
||||||
dashboardId: props.dashboard.id,
|
|
||||||
dashboardTimezone: '',
|
dashboardTimezone: '',
|
||||||
dashboardUID: props.dashboard.uid,
|
dashboardUID: props.dashboard.uid,
|
||||||
timeData: timeRangeUpdated2,
|
timeData: timeRangeUpdated2,
|
||||||
|
@ -34,7 +34,6 @@ export function PanelEditorTableView({ width, height, panel, dashboard }: Props)
|
|||||||
const sub = panel.events.subscribe(RefreshEvent, () => {
|
const sub = panel.events.subscribe(RefreshEvent, () => {
|
||||||
const timeData = applyPanelTimeOverrides(panel, timeSrv.timeRange());
|
const timeData = applyPanelTimeOverrides(panel, timeSrv.timeRange());
|
||||||
panel.runAllPanelQueries({
|
panel.runAllPanelQueries({
|
||||||
dashboardId: dashboard.id,
|
|
||||||
dashboardUID: dashboard.uid,
|
dashboardUID: dashboard.uid,
|
||||||
dashboardTimezone: dashboard.getTimezone(),
|
dashboardTimezone: dashboard.getTimezone(),
|
||||||
timeData,
|
timeData,
|
||||||
|
@ -348,7 +348,6 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
|||||||
this.setState({ refreshWhenInView: false });
|
this.setState({ refreshWhenInView: false });
|
||||||
}
|
}
|
||||||
panel.runAllPanelQueries({
|
panel.runAllPanelQueries({
|
||||||
dashboardId: dashboard.id,
|
|
||||||
dashboardUID: dashboard.uid,
|
dashboardUID: dashboard.uid,
|
||||||
dashboardTimezone: dashboard.getTimezone(),
|
dashboardTimezone: dashboard.getTimezone(),
|
||||||
publicDashboardAccessToken: dashboard.meta.publicDashboardAccessToken,
|
publicDashboardAccessToken: dashboard.meta.publicDashboardAccessToken,
|
||||||
|
@ -68,6 +68,7 @@ export interface DashboardLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class DashboardModel implements TimeModel {
|
export class DashboardModel implements TimeModel {
|
||||||
|
/** @deprecated use UID */
|
||||||
id: any;
|
id: any;
|
||||||
// TODO: use propert type and fix all the places where uid is set to null
|
// TODO: use propert type and fix all the places where uid is set to null
|
||||||
uid: any;
|
uid: any;
|
||||||
|
@ -45,8 +45,6 @@ export interface GridPos {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RunPanelQueryOptions = {
|
type RunPanelQueryOptions = {
|
||||||
/** @deprecate */
|
|
||||||
dashboardId: number;
|
|
||||||
dashboardUID: string;
|
dashboardUID: string;
|
||||||
dashboardTimezone: string;
|
dashboardTimezone: string;
|
||||||
timeData: TimeOverrideResult;
|
timeData: TimeOverrideResult;
|
||||||
@ -340,7 +338,6 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runAllPanelQueries({
|
runAllPanelQueries({
|
||||||
dashboardId,
|
|
||||||
dashboardUID,
|
dashboardUID,
|
||||||
dashboardTimezone,
|
dashboardTimezone,
|
||||||
timeData,
|
timeData,
|
||||||
@ -351,7 +348,6 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
datasource: this.datasource,
|
datasource: this.datasource,
|
||||||
queries: this.targets,
|
queries: this.targets,
|
||||||
panelId: this.id,
|
panelId: this.id,
|
||||||
dashboardId: dashboardId,
|
|
||||||
dashboardUID: dashboardUID,
|
dashboardUID: dashboardUID,
|
||||||
publicDashboardAccessToken,
|
publicDashboardAccessToken,
|
||||||
timezone: dashboardTimezone,
|
timezone: dashboardTimezone,
|
||||||
|
@ -4,6 +4,7 @@ import { DashboardModel } from './DashboardModel';
|
|||||||
|
|
||||||
export function emitDashboardViewEvent(dashboard: DashboardModel) {
|
export function emitDashboardViewEvent(dashboard: DashboardModel) {
|
||||||
const eventData: DashboardViewEventPayload = {
|
const eventData: DashboardViewEventPayload = {
|
||||||
|
/** @deprecated */
|
||||||
dashboardId: dashboard.id,
|
dashboardId: dashboard.id,
|
||||||
dashboardName: dashboard.title,
|
dashboardName: dashboard.title,
|
||||||
dashboardUid: dashboard.uid,
|
dashboardUid: dashboard.uid,
|
||||||
|
@ -23,7 +23,6 @@ const makeEmptyQueryResponse = (loadingState: LoadingState) => {
|
|||||||
requestId: '1',
|
requestId: '1',
|
||||||
intervalMs: 0,
|
intervalMs: 0,
|
||||||
interval: '1s',
|
interval: '1s',
|
||||||
dashboardId: 0,
|
|
||||||
panelId: 1,
|
panelId: 1,
|
||||||
range: baseEmptyResponse.timeRange,
|
range: baseEmptyResponse.timeRange,
|
||||||
scopedVars: {
|
scopedVars: {
|
||||||
|
@ -48,8 +48,6 @@ export interface QueryRunnerOptions<
|
|||||||
datasource: DataSourceRef | DataSourceApi<TQuery, TOptions> | null;
|
datasource: DataSourceRef | DataSourceApi<TQuery, TOptions> | null;
|
||||||
queries: TQuery[];
|
queries: TQuery[];
|
||||||
panelId?: number;
|
panelId?: number;
|
||||||
/** @deprecate */
|
|
||||||
dashboardId?: number;
|
|
||||||
dashboardUID?: string;
|
dashboardUID?: string;
|
||||||
publicDashboardAccessToken?: string;
|
publicDashboardAccessToken?: string;
|
||||||
timezone: TimeZone;
|
timezone: TimeZone;
|
||||||
@ -205,7 +203,6 @@ export class PanelQueryRunner {
|
|||||||
timezone,
|
timezone,
|
||||||
datasource,
|
datasource,
|
||||||
panelId,
|
panelId,
|
||||||
dashboardId,
|
|
||||||
dashboardUID,
|
dashboardUID,
|
||||||
publicDashboardAccessToken,
|
publicDashboardAccessToken,
|
||||||
timeRange,
|
timeRange,
|
||||||
@ -228,7 +225,6 @@ export class PanelQueryRunner {
|
|||||||
requestId: getNextRequestId(),
|
requestId: getNextRequestId(),
|
||||||
timezone,
|
timezone,
|
||||||
panelId,
|
panelId,
|
||||||
dashboardId,
|
|
||||||
dashboardUID,
|
dashboardUID,
|
||||||
publicDashboardAccessToken,
|
publicDashboardAccessToken,
|
||||||
range: timeRange,
|
range: timeRange,
|
||||||
|
@ -42,7 +42,7 @@ export class QueryRunner implements QueryRunnerSrv {
|
|||||||
datasource,
|
datasource,
|
||||||
panelId,
|
panelId,
|
||||||
app,
|
app,
|
||||||
dashboardId,
|
dashboardUID,
|
||||||
timeRange,
|
timeRange,
|
||||||
timeInfo,
|
timeInfo,
|
||||||
cacheTimeout,
|
cacheTimeout,
|
||||||
@ -61,7 +61,7 @@ export class QueryRunner implements QueryRunnerSrv {
|
|||||||
requestId: getNextRequestId(),
|
requestId: getNextRequestId(),
|
||||||
timezone,
|
timezone,
|
||||||
panelId,
|
panelId,
|
||||||
dashboardId,
|
dashboardUID,
|
||||||
range: timeRange,
|
range: timeRange,
|
||||||
timeInfo,
|
timeInfo,
|
||||||
interval: '',
|
interval: '',
|
||||||
|
@ -89,7 +89,6 @@ function getTestData(requestApp: string, series: DataFrame[] = []): PanelData {
|
|||||||
return {
|
return {
|
||||||
request: {
|
request: {
|
||||||
app: requestApp,
|
app: requestApp,
|
||||||
dashboardId: 1,
|
|
||||||
panelId: 2,
|
panelId: 2,
|
||||||
startTime: now.unix(),
|
startTime: now.unix(),
|
||||||
endTime: now.add(1, 's').unix(),
|
endTime: now.add(1, 's').unix(),
|
||||||
@ -111,7 +110,6 @@ function getTestDataForExplore(requestApp: string, series: DataFrame[] = []): Pa
|
|||||||
return {
|
return {
|
||||||
request: {
|
request: {
|
||||||
app: requestApp,
|
app: requestApp,
|
||||||
dashboardId: 0,
|
|
||||||
startTime: now.unix(),
|
startTime: now.unix(),
|
||||||
endTime: now.add(1, 's').unix(),
|
endTime: now.add(1, 's').unix(),
|
||||||
} as DataQueryRequest,
|
} as DataQueryRequest,
|
||||||
@ -136,12 +134,11 @@ describe('emitDataRequestEvent - from a dashboard panel', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
eventName: MetaAnalyticsEventName.DataRequest,
|
eventName: MetaAnalyticsEventName.DataRequest,
|
||||||
datasourceName: datasource.name,
|
datasourceName: datasource.name,
|
||||||
datasourceId: datasource.id,
|
|
||||||
datasourceUid: datasource.uid,
|
datasourceUid: datasource.uid,
|
||||||
datasourceType: datasource.type,
|
datasourceType: datasource.type,
|
||||||
source: 'dashboard',
|
source: 'dashboard',
|
||||||
panelId: 2,
|
panelId: 2,
|
||||||
dashboardId: 1,
|
dashboardUid: 'test', // from dashboard srv
|
||||||
dataSize: 0,
|
dataSize: 0,
|
||||||
duration: 1,
|
duration: 1,
|
||||||
totalQueries: 0,
|
totalQueries: 0,
|
||||||
@ -159,12 +156,11 @@ describe('emitDataRequestEvent - from a dashboard panel', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
eventName: MetaAnalyticsEventName.DataRequest,
|
eventName: MetaAnalyticsEventName.DataRequest,
|
||||||
datasourceName: datasource.name,
|
datasourceName: datasource.name,
|
||||||
datasourceId: datasource.id,
|
|
||||||
datasourceUid: datasource.uid,
|
datasourceUid: datasource.uid,
|
||||||
datasourceType: datasource.type,
|
datasourceType: datasource.type,
|
||||||
source: 'dashboard',
|
source: 'dashboard',
|
||||||
panelId: 2,
|
panelId: 2,
|
||||||
dashboardId: 1,
|
dashboardUid: 'test',
|
||||||
dataSize: 2,
|
dataSize: 2,
|
||||||
duration: 1,
|
duration: 1,
|
||||||
totalQueries: 2,
|
totalQueries: 2,
|
||||||
@ -182,12 +178,11 @@ describe('emitDataRequestEvent - from a dashboard panel', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
eventName: MetaAnalyticsEventName.DataRequest,
|
eventName: MetaAnalyticsEventName.DataRequest,
|
||||||
datasourceName: datasource.name,
|
datasourceName: datasource.name,
|
||||||
datasourceId: datasource.id,
|
|
||||||
datasourceUid: datasource.uid,
|
datasourceUid: datasource.uid,
|
||||||
datasourceType: datasource.type,
|
datasourceType: datasource.type,
|
||||||
source: 'dashboard',
|
source: 'dashboard',
|
||||||
panelId: 2,
|
panelId: 2,
|
||||||
dashboardId: 1,
|
dashboardUid: 'test', // from dashboard srv
|
||||||
dataSize: 2,
|
dataSize: 2,
|
||||||
duration: 1,
|
duration: 1,
|
||||||
totalQueries: 1,
|
totalQueries: 1,
|
||||||
@ -227,7 +222,6 @@ describe('emitDataRequestEvent - from Explore', () => {
|
|||||||
eventName: MetaAnalyticsEventName.DataRequest,
|
eventName: MetaAnalyticsEventName.DataRequest,
|
||||||
source: 'explore',
|
source: 'explore',
|
||||||
datasourceName: 'test',
|
datasourceName: 'test',
|
||||||
datasourceId: 1,
|
|
||||||
datasourceUid: 'test',
|
datasourceUid: 'test',
|
||||||
dataSize: 0,
|
dataSize: 0,
|
||||||
duration: 1,
|
duration: 1,
|
||||||
|
@ -66,7 +66,6 @@ export function emitDataRequestEvent(datasource: DataSourceApi) {
|
|||||||
const cachedQueries = Object.values(queryCacheStatus).filter((val) => val === true).length;
|
const cachedQueries = Object.values(queryCacheStatus).filter((val) => val === true).length;
|
||||||
|
|
||||||
eventData.panelId = data.request!.panelId;
|
eventData.panelId = data.request!.panelId;
|
||||||
eventData.dashboardId = data.request!.dashboardId;
|
|
||||||
eventData.totalQueries = totalQueries;
|
eventData.totalQueries = totalQueries;
|
||||||
eventData.cachedQueries = cachedQueries;
|
eventData.cachedQueries = cachedQueries;
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ export default function createMockPanelData(overrides?: DeepPartial<PanelData>)
|
|||||||
requestId: 'request',
|
requestId: 'request',
|
||||||
timezone: 'browser',
|
timezone: 'browser',
|
||||||
panelId: 1,
|
panelId: 1,
|
||||||
dashboardId: 0,
|
|
||||||
timeInfo: '',
|
timeInfo: '',
|
||||||
interval: '20s',
|
interval: '20s',
|
||||||
intervalMs: 20000,
|
intervalMs: 20000,
|
||||||
|
@ -1204,7 +1204,6 @@ describe('addAdhocFilters', () => {
|
|||||||
const createElasticQuery = (): DataQueryRequest<ElasticsearchQuery> => {
|
const createElasticQuery = (): DataQueryRequest<ElasticsearchQuery> => {
|
||||||
return {
|
return {
|
||||||
requestId: '',
|
requestId: '',
|
||||||
dashboardId: 0,
|
|
||||||
interval: '',
|
interval: '',
|
||||||
panelId: 0,
|
panelId: 0,
|
||||||
intervalMs: 1,
|
intervalMs: 1,
|
||||||
|
@ -194,7 +194,6 @@ const defaultSettings: DataSourceInstanceSettings<JaegerJsonData> = {
|
|||||||
|
|
||||||
const defaultQuery: DataQueryRequest<JaegerQuery> = {
|
const defaultQuery: DataQueryRequest<JaegerQuery> = {
|
||||||
requestId: '1',
|
requestId: '1',
|
||||||
dashboardId: 0,
|
|
||||||
interval: '0',
|
interval: '0',
|
||||||
intervalMs: 10,
|
intervalMs: 10,
|
||||||
panelId: 0,
|
panelId: 0,
|
||||||
|
@ -352,7 +352,6 @@ const defaultSettings: DataSourceInstanceSettings<JaegerJsonData> = {
|
|||||||
|
|
||||||
const defaultQuery: DataQueryRequest<JaegerQuery> = {
|
const defaultQuery: DataQueryRequest<JaegerQuery> = {
|
||||||
requestId: '1',
|
requestId: '1',
|
||||||
dashboardId: 0,
|
|
||||||
interval: '0',
|
interval: '0',
|
||||||
intervalMs: 10,
|
intervalMs: 10,
|
||||||
panelId: 0,
|
panelId: 0,
|
||||||
|
@ -187,7 +187,6 @@ describe('opentsdb', () => {
|
|||||||
requestId: 'Q103',
|
requestId: 'Q103',
|
||||||
timezone: 'browser',
|
timezone: 'browser',
|
||||||
panelId: 2,
|
panelId: 2,
|
||||||
dashboardId: 189,
|
|
||||||
dashboardUID: 'tyzmfPIVz',
|
dashboardUID: 'tyzmfPIVz',
|
||||||
publicDashboardAccessToken: '',
|
publicDashboardAccessToken: '',
|
||||||
range: {
|
range: {
|
||||||
|
@ -2008,7 +2008,7 @@ describe('PrometheusDatasource for POST', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('When querying prometheus via check headers X-Dashboard-Id X-Panel-Id and X-Dashboard-UID', () => {
|
describe('When querying prometheus via check headers X-Dashboard-Id X-Panel-Id and X-Dashboard-UID', () => {
|
||||||
const options = { dashboardId: 1, panelId: 2, dashboardUID: 'WFlOM-jM1' } as DataQueryRequest<PromQuery>;
|
const options = { panelId: 2, dashboardUID: 'WFlOM-jM1' } as DataQueryRequest<PromQuery>;
|
||||||
const httpOptions = {
|
const httpOptions = {
|
||||||
headers: {} as { [key: string]: number | undefined },
|
headers: {} as { [key: string]: number | undefined },
|
||||||
} as PromQueryRequest;
|
} as PromQueryRequest;
|
||||||
@ -2032,7 +2032,6 @@ describe('PrometheusDatasource for POST', () => {
|
|||||||
|
|
||||||
it('with proxy access tracing headers should be added', () => {
|
it('with proxy access tracing headers should be added', () => {
|
||||||
ds._addTracingHeaders(httpOptions, options);
|
ds._addTracingHeaders(httpOptions, options);
|
||||||
expect(httpOptions.headers['X-Dashboard-Id']).toBe(options.dashboardId);
|
|
||||||
expect(httpOptions.headers['X-Panel-Id']).toBe(options.panelId);
|
expect(httpOptions.headers['X-Panel-Id']).toBe(options.panelId);
|
||||||
expect(httpOptions.headers['X-Dashboard-UID']).toBe(options.dashboardUID);
|
expect(httpOptions.headers['X-Dashboard-UID']).toBe(options.dashboardUID);
|
||||||
});
|
});
|
||||||
|
@ -195,7 +195,6 @@ export class PrometheusDatasource
|
|||||||
_addTracingHeaders(httpOptions: PromQueryRequest, options: DataQueryRequest<PromQuery>) {
|
_addTracingHeaders(httpOptions: PromQueryRequest, options: DataQueryRequest<PromQuery>) {
|
||||||
httpOptions.headers = {};
|
httpOptions.headers = {};
|
||||||
if (this.access === 'proxy') {
|
if (this.access === 'proxy') {
|
||||||
httpOptions.headers['X-Dashboard-Id'] = options.dashboardId;
|
|
||||||
httpOptions.headers['X-Dashboard-UID'] = options.dashboardUID;
|
httpOptions.headers['X-Dashboard-UID'] = options.dashboardUID;
|
||||||
httpOptions.headers['X-Panel-Id'] = options.panelId;
|
httpOptions.headers['X-Panel-Id'] = options.panelId;
|
||||||
}
|
}
|
||||||
@ -1058,7 +1057,6 @@ export class PrometheusDatasource
|
|||||||
targets: [{ refId: 'test', expr: '1+1', instant: true }],
|
targets: [{ refId: 'test', expr: '1+1', instant: true }],
|
||||||
requestId: `${this.id}-health`,
|
requestId: `${this.id}-health`,
|
||||||
scopedVars: {},
|
scopedVars: {},
|
||||||
dashboardId: 0,
|
|
||||||
panelId: 0,
|
panelId: 0,
|
||||||
interval: '1m',
|
interval: '1m',
|
||||||
intervalMs: 60000,
|
intervalMs: 60000,
|
||||||
|
@ -14,7 +14,7 @@ export function getQueryOptions<TQuery extends DataQuery>(
|
|||||||
scopedVars: {},
|
scopedVars: {},
|
||||||
timezone: 'browser',
|
timezone: 'browser',
|
||||||
panelId: 1,
|
panelId: 1,
|
||||||
dashboardId: 1,
|
dashboardUID: 'test-uid-1',
|
||||||
interval: '60s',
|
interval: '60s',
|
||||||
intervalMs: 60000,
|
intervalMs: 60000,
|
||||||
maxDataPoints: 500,
|
maxDataPoints: 500,
|
||||||
|
Loading…
Reference in New Issue
Block a user