From 7b8412a6af99f8724fbec5c08c7bc3079d51f5b5 Mon Sep 17 00:00:00 2001 From: Naeel Date: Thu, 16 Apr 2026 16:23:45 +0300 Subject: [PATCH] v9.15: fix graph node height for long names (proper line-height calc) --- k8s/deployment.yaml | 2 +- static/index.html | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index cc8e814..75123a0 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -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 diff --git a/static/index.html b/static/index.html index d5d0653..ac00c66 100644 --- a/static/index.html +++ b/static/index.html @@ -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: {