Skip to content

Commit

Permalink
Merge pull request #2819 from spenceralger/spyFullScreen
Browse files Browse the repository at this point in the history
[visualize/spy] handle fullscreen better and scroll content
  • Loading branch information
simianhacker committed Jan 30, 2015
2 parents 83975ed + 700cd5e commit b9b22c7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/kibana/components/visualize/visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@ define(function (require) {
template: require('text!components/visualize/visualize.html'),
link: function ($scope, $el, attr) {
var chart; // set in "vis" watcher
var $visEl = $el.find('.visualize-chart');
var $spyEl = $el.find('visualize-spy');
var minVisChartHeight = 180;

function getter(selector) {
return function () {
var $sel = $el.find(selector);
if ($sel.size()) return $sel;
};
}

var getVisEl = getter('.visualize-chart');
var getSpyEl = getter('visualize-spy');

$scope.spy = {mode: false};
$scope.fullScreenSpy = false;

var applyClassNames = function () {
var $spyEl = getSpyEl();
var $visEl = getVisEl();
var fullSpy = ($scope.spy.mode && ($scope.spy.mode.fill || $scope.fullScreenSpy));

// external
Expand Down Expand Up @@ -68,6 +78,9 @@ define(function (require) {

$scope.$watch('fullScreenSpy', applyClassNames);
$scope.$watchCollection('spy.mode', function (spyMode, oldSpyMode) {
var $visEl = getVisEl();
if (!$visEl) return;

// if the spy has been opened, check chart height
if (spyMode && !oldSpyMode) {
$scope.fullScreenSpy = $visEl.height() < minVisChartHeight;
Expand All @@ -76,6 +89,9 @@ define(function (require) {
});

$scope.$watch('vis', prereq(function (vis, oldVis) {
var $visEl = getVisEl();
if (!$visEl) return;

if (!attr.editableVis) {
$scope.editableVis = vis;
}
Expand Down
7 changes: 6 additions & 1 deletion src/kibana/components/visualize/visualize.less
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ visualize-spy {
}

.visualize-spy-container {
.flex(1, 0, auto);
.flex(1, 1, auto);

.display(flex);
.flex-direction(column);
Expand All @@ -105,6 +105,11 @@ visualize-spy {
padding: 0 0 15px;
}

header + * {
.flex(1, 1, auto);
overflow: auto;
}

> .alert {
.flex(0, 0, auto);
}
Expand Down

0 comments on commit b9b22c7

Please sign in to comment.