v9.15: fix graph node height for long names (proper line-height calc)

This commit is contained in:
Naeel
2026-04-16 16:23:45 +03:00
parent 23f09556f9
commit 7b8412a6af
2 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: cloud-dashboard
image: naeel/cloud-dashboard:v9.14
image: naeel/cloud-dashboard:v9.15
imagePullPolicy: Always
ports:
- containerPort: 8080
+9 -6
View File
@@ -473,13 +473,16 @@ function graphElements(data, focusUid, laneById){
if(age) label += "\n\n\u23f1 " + age;
// Fixed node width; text wraps inside
var nodeFixedW = 200;
var textMaxWidth = nodeFixedW - 20;
// Estimate lines needed for name wrapping
var charsPerLine = Math.floor(textMaxWidth / 8);
var nameLines = Math.max(1, Math.ceil(name.length / charsPerLine));
var totalLines = nameLines + (svc ? 1 : 0) + (age ? 3 : 0);
var height = Math.max(50, 16 + totalLines * 20);
var textMaxWidth = nodeFixedW - 24;
var fontSize = age ? (name.length > 36 ? 10 : name.length > 24 ? 11 : 12) : (name.length > 36 ? 11 : name.length > 24 ? 12 : 13);
// Estimate height: nameFs = fontSize*1.25, ~0.6 px per char at that size
var nameFs = Math.round(fontSize * 1.25);
var charsPerLine = Math.max(8, Math.floor(textMaxWidth / (nameFs * 0.6)));
var nameLines = Math.max(1, Math.ceil(name.length / charsPerLine));
var nameH = nameLines * Math.round(nameFs * 1.5);
var svcH = svc ? Math.round((fontSize - 1) * 1.5) + 6 : 0;
var ageH = age ? 9 * 2 + 12 : 0;
var height = Math.max(80, 16 + nameH + svcH + ageH);
var bgColor = svcBgColor(svc);
elems.push({
data: {