Browse Source

fix: annotations fix for snapshots, fixes #7659

Torkel Ödegaard 8 years ago
parent
commit
c3bad4701a

+ 7 - 0
public/app/features/annotations/annotations_srv.ts

@@ -144,6 +144,13 @@ export class AnnotationsSrv {
   }
 
   translateQueryResult(annotation, results) {
+    // if annotation has snapshotData
+    // make clone and remove it
+    if (annotation.snapshotData) {
+      annotation = angular.copy(annotation);
+      delete annotation.snapshotData;
+    }
+
     for (var item of results) {
       item.source = annotation;
       item.min = item.time;

+ 1 - 1
public/app/features/annotations/event_manager.ts

@@ -58,7 +58,7 @@ export class EventManager {
   }
 
   addFlotEvents(annotations, flotOptions) {
-    if (!this.event || annotations.length === 0) {
+    if (!this.event && annotations.length === 0) {
       return;
     }
 

+ 3 - 3
public/app/features/annotations/partials/editor.html

@@ -65,7 +65,7 @@
 				<h5 class="section-heading">Options</h5>
 					<div class="gf-form-inline">
 						<div class="gf-form">
-							<span class="gf-form-label width-7">Name</span>
+							<span class="gf-form-label width-9">Name</span>
 							<input type="text" class="gf-form-input width-12" ng-model='ctrl.currentAnnotation.name' placeholder="name"></input>
 						</div>
 						<div class="gf-form">
@@ -87,11 +87,11 @@
 															label="Hide toggle"
 															tooltip="Hides the annotation query toggle from showing at the top of the dashboard"
 															checked="ctrl.currentAnnotation.hide"
-															label-class="width-7">
+															label-class="width-9">
 							</gf-form-switch>
 						</div>
 						<div class="gf-form">
-							<label class="gf-form-label width-7">Color</label>
+							<label class="gf-form-label width-9">Color</label>
 							<spectrum-picker class="gf-form-input width-3" ng-model="ctrl.currentAnnotation.iconColor"></spectrum-picker>
 						</div>
 					</div>

+ 1 - 0
public/app/features/dashboard/shareSnapshotCtrl.js

@@ -116,6 +116,7 @@ function (angular, _) {
         return {
           name: annotation.name,
           enable: annotation.enable,
+          iconColor: annotation.iconColor,
           snapshotData: annotation.snapshotData
         };
       }).value();