2021-04-21 08:38:00 +01:00
|
|
|
import { defaultsDeep } from 'lodash';
|
2020-01-15 16:38:15 +01:00
|
|
|
import { AnnotationQuery } from './types';
|
|
|
|
|
|
|
|
|
|
export class CloudWatchAnnotationsQueryCtrl {
|
|
|
|
|
static templateUrl = 'partials/annotations.editor.html';
|
2021-04-13 13:16:56 +02:00
|
|
|
declare annotation: any;
|
2020-01-15 16:38:15 +01:00
|
|
|
|
|
|
|
|
/** @ngInject */
|
2021-04-13 13:16:56 +02:00
|
|
|
constructor($scope: any) {
|
|
|
|
|
this.annotation = $scope.ctrl.annotation;
|
|
|
|
|
|
2021-04-21 08:38:00 +01:00
|
|
|
defaultsDeep(this.annotation, {
|
2020-01-15 16:38:15 +01:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|