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

This commit is contained in:
Torkel Ödegaard 2014-01-24 16:54:18 +01:00
parent 81e9a483bc
commit 58dbb01e76
6 changed files with 986 additions and 231 deletions

View File

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

View File

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

View File

@ -1,6 +1,10 @@
<div class="editor-row">
<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>

View File

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

View File

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

1194
src/vendor/moment.js vendored

File diff suppressed because it is too large Load Diff