From b2507f52317b79fbd32c7d7d8301d2549d8162f4 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Wed, 30 Jun 2021 14:59:53 +0100 Subject: [PATCH] Annotations: Update to match backend api --- public/app/features/annotations/api.ts | 4 ++-- public/app/features/annotations/types.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/public/app/features/annotations/api.ts b/public/app/features/annotations/api.ts index b756628098d..cdbaab32faf 100644 --- a/public/app/features/annotations/api.ts +++ b/public/app/features/annotations/api.ts @@ -15,8 +15,8 @@ export function deleteAnnotation(annotation: AnnotationEvent) { } export async function getAnnotationTags() { - const tags: AnnotationTagsResponse[] = await getBackendSrv().get('/api/annotations/tags'); - return tags.map(({ tag, count }) => ({ + const response: AnnotationTagsResponse = await getBackendSrv().get('/api/annotations/tags'); + return response.result.tags.map(({ tag, count }) => ({ term: tag, count, })); diff --git a/public/app/features/annotations/types.ts b/public/app/features/annotations/types.ts index e1f0e0d1975..e0a53d516e9 100644 --- a/public/app/features/annotations/types.ts +++ b/public/app/features/annotations/types.ts @@ -19,7 +19,7 @@ export interface AnnotationQueryResponse { panelData?: PanelData; } -export interface AnnotationTagsResponse { +export interface AnnotationTag { /** * The tag name */ @@ -29,3 +29,9 @@ export interface AnnotationTagsResponse { */ count: number; } + +export interface AnnotationTagsResponse { + result: { + tags: AnnotationTag[]; + }; +}