From 3cf405c823d79c71c0ac2eb751701d7520ef538a Mon Sep 17 00:00:00 2001 From: mirivlad Date: Sat, 14 Feb 2026 18:17:48 +0000 Subject: [PATCH] Fix tooltip external handler and add null check --- templates/servers/detail.twig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/servers/detail.twig b/templates/servers/detail.twig index e1a8d3f..51bdc70 100755 --- a/templates/servers/detail.twig +++ b/templates/servers/detail.twig @@ -517,8 +517,12 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, { document.body.appendChild(tooltipEl); } - var dataIndex = context[0].dataIndex; - var time = labels{{ metricName }}[dataIndex]; + var dataIndex = context.tooltip && context.tooltip.dataPoints && context.tooltip.dataPoints[0] ? context.tooltip.dataPoints[0].dataIndex : null; + if (dataIndex === null) { + tooltipEl.style.opacity = 0; + return; + } + var time = labels{{ metricName }}[dataIndex]; // Fetch processes fetch('/api/v1/agent/' + {{ server.id }} + '/processes?time=' + encodeURIComponent(time))