Commit a5d39cd5 by Torkel Ödegaard

added global dashboard wide hideControls option

parent 63358ede
......@@ -53,8 +53,8 @@ require.config({
},
rq: {
deps: ['setImmediate'],
exports: 'RQ'
deps: ['setImmediate'],
exports: 'RQ'
},
angular: {
......
......@@ -12,8 +12,8 @@ function (_) {
var defaults = {
elasticsearch : "http://"+window.location.hostname+":9200",
panel_names : [],
kibana_index : 'kibana-int',
graphiteUrl : null,
kibana_index : 'kibana-int',
graphiteUrl : null,
default_route : '/dashboard/file/default.json'
};
......
define([
'angular',
'app',
'underscore'
'underscore',
'moment',
],
function (angular, app, _) {
function (angular, app, _, moment) {
'use strict';
var module = angular.module('kibana.controllers');
......@@ -30,6 +31,7 @@ function (angular, app, _) {
if(factor > 1) {
filterSrv.removeByType('time');
}
filterSrv.set({
type:'time',
from:moment.utc(_from).toDate(),
......
......@@ -54,7 +54,7 @@
"spyable": true,
"targets": [
{
"target": "summarize(sum(prod.apps.tradera_site.*.counters.global.request_status.code_404.count), '30s')"
"target": ""
}
]
}
......
......@@ -66,7 +66,7 @@ function ($, RQ, config) {
until: $.plot.formatDate(options.range.to, '%H%:%M_%Y%m%d'),
targets: options.targets,
maxDataPoints: options.maxDataPoints
}
};
var graphiteParameters = build_graphite_options(graphOptions, true);
getGraphiteData(graphiteParameters)
......@@ -76,7 +76,7 @@ function ($, RQ, config) {
.fail(function() {
requestion(null, 'Error in ajax call to graphite');
});
}
};
}
function getGraphiteData(parameters) {
......
......@@ -56,10 +56,6 @@
<i ng-show="!options" class="icon-caret-right"></i><i ng-show="options" class="icon-caret-down"></i> View
</a> |&nbsp
</span>
<span ng-show='panel.zoomlinks && data'>
<!--<a class='small' ng-click='zoom(0.5)'><i class='icon-zoom-in'></i> Zoom In</a>-->
<a class='small' ng-click='zoom(2)'><i class='icon-zoom-out'></i> Zoom Out</a>
</span>
</div>
<form class="form-inline bordered histogram-options" ng-show="options">
<span>
......
......@@ -20,6 +20,7 @@ define([
'moment',
'./timeSeries',
'./graphiteSrv',
'rq',
'jquery.flot',
'jquery.flot.events',
'jquery.flot.selection',
......@@ -28,7 +29,7 @@ define([
'jquery.flot.stack',
'jquery.flot.stackpercent'
],
function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv, RQ) {
'use strict';
......@@ -323,7 +324,7 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
$scope.legend = [];
var data = [];
if(results.length == 0 ) {
if(results.length === 0 ) {
requestion('no data in response from graphite');
}
......@@ -369,34 +370,6 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
$scope.panel.targets.push({target: ''});
};
// 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:$scope.panel.time_field
});
};
$scope.openConfigureModal = function($event) {
$event.preventDefault();
$event.stopPropagation();
......@@ -408,7 +381,7 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
}
setTimeout(function() {
$scope.$emit('render');
$scope.$emit('render');
}, 200);
});
......@@ -460,30 +433,6 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
render_panel(data);
});
var scale = function(series,factor) {
return _.map(series,function(p) {
return [p[0],p[1]*factor];
});
};
var scaleSeconds = function(series,interval) {
return _.map(series,function(p) {
return [p[0],p[1]/kbn.interval_to_seconds(interval)];
});
};
var derivative = function(series) {
return _.map(series, function(p,i) {
var _v;
if(i === 0 || p[1] === null) {
_v = [p[0],null];
} else {
_v = series[i-1][1] === null ? [p[0],null] : [p[0],p[1]-(series[i-1][1])];
}
return _v;
});
};
// Function for rendering panel
function render_panel(data) {
// IE doesn't work without this
......@@ -622,7 +571,7 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
if(_int >= 2628000) {
return "%Y-%m";
}
if(_int >= 86400) {
if(_int >= 10000) {
return "%Y-%m-%d";
}
if(_int >= 60) {
......@@ -633,6 +582,7 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv) {
}
var $tooltip = $('<div>');
elem.bind("plothover", function (event, pos, item) {
var group, value, timestamp;
if (item) {
......
......@@ -121,7 +121,7 @@ function (_, Interval) {
ts.ZeroFilled.prototype._getFlotPairsConnect = function (result, time, i, times) {
result.push([times[i], this._data[times[i]] || 0 ]);
return result;
}
};
/**
* ** called as a reduce stragegy in getFlotPairs() **
......
......@@ -10,14 +10,14 @@
</div>
</nil>
<div class="container-fluid main">
<div class="container-fluid main" ng-class="{'grafana-dashboard-hide-controls': dashboard.current.hideControls}">
<div class="row-fluid">
<div class="row-fluid container" style="margin-top:10px; width:98%">
<div ng-show="fullEditMode" class="modal-backdrop fade in"></div>
<!-- Rows -->
<div class="row-fluid kibana-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.current.rows" ng-style="row_style(row)">
<div class="row-control">
<div class="row-fluid" style="padding:0px;margin:0px;position:relative;">
<div class="row-fluid grafana-row" style="padding:0px;margin:0px;position:relative;">
<div class="row-close span12" ng-show="row.collapse" data-placement="bottom" >
<span class="row-button" bs-modal="'app/partials/roweditor.html'" class="pointer">
......
......@@ -19,6 +19,10 @@
<div class="span1">
<label class="small"> Hints <tip>Show 'Add panel' hints in empty spaces</tip></label><input type="checkbox" ng-model="dashboard.current.panel_hints" ng-checked="dashboard.current.panel_hints" />
</div>
<div class="span2">
<label class="small">Hide controls</label>
<input type="checkbox" ng-model="dashboard.current.hideControls" ng-checked="dashboard.current.hideControls">
</div>
<div class="span3">
<label class="small">Style</label><select class="input-small" ng-model="dashboard.current.style" ng-options="f for f in ['dark','light']"></select>
</div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width">
<title>Grafana</title>
<link rel="stylesheet" href="css/bootstrap.light.min.css" title="Light">
<link rel="stylesheet" href="css/bootstrap.dark.min.css" title="Light">
<link rel="stylesheet" href="css/timepicker.css">
<link rel="stylesheet" href="css/animate.min.css">
<link rel="stylesheet" href="css/normalize.min.css">
......
......@@ -2,3 +2,4 @@
@import "bootswatch.dark.less";
@import "overrides.less";
@import "variables.dark.less";
@import "grafana.less";
\ No newline at end of file
.grafana-dashboard-hide-controls {
padding: 0;
.extra, .grafana-row {
display: none;
}
}
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