mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat: new grid fixes
This commit is contained in:
@@ -169,21 +169,15 @@ export class PanelCtrl {
|
||||
}
|
||||
|
||||
calculatePanelHeight() {
|
||||
// if (this.fullscreen) {
|
||||
// var docHeight = $(window).height();
|
||||
// var editHeight = Math.floor(docHeight * 0.4);
|
||||
// var fullscreenHeight = Math.floor(docHeight * 0.8);
|
||||
// this.containerHeight = this.editMode ? editHeight : fullscreenHeight;
|
||||
// } else {
|
||||
// this.containerHeight = this.panel.height || this.row.height;
|
||||
// if (_.isString(this.containerHeight)) {
|
||||
// this.containerHeight = parseInt(this.containerHeight.replace('px', ''), 10);
|
||||
// }
|
||||
// }
|
||||
if (this.panel.id === 4) {
|
||||
console.log(this.panel.id, this.panel.height);
|
||||
if (this.fullscreen) {
|
||||
var docHeight = $(window).height();
|
||||
var editHeight = Math.floor(docHeight * 0.4);
|
||||
var fullscreenHeight = Math.floor(docHeight * 0.8);
|
||||
this.containerHeight = this.editMode ? editHeight : fullscreenHeight;
|
||||
} else {
|
||||
this.containerHeight = this.panel.height * CELL_HEIGHT + ((this.panel.height-1) * CELL_VMARGIN);
|
||||
}
|
||||
this.containerHeight = this.panel.height * CELL_HEIGHT + ((this.panel.height-1) * CELL_VMARGIN);
|
||||
|
||||
this.height = this.containerHeight - (PANEL_BORDER + PANEL_PADDING + (this.panel.title ? TITLE_HEIGHT : EMPTY_TITLE_HEIGHT));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ var panelTemplate = `
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
</span>
|
||||
|
||||
<panel-header class="panel-title-container drag-handle" panel-ctrl="ctrl"></panel-header>
|
||||
<panel-header class="panel-title-container" panel-ctrl="ctrl"></panel-header>
|
||||
</div>
|
||||
|
||||
<div class="panel-content">
|
||||
@@ -134,14 +134,6 @@ module.directive('grafanaPanel', function($rootScope, $document) {
|
||||
}
|
||||
});
|
||||
|
||||
var lastFullscreen;
|
||||
$rootScope.onAppEvent('panel-change-view', function(evt, payload) {
|
||||
if (lastFullscreen !== ctrl.fullscreen) {
|
||||
elem.toggleClass('panel-fullscreen', ctrl.fullscreen ? true : false);
|
||||
lastFullscreen = ctrl.fullscreen;
|
||||
}
|
||||
}, scope);
|
||||
|
||||
function updatePanelCornerInfo() {
|
||||
var cornerMode = ctrl.getInfoMode();
|
||||
cornerInfoElem[0].className = 'panel-info-corner panel-info-corner--' + cornerMode;
|
||||
|
||||
@@ -5,9 +5,9 @@ import angular from 'angular';
|
||||
import {coreModule} from 'app/core/core';
|
||||
|
||||
var template = `
|
||||
<span class="panel-title drag-handle">
|
||||
<span class="panel-title">
|
||||
<span class="icon-gf panel-alert-icon"></span>
|
||||
<span class="panel-title-text drag-handle">{{ctrl.panel.title | interpolateTemplateVars:this}}</span>
|
||||
<span class="panel-title-text">{{ctrl.panel.title | interpolateTemplateVars:this}}</span>
|
||||
<span class="panel-menu-container dropdown">
|
||||
<span class="fa fa-caret-down panel-menu-toggle" data-toggle="dropdown"></span>
|
||||
<ul class="dropdown-menu dropdown-menu--menu panel-menu" role="menu">
|
||||
@@ -92,6 +92,12 @@ function panelHeader($compile) {
|
||||
elem.click(function(evt) {
|
||||
const targetClass = evt.target.className;
|
||||
|
||||
console.log(elem.closest('.ui-draggable-dragging'));
|
||||
// ignore click if we are dragging
|
||||
if (elem.closest('.ui-draggable-dragging').length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove existing scope
|
||||
if (menuScope) {
|
||||
menuScope.$destroy();
|
||||
@@ -99,11 +105,10 @@ function panelHeader($compile) {
|
||||
|
||||
menuScope = scope.$new();
|
||||
let menuHtml = createMenuTemplate(scope.ctrl);
|
||||
console.log(menuHtml);
|
||||
menuElem.html(menuHtml);
|
||||
$compile(menuElem)(menuScope);
|
||||
|
||||
if (targetClass === 'panel-title-text drag-handle' || targetClass === 'panel-title drag-handle') {
|
||||
if (targetClass === 'panel-title-text' || targetClass === 'panel-title') {
|
||||
evt.stopPropagation();
|
||||
elem.find('[data-toggle=dropdown]').dropdown('toggle');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user