this.element = element} className="panel-height-helper" />
);
}
}
diff --git a/public/app/features/dashboard/dashgrid/PanelLoader.ts b/public/app/features/dashboard/dashgrid/PanelLoader.ts
index 2e9302537af..567043584a5 100644
--- a/public/app/features/dashboard/dashgrid/PanelLoader.ts
+++ b/public/app/features/dashboard/dashgrid/PanelLoader.ts
@@ -12,7 +12,7 @@ export class PanelLoader {
}
load(elem, panel, dashboard): AttachedPanel {
- var template = '
';
+ var template = '
';
var panelScope = this.$rootScope.$new();
panelScope.panel = panel;
panelScope.dashboard = dashboard;
diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts
index a81b8d56faa..b6cae5c7ece 100644
--- a/public/app/features/panel/panel_ctrl.ts
+++ b/public/app/features/panel/panel_ctrl.ts
@@ -5,9 +5,7 @@ import {appEvents, profiler} from 'app/core/core';
import Remarkable from 'remarkable';
import {GRID_CELL_HEIGHT, GRID_CELL_VMARGIN} from 'app/core/constants';
-const TITLE_HEIGHT = 25;
-const EMPTY_TITLE_HEIGHT = 9;
-const PANEL_PADDING = 5;
+const TITLE_HEIGHT = 27;
const PANEL_BORDER = 2;
import {Emitter} from 'app/core/core';
@@ -48,16 +46,24 @@ export class PanelCtrl {
}
$scope.$on("refresh", () => this.refresh());
+ $scope.$on("component-did-mount", () => this.panelDidMount());
+
$scope.$on("$destroy", () => {
this.events.emit('panel-teardown');
this.events.removeAllListeners();
});
+
+ this.calculatePanelHeight();
}
init() {
this.events.on('panel-size-changed', this.onSizeChanged.bind(this));
- this.publishAppEvent('panel-initialized', {scope: this.$scope});
this.events.emit('panel-initialized');
+ this.publishAppEvent('panel-initialized', {scope: this.$scope});
+ }
+
+ panelDidMount() {
+ this.events.emit('component-did-mount');
}
renderingCompleted() {
@@ -166,7 +172,7 @@ export class PanelCtrl {
this.containerHeight = this.panel.gridPos.h * GRID_CELL_HEIGHT + ((this.panel.gridPos.h-1) * GRID_CELL_VMARGIN);
}
- this.height = this.containerHeight - (PANEL_BORDER + PANEL_PADDING + (this.panel.title ? TITLE_HEIGHT : EMPTY_TITLE_HEIGHT));
+ this.height = this.containerHeight - (PANEL_BORDER + TITLE_HEIGHT);
}
render(payload?) {
diff --git a/public/app/features/panel/panel_directive.ts b/public/app/features/panel/panel_directive.ts
index f1ffff2e6d4..2e183e70b4a 100644
--- a/public/app/features/panel/panel_directive.ts
+++ b/public/app/features/panel/panel_directive.ts
@@ -1,7 +1,6 @@
-///
-
import angular from 'angular';
import Drop from 'tether-drop';
+import PerfectScrollbar from 'perfect-scrollbar';
var module = angular.module('grafana.directives');
@@ -62,9 +61,11 @@ module.directive('grafanaPanel', function($rootScope, $document) {
scope: { ctrl: "=" },
link: function(scope, elem) {
var panelContainer = elem.find('.panel-container');
+ var panelContent = elem.find('.panel-content');
var cornerInfoElem = elem.find('.panel-info-corner');
var ctrl = scope.ctrl;
var infoDrop;
+ var panelScrollbar;
// the reason for handling these classes this way is for performance
// limit the watchers on panels etc
@@ -84,11 +85,12 @@ module.directive('grafanaPanel', function($rootScope, $document) {
ctrl.dashboard.setPanelFocus(0);
}
- // set initial height
- if (!ctrl.containerHeight) {
- ctrl.calculatePanelHeight();
- panelContainer.css({minHeight: ctrl.containerHeight});
- lastHeight = ctrl.containerHeight;
+ function panelHeightUpdated() {
+ panelContent.height(ctrl.height);
+ if (panelScrollbar) {
+ panelScrollbar.update();
+ }
+ lastHeight = ctrl.height;
}
// set initial transparency
@@ -97,10 +99,16 @@ module.directive('grafanaPanel', function($rootScope, $document) {
panelContainer.addClass('panel-transparent', true);
}
+ // update scrollbar after mounting
+ ctrl.events.on('component-did-mount', () => {
+ if (ctrl.__proto__.constructor.scrollable) {
+ panelScrollbar = new PerfectScrollbar(panelContent[0]);
+ }
+ });
+
ctrl.events.on('render', () => {
- if (lastHeight !== ctrl.containerHeight) {
- panelContainer.css({minHeight: ctrl.containerHeight});
- lastHeight = ctrl.containerHeight;
+ if (lastHeight !== ctrl.height) {
+ panelHeightUpdated();
}
if (transparentLastState !== ctrl.panel.transparent) {
@@ -181,6 +189,10 @@ module.directive('grafanaPanel', function($rootScope, $document) {
if (infoDrop) {
infoDrop.destroy();
}
+
+ if (panelScrollbar) {
+ panelScrollbar.update();
+ }
});
}
};
@@ -190,11 +202,11 @@ module.directive('panelHelpCorner', function($rootScope) {
return {
restrict: 'E',
template: `
-
-
-
-
-
+
+
+
+
+
`,
link: function(scope, elem) {
}
diff --git a/public/app/features/plugins/partials/ds_edit.html b/public/app/features/plugins/partials/ds_edit.html
index e039fbd83ae..58396e816b3 100644
--- a/public/app/features/plugins/partials/ds_edit.html
+++ b/public/app/features/plugins/partials/ds_edit.html
@@ -1,90 +1,88 @@
-