Commit 63358ede by Torkel Ödegaard

added zoom out global header

parent 5cdbbfa0
......@@ -2,5 +2,6 @@ define([
'./dash',
'./dashLoader',
'./row',
'./pulldown'
'./pulldown',
'./zoom'
], function () {});
\ No newline at end of file
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"
});
};
});
});
\ No newline at end of file
......@@ -51,7 +51,12 @@
"default"
],
"type": "graphite",
"spyable": true
"spyable": true,
"targets": [
{
"target": "summarize(sum(prod.apps.tradera_site.*.counters.global.request_status.code_404.count), '30s')"
}
]
}
],
"notice": true
......
......@@ -4,6 +4,10 @@
}
</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><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>
</a>
<ul class="dropdown-menu" style="padding:10px">
<li ng-if='dashboard.current.loader.load_elasticsearch'>
<form class="nomargin">
......
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