mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
QueryEditorRow: Only pass error to query editor if panel is not loading (#56350)
This commit is contained in:
parent
97d19830cf
commit
b3087cfcd1
@ -109,6 +109,21 @@ describe('filterPanelDataToQuery', () => {
|
|||||||
const panelDataA = filterPanelDataToQuery(loadingData, 'A');
|
const panelDataA = filterPanelDataToQuery(loadingData, 'A');
|
||||||
expect(panelDataA?.state).toBe(LoadingState.Loading);
|
expect(panelDataA?.state).toBe(LoadingState.Loading);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not set the state to error if the frame is still loading', () => {
|
||||||
|
const loadingData: PanelData = {
|
||||||
|
state: LoadingState.Loading,
|
||||||
|
series: [],
|
||||||
|
error: {
|
||||||
|
refId: 'B',
|
||||||
|
message: 'Error',
|
||||||
|
},
|
||||||
|
timeRange: { from: dateTime(), to: dateTime(), raw: { from: 'now-1d', to: 'now' } },
|
||||||
|
};
|
||||||
|
|
||||||
|
const panelDataA = filterPanelDataToQuery(loadingData, 'A');
|
||||||
|
expect(panelDataA?.state).toBe(LoadingState.Loading);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('frame results with warnings', () => {
|
describe('frame results with warnings', () => {
|
||||||
|
@ -534,8 +534,8 @@ export interface AngularQueryComponentScope<TQuery extends DataQuery> {
|
|||||||
export function filterPanelDataToQuery(data: PanelData, refId: string): PanelData | undefined {
|
export function filterPanelDataToQuery(data: PanelData, refId: string): PanelData | undefined {
|
||||||
const series = data.series.filter((series) => series.refId === refId);
|
const series = data.series.filter((series) => series.refId === refId);
|
||||||
|
|
||||||
// If there was an error with no data, pass it to the QueryEditors
|
// If there was an error with no data and the panel is not in a loading state, pass it to the QueryEditors
|
||||||
if (data.error && !data.series.length) {
|
if (data.state !== LoadingState.Loading && data.error && !data.series.length) {
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
state: LoadingState.Error,
|
state: LoadingState.Error,
|
||||||
|
Loading…
Reference in New Issue
Block a user