mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* migrate influxQL annotations to react and build new annotation editor * use es-lint ignore for any type in migration * changes for PR comments * handle annotation editor on load error without query * correct label for ann editor query * add null coalesce operator and remove comment * fix tooltip
32 lines
777 B
TypeScript
32 lines
777 B
TypeScript
type LegacyAnnotation = {
|
|
query?: string;
|
|
queryType?: string;
|
|
fromAnnotations?: boolean;
|
|
tagsColumn?: string;
|
|
textColumn?: string;
|
|
timeEndColumn?: string;
|
|
titleColumn?: string;
|
|
name?: string;
|
|
};
|
|
|
|
// this becomes the target in the migrated annotations
|
|
const migrateLegacyAnnotation = (json: LegacyAnnotation) => {
|
|
return {
|
|
query: json.query ?? '',
|
|
queryType: 'tags',
|
|
fromAnnotations: true,
|
|
tagsColumn: json.tagsColumn ?? '',
|
|
textColumn: json.textColumn ?? '',
|
|
timeEndColumn: json.timeEndColumn ?? '',
|
|
titleColumn: json.titleColumn ?? '',
|
|
name: json.name ?? '',
|
|
};
|
|
};
|
|
|
|
// eslint-ignore-next-line
|
|
export const prepareAnnotation = (json: any) => {
|
|
json.target = json.target ?? migrateLegacyAnnotation(json);
|
|
|
|
return json;
|
|
};
|