grafana/public/app/plugins/datasource/influxdb/migrations.ts
Brendan O'Handley 085258c035
Influxdb Datasource: Remove angular dependencies for Influxdb influxql annotations (#52546)
* 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
2022-08-17 13:20:46 -04:00

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;
};