From 2142323da9fbd623543aa461c357538b269ce86e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 12 Apr 2017 21:07:39 +0300 Subject: [PATCH] graph(create annotation): refactor, AddAnnotationModalCtrl --- .../features/dashboard/addAnnotationModalCtrl.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/public/app/features/dashboard/addAnnotationModalCtrl.ts b/public/app/features/dashboard/addAnnotationModalCtrl.ts index 00fa9d8887b..f691da1c0d0 100644 --- a/public/app/features/dashboard/addAnnotationModalCtrl.ts +++ b/public/app/features/dashboard/addAnnotationModalCtrl.ts @@ -4,12 +4,7 @@ import angular from 'angular'; import moment from 'moment'; export class AddAnnotationModalCtrl { - annotationTimeFormat = 'YYYY-MM-DD HH:mm:ss'; - annotationTimeFrom: any; - annotationTimeTo: any = null; - annotationTitle: string; - annotationTextFrom: string; - annotationTextTo: string; + timeFormat = 'YYYY-MM-DD HH:mm:ss'; annotation: any; graphCtrl: any; @@ -29,21 +24,20 @@ export class AddAnnotationModalCtrl { text: "" }; - this.annotation.time = moment($scope.annotationTimeRange.from).format(this.annotationTimeFormat); + this.annotation.time = moment($scope.annotationTimeRange.from).format(this.timeFormat); if ($scope.annotationTimeRange.to) { - this.annotation.timeTo = moment($scope.annotationTimeRange.to).format(this.annotationTimeFormat); + this.annotation.timeTo = moment($scope.annotationTimeRange.to).format(this.timeFormat); } } addAnnotation() { - this.annotation.time = moment(this.annotation.time, this.annotationTimeFormat).valueOf(); + this.annotation.time = moment(this.annotation.time, this.timeFormat).valueOf(); if (this.annotation.timeTo) { - this.annotation.timeTo = moment(this.annotation.timeTo, this.annotationTimeFormat).valueOf(); + this.annotation.timeTo = moment(this.annotation.timeTo, this.timeFormat).valueOf(); } this.graphCtrl.pushAnnotation(this.annotation) .then(response => { - console.log(response); this.close(); }) .catch(error => {