added dashboard uid when tracing header in browsermode (#53232)

This commit is contained in:
Leo
2022-08-10 10:36:19 +02:00
committed by GitHub
parent aa484a60c9
commit c4984854b6
8 changed files with 51 additions and 18 deletions

View File

@@ -33,7 +33,13 @@ export function PanelEditorTableView({ width, height, panel, dashboard }: Props)
const timeData = applyPanelTimeOverrides(panel, timeSrv.timeRange());
const sub = panel.events.subscribe(RefreshEvent, () => {
panel.runAllPanelQueries(dashboard.id, dashboard.getTimezone(), timeData, width);
panel.runAllPanelQueries({
dashboardId: dashboard.id,
dashboardUID: dashboard.uid,
dashboardTimezone: dashboard.getTimezone(),
timeData,
width,
});
});
return () => {
sub.unsubscribe();

View File

@@ -318,13 +318,14 @@ export class PanelChrome extends PureComponent<Props, State> {
if (this.state.refreshWhenInView) {
this.setState({ refreshWhenInView: false });
}
panel.runAllPanelQueries(
dashboard.id,
dashboard.getTimezone(),
panel.runAllPanelQueries({
dashboardId: dashboard.id,
dashboardUID: dashboard.uid,
dashboardTimezone: dashboard.getTimezone(),
publicDashboardAccessToken: dashboard.meta.publicDashboardAccessToken,
timeData,
width,
dashboard.meta.publicDashboardAccessToken
);
});
} else {
// The panel should render on refresh as well if it doesn't have a query, like clock panel
this.setState({

View File

@@ -492,6 +492,7 @@ describe('PanelModel', () => {
run: jest.fn(),
});
const dashboardId = 123;
const dashboardUID = 'ggHbN42mk';
const dashboardTimezone = 'browser';
const width = 860;
const timeData = {
@@ -506,7 +507,7 @@ describe('PanelModel', () => {
} as TimeRange,
} as TimeOverrideResult;
model.runAllPanelQueries(dashboardId, dashboardTimezone, timeData, width);
model.runAllPanelQueries({ dashboardId, dashboardUID, dashboardTimezone, timeData, width });
expect(model.getQueryRunner).toBeCalled();
});

View File

@@ -50,6 +50,15 @@ export interface GridPos {
static?: boolean;
}
type RunPanelQueryOptions = {
/** @deprecate */
dashboardId: number;
dashboardUID: string;
dashboardTimezone: string;
timeData: TimeOverrideResult;
width: number;
publicDashboardAccessToken?: string;
};
const notPersistedProperties: { [str: string]: boolean } = {
events: true,
isViewing: true,
@@ -323,18 +332,20 @@ export class PanelModel implements DataConfigSource, IPanelModel {
}
}
runAllPanelQueries(
dashboardId: number,
dashboardTimezone: string,
timeData: TimeOverrideResult,
width: number,
publicDashboardAccessToken?: string
) {
runAllPanelQueries({
dashboardId,
dashboardUID,
dashboardTimezone,
timeData,
width,
publicDashboardAccessToken,
}: RunPanelQueryOptions) {
this.getQueryRunner().run({
datasource: this.datasource,
queries: this.targets,
panelId: this.id,
dashboardId: dashboardId,
dashboardUID: dashboardUID,
publicDashboardAccessToken,
timezone: dashboardTimezone,
timeRange: timeData.timeRange,

View File

@@ -46,7 +46,9 @@ export interface QueryRunnerOptions<
datasource: DataSourceRef | DataSourceApi<TQuery, TOptions> | null;
queries: TQuery[];
panelId?: number;
/** @deprecate */
dashboardId?: number;
dashboardUID?: string;
publicDashboardAccessToken?: string;
timezone: TimeZone;
timeRange: TimeRange;
@@ -203,6 +205,7 @@ export class PanelQueryRunner {
datasource,
panelId,
dashboardId,
dashboardUID,
publicDashboardAccessToken,
timeRange,
timeInfo,
@@ -223,6 +226,7 @@ export class PanelQueryRunner {
timezone,
panelId,
dashboardId,
dashboardUID,
publicDashboardAccessToken,
range: timeRange,
timeInfo,