fix: annotations fix for snapshots, fixes #7659

This commit is contained in:
Torkel Ödegaard 2017-04-25 14:27:41 +02:00
parent 87c978ebc9
commit c3bad4701a
4 changed files with 12 additions and 4 deletions

View File

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

View File

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

View File

@ -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>

View File

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