fix panel solo mode (#10002)

pull/10090/head
Alexander Zobnin 8 years ago committed by Torkel Ödegaard
parent 8f4ad1e496
commit b97ad93be1
  1. 1
      public/app/features/dashboard/panel_model.ts
  2. 4
      public/app/features/panel/panel_ctrl.ts
  3. 26
      public/app/features/panel/solo_panel_ctrl.ts

@ -29,6 +29,7 @@ export class PanelModel {
minSpan?: number;
collapsed?: boolean;
panels?: any;
soloMode?: boolean;
// non persisted
fullscreen: boolean;

@ -172,6 +172,10 @@ export class PanelCtrl {
this.containerHeight = this.panel.gridPos.h * GRID_CELL_HEIGHT + ((this.panel.gridPos.h-1) * GRID_CELL_VMARGIN);
}
if (this.panel.soloMode) {
this.containerHeight = $(window).height();
}
this.height = this.containerHeight - (PANEL_BORDER + TITLE_HEIGHT);
}

@ -1,14 +1,9 @@
define([
'angular',
'jquery',
],
function (angular, $) {
"use strict";
import angular from 'angular';
var module = angular.module('grafana.routes');
module.controller('SoloPanelCtrl', function($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
export class SoloPanelCtrl{
/** @ngInject */
constructor($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
var panelId;
$scope.init = function() {
@ -26,26 +21,25 @@ function (angular, $) {
};
$scope.initPanelScope = function() {
var panelInfo = $scope.dashboard.getPanelInfoById(panelId);
let panelInfo = $scope.dashboard.getPanelInfoById(panelId);
// fake row ctrl scope
$scope.ctrl = {
row: panelInfo.row,
dashboard: $scope.dashboard,
};
$scope.ctrl.row.height = $(window).height();
$scope.panel = panelInfo.panel;
$scope.panel.soloMode = true;
$scope.$index = 0;
if (!$scope.panel) {
$scope.appEvent('alert-error', ['Panel not found', '']);
return;
}
$scope.panel.span = 12;
};
$scope.init();
});
});
}
}
angular.module('grafana.routes').controller('SoloPanelCtrl', SoloPanelCtrl);
Loading…
Cancel
Save