Alexander Zobnin 8 rokov pred
rodič
commit
b97ad93be1

+ 1 - 0
public/app/features/dashboard/panel_model.ts

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

+ 4 - 0
public/app/features/panel/panel_ctrl.ts

@@ -172,6 +172,10 @@ export class PanelCtrl {
       this.containerHeight = this.panel.gridPos.h * GRID_CELL_HEIGHT + ((this.panel.gridPos.h-1) * GRID_CELL_VMARGIN);
       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);
     this.height = this.containerHeight - (PANEL_BORDER + TITLE_HEIGHT);
   }
   }
 
 

+ 10 - 16
public/app/features/panel/solo_panel_ctrl.js → public/app/features/panel/solo_panel_ctrl.ts

@@ -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;
     var panelId;
 
 
     $scope.init = function() {
     $scope.init = function() {
@@ -26,26 +21,25 @@ function (angular, $) {
     };
     };
 
 
     $scope.initPanelScope = function() {
     $scope.initPanelScope = function() {
-      var panelInfo = $scope.dashboard.getPanelInfoById(panelId);
+      let panelInfo = $scope.dashboard.getPanelInfoById(panelId);
 
 
       // fake row ctrl scope
       // fake row ctrl scope
       $scope.ctrl = {
       $scope.ctrl = {
-        row: panelInfo.row,
         dashboard: $scope.dashboard,
         dashboard: $scope.dashboard,
       };
       };
 
 
-      $scope.ctrl.row.height = $(window).height();
       $scope.panel = panelInfo.panel;
       $scope.panel = panelInfo.panel;
+      $scope.panel.soloMode = true;
       $scope.$index = 0;
       $scope.$index = 0;
 
 
       if (!$scope.panel) {
       if (!$scope.panel) {
         $scope.appEvent('alert-error', ['Panel not found', '']);
         $scope.appEvent('alert-error', ['Panel not found', '']);
         return;
         return;
       }
       }
-
-      $scope.panel.span = 12;
     };
     };
 
 
     $scope.init();
     $scope.init();
-  });
-});
+  }
+}
+
+angular.module('grafana.routes').controller('SoloPanelCtrl', SoloPanelCtrl);