mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
QueryData: Handle that response data must be array (#18504)
Fixes #18499
This commit is contained in:
parent
3ccc10f82c
commit
494ac90c69
@ -1,6 +1,5 @@
|
|||||||
// Libraries
|
// Libraries
|
||||||
import isString from 'lodash/isString';
|
import { isArray, isEqual, isString } from 'lodash';
|
||||||
import isEqual from 'lodash/isEqual';
|
|
||||||
|
|
||||||
// Utils & Services
|
// Utils & Services
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
@ -123,6 +122,10 @@ export class PanelQueryState {
|
|||||||
return ds
|
return ds
|
||||||
.query(this.request, this.dataStreamObserver)
|
.query(this.request, this.dataStreamObserver)
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
|
if (!isArray(resp.data)) {
|
||||||
|
throw new Error(`Expected response data to be array, got ${typeof resp.data}.`);
|
||||||
|
}
|
||||||
|
|
||||||
this.request.endTime = Date.now();
|
this.request.endTime = Date.now();
|
||||||
this.executor = null;
|
this.executor = null;
|
||||||
|
|
||||||
@ -349,8 +352,8 @@ function translateToLegacyData(data: DataQueryResponseData) {
|
|||||||
*
|
*
|
||||||
* This is also used by PanelChrome for snapshot support
|
* This is also used by PanelChrome for snapshot support
|
||||||
*/
|
*/
|
||||||
export function getProcessedDataFrames(results?: any[]): DataFrame[] {
|
export function getProcessedDataFrames(results?: DataQueryResponseData[]): DataFrame[] {
|
||||||
if (!results) {
|
if (!isArray(results)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user