fix(dashboard): heights fit content to 10px, not a whole 70px row; text columns read from the left (#5214)
View mode splits each saved row into seven, so a widget no longer carries up to 69px of empty space below its content (Overview, SNMP). Edit mode and the saved layout keep 70px rows. The Busiest Containers host column aligns left like its header, its note fits one line, and the Hosts column reads Disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,10 +19,12 @@
|
||||
.share-header { background: var(--bg-card); padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--border-mid); min-height: 48px; }
|
||||
.share-name { font-family: var(--fs-font-display); font-weight: 500; font-size: 1.15rem; color: var(--gold); overflow-wrap: anywhere; }
|
||||
.share-main { max-width: 2400px; }
|
||||
/* The same layout as the signed-in dashboard: rows 70px, gaps 1rem, and
|
||||
static/dash-layout.js sets the columns and each cell's place and height. */
|
||||
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: 70px; gap: 1rem; }
|
||||
.dash-grid > .dash-cell { margin-bottom: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
|
||||
/* The same layout as the signed-in dashboard: a saved row is 70px plus a
|
||||
1rem gap, split into ROW_SPLIT view rows (the gap is each cell's bottom
|
||||
margin), and static/dash-layout.js sets the columns and each cell's
|
||||
place and height. */
|
||||
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: calc((70px + 1rem) / 7); column-gap: 1rem; row-gap: 0; }
|
||||
.dash-grid > .dash-cell { margin-bottom: 1rem; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
|
||||
.dash-cell .dash-cell-body { flex: 1; min-height: 0; overflow: auto; }
|
||||
@media (max-width: 820px) {
|
||||
.share-main { padding: 1rem; }
|
||||
@@ -69,12 +71,12 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var L = window.StewardDashLayout, grid = document.querySelector('.dash-grid');
|
||||
if (!L || !grid) return;
|
||||
var ROW_PX = 70, GAP_PX = 16;
|
||||
var GAP_PX = 16, VIEW_PX = (70 + GAP_PX) / L.ROW_SPLIT;
|
||||
function cells() { return Array.prototype.slice.call(grid.querySelectorAll('.dash-cell')); }
|
||||
function relayout() {
|
||||
var cols = L.columnsFor(grid.clientWidth);
|
||||
var pos = L.pack(cells().map(function (el) {
|
||||
var s = L.saved(el); s.id = el.dataset.id; s.h = el._fitH || s.h; return s;
|
||||
var s = L.viewed(el); s.id = el.dataset.id; s.h = el._fitH || s.h; return s;
|
||||
}), cols);
|
||||
grid.style.gridTemplateColumns = 'repeat(' + cols + ', 1fr)';
|
||||
cells().forEach(function (el) {
|
||||
@@ -85,7 +87,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
var pending = null;
|
||||
function fit(el) {
|
||||
var rows = L.fitRows(el, ROW_PX + GAP_PX, GAP_PX, L.saved(el).h);
|
||||
var rows = L.fitRows(el, VIEW_PX, GAP_PX, L.viewed(el).h);
|
||||
if (rows !== el._fitH) { el._fitH = rows; clearTimeout(pending); pending = setTimeout(relayout, 60); }
|
||||
}
|
||||
document.body.addEventListener('htmx:afterSettle', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user