mirror of
https://github.com/grafana/grafana.git
synced 2025-01-18 20:43:26 -06:00
37 lines
987 B
Plaintext
37 lines
987 B
Plaintext
define([
|
|
'angular',
|
|
'lodash'
|
|
],
|
|
function (angular) {
|
|
'use strict';
|
|
|
|
angular
|
|
.module('grafana.directives')
|
|
.directive('annotationTooltip', function($sanitize, dashboardSrv) {
|
|
return {
|
|
scope: { tagColorFromName: "=" },
|
|
link: function (scope, element) {
|
|
var title = $sanitize(scope.annoation.title);
|
|
var dashboard = dashboardSrv.getCurrent();
|
|
var time = '<i>' + dashboard.formatDate(scope.annotation.time) + '</i>';
|
|
|
|
var tooltip = '<div class="graph-tooltip small"><div class="graph-tooltip-time">'+ title + ' ' + time + '</div> ' ;
|
|
|
|
if (options.tags) {
|
|
var tags = $sanitize(options.tags);
|
|
tooltip += '<span class="label label-tag" tag-color-from-name="\'asd\'">' + (tags || '') + '</span><br/>';
|
|
}
|
|
|
|
if (options.text) {
|
|
var text = $sanitize(options.text);
|
|
tooltip += text.replace(/\n/g, '<br/>');
|
|
}
|
|
|
|
tooltip += "</small>";
|
|
}
|
|
};
|
|
});
|
|
|
|
});
|
|
|