Annotations: do not show fields mappings for -- grafana -- datasource (#51256)

pull/51288/head
Ryan McKinley 3 years ago committed by GitHub
parent ba00d12c0f
commit 3b1c7cc359
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      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);
}

Loading…
Cancel
Save