Commit 37c43199 by Torkel Ödegaard

Fix for annotations hover tooltip and timestamp when timezone set to utc, Fixes #611, #394

parent f22fcc2e
......@@ -272,7 +272,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
format: $scope.panel.renderer === 'png' ? 'png' : 'json',
maxDataPoints: $scope.resolution,
datasource: $scope.panel.datasource,
timezone: $scope.dashboard.timezone
};
$scope.annotationsPromise = annotationsSrv.getAnnotations($scope.filter, $scope.rangeUnparsed, $scope.dashboard);
......
......@@ -11,6 +11,7 @@ define([
var promiseCached;
var annotationPanel;
var list = [];
var timezone;
this.init = function() {
$rootScope.$on('refresh', this.clearCache);
......@@ -31,6 +32,7 @@ define([
return promiseCached;
}
var timezone = dashboard,timezone;
var annotations = _.where(annotationPanel.annotations, { enable: true });
var promises = _.map(annotations, function(annotation) {
......@@ -65,7 +67,12 @@ define([
tooltip += (options.tags || '') + '<br/>';
}
tooltip += '<i>' + moment(options.time).format('YYYY-MM-DD HH:mm:ss') + '</i><br/>';
if (timezone === 'browser') {
tooltip += '<i>' + moment(options.time).format('YYYY-MM-DD HH:mm:ss') + '</i><br/>';
}
else {
tooltip += '<i>' + moment.utc(options.time).format('YYYY-MM-DD HH:mm:ss') + '</i><br/>';
}
if (options.text) {
tooltip += options.text.replace(/\n/g, '<br/>');
......
......@@ -20,7 +20,7 @@ function (angular, $, kbn, _) {
this.title = data.title;
this.tags = data.tags || [];
this.style = data.style || "dark";
this.timezone = data.browser || 'browser';
this.timezone = data.timezone || 'browser';
this.editable = data.editble || true;
this.rows = data.rows || [];
this.pulldowns = data.pulldowns || [];
......
......@@ -27,8 +27,8 @@ function (angular, _, $, config, kbn, moment) {
GraphiteDatasource.prototype.query = function(filterSrv, options) {
try {
var graphOptions = {
from: this.translateTime(options.range.from, options.timezone, 'round-down'),
until: this.translateTime(options.range.to, options.timezone, 'round-up'),
from: this.translateTime(options.range.from, 'round-down'),
until: this.translateTime(options.range.to, 'round-up'),
targets: options.targets,
format: options.format,
maxDataPoints: options.maxDataPoints,
......@@ -125,7 +125,7 @@ function (angular, _, $, config, kbn, moment) {
}
};
GraphiteDatasource.prototype.translateTime = function(date, timezone, rounding) {
GraphiteDatasource.prototype.translateTime = function(date, rounding) {
if (_.isString(date)) {
if (date === 'now') {
return 'now';
......
......@@ -35,18 +35,6 @@ function (Settings) {
// Elasticsearch index for storing dashboards
grafana_index: "grafana-dash",
// timezoneOFfset:
// If you experiance problems with zoom, it is probably caused by timezone diff between
// your browser and the graphite-web application. timezoneOffset setting can be used to have Grafana
// translate absolute time ranges to the graphite-web timezone.
// Example:
// If TIME_ZONE in graphite-web config file local_settings.py is set to America/New_York, then set
// timezoneOffset to "-0500" (for UTC - 5 hours)
// Example:
// If TIME_ZONE is set to UTC, set this to "0000"
//
timezoneOffset: null,
// set to false to disable unsaved changes warning
unsaved_changes_warning: true,
......
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