mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* remove annotation angular dependency and migrate annotations * add nullish coalescing operator * remove annotations angular partial * make annotation queries code and errors more readable * handle the betterer issue with '^ Unexpected any. Specify a different type' at top of file * run precommits * run prettier
24 lines
641 B
TypeScript
24 lines
641 B
TypeScript
import { LegacyAnnotation } from './types';
|
|
|
|
// this becomes the target in the migrated annotations
|
|
const migrateLegacyAnnotation = (json: LegacyAnnotation) => {
|
|
// return the target annotation
|
|
const annotation: LegacyAnnotation = {
|
|
fromAnnotations: true,
|
|
target: json.target ?? '',
|
|
name: json.name ?? '',
|
|
isGlobal: json.isGlobal ?? false,
|
|
};
|
|
|
|
return annotation;
|
|
};
|
|
|
|
// eslint-ignore-next-line
|
|
export const prepareAnnotation = (json: any) => {
|
|
const resultingTarget = json.target && typeof json.target !== 'string' ? json.target : migrateLegacyAnnotation(json);
|
|
|
|
json.target = resultingTarget;
|
|
|
|
return json;
|
|
};
|