mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
added zoom out global header
This commit is contained in:
parent
5cdbbfa021
commit
63358ede5b
@ -2,5 +2,6 @@ define([
|
|||||||
'./dash',
|
'./dash',
|
||||||
'./dashLoader',
|
'./dashLoader',
|
||||||
'./row',
|
'./row',
|
||||||
'./pulldown'
|
'./pulldown',
|
||||||
|
'./zoom'
|
||||||
], function () {});
|
], function () {});
|
43
src/app/controllers/zoom.js
Normal file
43
src/app/controllers/zoom.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
define([
|
||||||
|
'angular',
|
||||||
|
'app',
|
||||||
|
'underscore'
|
||||||
|
],
|
||||||
|
function (angular, app, _) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var module = angular.module('kibana.controllers');
|
||||||
|
|
||||||
|
module.controller('ZoomCtrl', function($scope, filterSrv) {
|
||||||
|
|
||||||
|
// function $scope.zoom
|
||||||
|
// factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan
|
||||||
|
$scope.zoom = function(factor) {
|
||||||
|
var _range = filterSrv.timeRange('last');
|
||||||
|
var _timespan = (_range.to.valueOf() - _range.from.valueOf());
|
||||||
|
var _center = _range.to.valueOf() - _timespan/2;
|
||||||
|
|
||||||
|
var _to = (_center + (_timespan*factor)/2);
|
||||||
|
var _from = (_center - (_timespan*factor)/2);
|
||||||
|
|
||||||
|
// If we're not already looking into the future, don't.
|
||||||
|
if(_to > Date.now() && _range.to < Date.now()) {
|
||||||
|
var _offset = _to - Date.now();
|
||||||
|
_from = _from - _offset;
|
||||||
|
_to = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(factor > 1) {
|
||||||
|
filterSrv.removeByType('time');
|
||||||
|
}
|
||||||
|
filterSrv.set({
|
||||||
|
type:'time',
|
||||||
|
from:moment.utc(_from).toDate(),
|
||||||
|
to:moment.utc(_to).toDate(),
|
||||||
|
field:"@timestamp"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -51,7 +51,12 @@
|
|||||||
"default"
|
"default"
|
||||||
],
|
],
|
||||||
"type": "graphite",
|
"type": "graphite",
|
||||||
"spyable": true
|
"spyable": true,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"target": "summarize(sum(prod.apps.tradera_site.*.counters.global.request_status.code_404.count), '30s')"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"notice": true
|
"notice": true
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class='small' ng-controller="ZoomCtrl" ng-click='zoom(2)'><i class='icon-zoom-out'></i> Zoom Out</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li ng-repeat="pulldown in dashboard.current.nav" ng-controller="PulldownCtrl" ng-show="pulldown.enable"><kibana-simple-panel type="pulldown.type" ng-cloak></kibana-simple-panel></li>
|
<li ng-repeat="pulldown in dashboard.current.nav" ng-controller="PulldownCtrl" ng-show="pulldown.enable"><kibana-simple-panel type="pulldown.type" ng-cloak></kibana-simple-panel></li>
|
||||||
|
|
||||||
<li><a bs-tooltip="'Goto saved default'" data-placement="bottom" href='#/dashboard'><i class='icon-home'></i></a></li>
|
<li><a bs-tooltip="'Goto saved default'" data-placement="bottom" href='#/dashboard'><i class='icon-home'></i></a></li>
|
||||||
@ -12,7 +16,6 @@
|
|||||||
<i class='icon-folder-open'></i>
|
<i class='icon-folder-open'></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
<ul class="dropdown-menu" style="padding:10px">
|
<ul class="dropdown-menu" style="padding:10px">
|
||||||
<li ng-if='dashboard.current.loader.load_elasticsearch'>
|
<li ng-if='dashboard.current.loader.load_elasticsearch'>
|
||||||
<form class="nomargin">
|
<form class="nomargin">
|
||||||
|
Loading…
Reference in New Issue
Block a user