Annotations: Fix sql annotation parsing for empty responses (#35367)

* fix sql annotation parsing for empty responses

* fix backend when no data returned

* add back frontend changes

Co-authored-by: Ying WANG <ying.wang@grafana.com>
This commit is contained in:
Marc Bachmann
2021-06-09 15:14:28 +02:00
committed by GitHub
parent bf7301e485
commit 9a5e10e6fb
4 changed files with 30 additions and 20 deletions

View File

@ -37,6 +37,9 @@ export default class ResponseParser {
async transformAnnotationResponse(options: any, data: BackendDataSourceResponse): Promise<AnnotationEvent[]> {
const frames = toDataQueryResponse({ data: data }).data as DataFrame[];
if (!frames || !frames.length) {
return [];
}
const frame = frames[0];
const timeField = frame.fields.find((f) => f.name === 'time');