Commit 96bd66e8 by Torkel Ödegaard

Made the annotation tags support more cross datasource compatible

parent 494ede5b
...@@ -3,7 +3,7 @@ define([ ...@@ -3,7 +3,7 @@ define([
'jquery', 'jquery',
'lodash' 'lodash'
], ],
function (angular, $) { function (angular, $, _) {
'use strict'; 'use strict';
angular angular
...@@ -23,8 +23,17 @@ function (angular, $) { ...@@ -23,8 +23,17 @@ function (angular, $) {
tooltip += text.replace(/\n/g, '<br>') + '<br>'; tooltip += text.replace(/\n/g, '<br>') + '<br>';
} }
if (event.tags && event.tags.length > 0) { var tags = event.tags;
tooltip += '<span class="label label-tag" ng-repeat="tag in event.tags" tag-color-from-name="tag">{{tag}}</span><br/>'; if (_.isString(event.tags)) {
tags = event.tags.split(',');
if (tags.length === 1) {
tags = event.tags.split(' ');
}
}
if (tags && tags.length) {
scope.tags = tags;
tooltip += '<span class="label label-tag" ng-repeat="tag in tags" tag-color-from-name="tag">{{tag}}</span><br/>';
} }
tooltip += "</div>"; tooltip += "</div>";
......
...@@ -111,19 +111,12 @@ function (angular, _, $, config, kbn, moment) { ...@@ -111,19 +111,12 @@ function (angular, _, $, config, kbn, moment) {
var list = []; var list = [];
for (var i = 0; i < results.data.length; i++) { for (var i = 0; i < results.data.length; i++) {
var e = results.data[i]; var e = results.data[i];
var tags = [];
if (e.tags) {
tags = e.tags.split(',');
if (tags.length === 1) {
tags = e.tags.split(' ');
}
}
list.push({ list.push({
annotation: annotation, annotation: annotation,
time: e.when * 1000, time: e.when * 1000,
title: e.what, title: e.what,
tags: tags, tags: e.tags,
text: e.data text: e.data
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment