mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Panels: No title will no longer make panel header take up space (#16884)
* Panels: Initial poc of no panel titles * moving panel-container to DashboardPanel * Starting to work * Gauge fix * Panels: tweaked panel padding and title z-index stuff * Panels: changed panel padding a bit and simplified it by having same padding in vertical and horizontal * Lots of tweaks to panel padding related stuff * Updated snapshot * Added test dashboard * Final refactorings * Trim title befgor applying panel-container--no-title class * Remove unnecessary type annotation * Panels: hasTitle no need to trim * Gauge: fixed font family
This commit is contained in:
@@ -430,7 +430,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
|
||||
const plotCanvas = $('<div></div>');
|
||||
const plotCss = {
|
||||
top: '10px',
|
||||
top: '5px',
|
||||
margin: 'auto',
|
||||
position: 'relative',
|
||||
height: height * 0.9 + 'px',
|
||||
@@ -494,7 +494,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
},
|
||||
font: {
|
||||
size: fontSize,
|
||||
family: '"Helvetica Neue", Helvetica, Arial, sans-serif',
|
||||
family: config.theme.typography.fontFamily.sansSerif,
|
||||
},
|
||||
},
|
||||
show: true,
|
||||
@@ -512,7 +512,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
function addSparkline() {
|
||||
const width = elem.width() + 20;
|
||||
const width = elem.width();
|
||||
if (width < 30) {
|
||||
// element has not gotten it's width yet
|
||||
// delay sparkline render
|
||||
@@ -524,17 +524,16 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
const plotCanvas = $('<div></div>');
|
||||
const plotCss: any = {};
|
||||
plotCss.position = 'absolute';
|
||||
plotCss.bottom = '0px';
|
||||
|
||||
if (panel.sparkline.full) {
|
||||
plotCss.bottom = '5px';
|
||||
plotCss.left = '-5px';
|
||||
plotCss.width = width - 10 + 'px';
|
||||
plotCss.left = '0px';
|
||||
plotCss.width = width + 'px';
|
||||
const dynamicHeightMargin = height <= 100 ? 5 : Math.round(height / 100) * 15 + 5;
|
||||
plotCss.height = height - dynamicHeightMargin + 'px';
|
||||
} else {
|
||||
plotCss.bottom = '0px';
|
||||
plotCss.left = '-5px';
|
||||
plotCss.width = width - 10 + 'px';
|
||||
plotCss.left = '0px';
|
||||
plotCss.width = width + 'px';
|
||||
plotCss.height = Math.floor(height * 0.25) + 'px';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user