From 3b1c7cc359121e82487ff31bb794d15e4f9b2adf Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 22 Jun 2022 13:05:16 -0700 Subject: [PATCH] Annotations: do not show fields mappings for -- grafana -- datasource (#51256) --- .../annotations/standardAnnotationSupport.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/public/app/features/annotations/standardAnnotationSupport.ts b/public/app/features/annotations/standardAnnotationSupport.ts index 9f1114677bf..8f4904abc7a 100644 --- a/public/app/features/annotations/standardAnnotationSupport.ts +++ b/public/app/features/annotations/standardAnnotationSupport.ts @@ -231,13 +231,21 @@ export function getAnnotationsFromData( // annotation support API needs some work to support less "standard" editors like prometheus and here it is not // polluting public API. +const legacyRunner = [ + 'prometheus', + 'loki', + 'elasticsearch', + 'grafana-opensearch-datasource', // external +]; + /** * Opt out of using the default mapping functionality on frontend. */ export function shouldUseMappingUI(datasource: DataSourceApi): boolean { const { type } = datasource; - return ( - type !== 'prometheus' && type !== 'elasticsearch' && type !== 'loki' && type !== 'grafana-opensearch-datasource' + return !( + type === 'datasource' || // ODD behavior for "-- Grafana --" datasource + legacyRunner.includes(type) ); } @@ -246,7 +254,5 @@ export function shouldUseMappingUI(datasource: DataSourceApi): boolean { */ export function shouldUseLegacyRunner(datasource: DataSourceApi): boolean { const { type } = datasource; - return ( - type === 'prometheus' || type === 'elasticsearch' || type === 'loki' || type === 'grafana-opensearch-datasource' - ); + return legacyRunner.includes(type); }