Explore: Fix issue when some query errors were not shown (#32212)

* Remove getFirstNonQueryRowSpecificError

* Move some error handling to separate component

* Update public/app/features/explore/ErrorContainer.tsx

Co-authored-by: Giordano Ricci <gio.ricci@grafana.com>

* Add comments

* More explicit expects

* Update tests with proper expects

Co-authored-by: Giordano Ricci <gio.ricci@grafana.com>
This commit is contained in:
Andrej Ocenas
2021-03-23 11:58:09 +01:00
committed by GitHub
parent 7317daf80e
commit 89a178dfb4
9 changed files with 86 additions and 91 deletions

View File

@@ -5,7 +5,6 @@ import { Unsubscribable } from 'rxjs';
import {
CoreApp,
DataQuery,
DataQueryError,
DataQueryRequest,
DataSourceApi,
dateMath,
@@ -422,14 +421,6 @@ export const getValueWithRefId = (value?: any): any => {
return undefined;
};
export const getFirstQueryErrorWithoutRefId = (errors?: DataQueryError[]): DataQueryError | undefined => {
if (!errors) {
return undefined;
}
return errors.filter((error) => (error && error.refId ? false : true))[0];
};
export const getRefIds = (value: any): string[] => {
if (!value) {
return [];
@@ -479,11 +470,6 @@ export function getIntervals(range: TimeRange, lowLimit?: string, resolution?: n
return rangeUtil.calculateInterval(range, resolution, lowLimit);
}
export const getFirstNonQueryRowSpecificError = (queryErrors?: DataQueryError[]): DataQueryError | undefined => {
const refId = getValueWithRefId(queryErrors);
return refId ? undefined : getFirstQueryErrorWithoutRefId(queryErrors);
};
export const copyStringToClipboard = (string: string) => {
const el = document.createElement('textarea');
el.value = string;