grafana/public/app/plugins/datasource/cloudwatch/annotations_query_ctrl.ts
Erik Sundell a35b2ac463
CloudWatch: Annotation Editor rewrite (#20765)
* wip: react rewrite

* Cleanup

* Break out non annontations specific fields

* Cleanup. Make annontations editor a functional component

* Remove redundant classnames

* Add paneldata to props

* Cleanup

* Fix rebase merge problem

* Updates after pr feedback

* Fix conflict with master
2020-01-15 16:38:15 +01:00

32 lines
692 B
TypeScript

import _ from 'lodash';
import { AnnotationQuery } from './types';
export class CloudWatchAnnotationsQueryCtrl {
static templateUrl = 'partials/annotations.editor.html';
annotation: any;
/** @ngInject */
constructor() {
_.defaultsDeep(this.annotation, {
namespace: '',
metricName: '',
expression: '',
dimensions: {},
region: 'default',
id: '',
alias: '',
statistics: ['Average'],
matchExact: true,
prefixMatching: false,
actionPrefix: '',
alarmNamePrefix: '',
});
this.onChange = this.onChange.bind(this);
}
onChange(query: AnnotationQuery) {
Object.assign(this.annotation, query);
}
}