Commit 58dbb01e by Torkel Ödegaard

Added new config setting timezoneOffset, usefull when your graphite server is on…

Added new config setting timezoneOffset, usefull when your graphite server is on a different timezone thant your users browsers. This is not optimal (for example if your users have different timezones) can be improved by finding a way to query the timezone different between browser and graphite server. Or fix so that the &tz graphite parameter works for json, then all absolute filters can use UTC time.  #31
parent 81e9a483
......@@ -4,7 +4,7 @@
"company": "Coding Instinct AB"
},
"name": "grafana",
"version": "1.0.3",
"version": "1.0.4",
"repository": {
"type": "git",
"url": "http://github.com/torkelo/grafana.git"
......
......@@ -17,7 +17,8 @@ function (_, crypto) {
graphiteUrl : "http://"+window.location.hostname+":8080",
panel_names : [],
default_route : '/dashboard/file/default.json',
grafana_index : 'grafana-dash'
grafana_index : 'grafana-dash',
timezoneOffset : null,
};
// This initializes a new hash on purpose, to avoid adding parameters to
......
......@@ -2,6 +2,10 @@
<div class="section">
<h5>Chart Options</h5>
<div class="editor-option">
<label class="small">Time correction</label>
<select ng-model="panel.timezone" class='input-small' ng-options="f for f in ['browser','utc']"></select>
</div>
<div class="editor-option">
<label class="small">Bars</label><input type="checkbox" ng-model="panel.bars" ng-checked="panel.bars" ng-change="render()">
</div>
<div class="editor-option">
......
......@@ -52,7 +52,13 @@ function (angular, _, $, config, kbn) {
date = kbn.parseDate(date);
}
return $.plot.formatDate(date, '%H%:%M_%Y%m%d');
date = moment.utc(date).local();
if (config.timezoneOffset) {
date = date.zone(config.timezoneOffset)
}
return date.format('HH:mm_YYYYMMDD');
};
this.match = function(targets, graphiteTargetStr) {
......
......@@ -20,6 +20,12 @@ function (Settings) {
default_route: '/dashboard/file/default.json',
/**
* If your graphite server has another timezone than you & users browsers specify the offset here
* Example: "-0500" (for UTC - 5 hours)
*/
timezoneOffset: null,
grafana_index: "grafana-dash",
panel_names: [
......
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