From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 595491FF0B3 for ; Thu, 26 Nov 2026 15:54:42 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id A7B0C21789; Thu, 26 Nov 2026 15:54:34 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 09/10] ui: dashboard: top entities: show indicator line for tooltip point Date: Thu, 26 Nov 2026 15:49:22 +0100 Message-ID: <20261126145410.3011676-10-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261126145410.3011676-1-d.csapak@proxmox.com> References: <20261126145410.3011676-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.258 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: KBICRAUYX2R7S3FHF2LDE5WAJH5YQYHU X-Message-ID-Hash: KBICRAUYX2R7S3FHF2LDE5WAJH5YQYHU X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: with many data points per graph, it's hard to tell which point the tooltip refers to. So show a vertical line at the position of that point, using the same relative position as the graphs. The line snaps to the data point instead of following the pointer exactly, so it always matches the shown values. Reuse the tooltip anchor for this and align the tooltip to its top, which keeps the tooltip at the same position as before. Signed-off-by: Dominik Csapak --- ui/src/dashboard/top_entities.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ui/src/dashboard/top_entities.rs b/ui/src/dashboard/top_entities.rs index a5e51538..3cbff87f 100644 --- a/ui/src/dashboard/top_entities.rs +++ b/ui/src/dashboard/top_entities.rs @@ -87,7 +87,8 @@ pub enum Msg { } struct TooltipInfo { - pos: i32, + /// The index of the shown data point. + index: usize, id: String, value: Option, time: i64, @@ -158,7 +159,7 @@ impl Component for TopEntitiesComp { as usize; self.tooltip_info = Some(TooltipInfo { - pos: offset, + index: idx, id: resource.global_id().to_string(), value: rrd.data.get(idx).copied().unwrap_or_default(), time: (rrd.start + rrd.resolution * idx as u64) as i64, @@ -205,15 +206,25 @@ impl Component for TopEntitiesComp { let remote = &entity.remote; let node = resource.as_resource_view().node().map(|n| n.to_string()); + let len = entity.rrd_data.data.len(); let tooltip_anchor = if let Some(info) = self.tooltip_info.as_ref() { if info.id == resource.global_id() { tooltip = Some(create_tooltip(remote, resource, info, &props.metrics_title)); + // a vertical line at the shown data point, which is at the same relative + // position as in the graphs, so it is clear which point the tooltip refers to Some( Container::new() .style("position", "absolute") .style("pointer-events", "none") - .style("left", format!("{}px", info.pos)) + .style("top", "0") + .style("bottom", "0") + .style("width", "1px") + .style("background-color", INDICATOR_COLOR) + .style( + "left", + format!("{}%", (info.index as f64 + 0.5) * 100.0 / len as f64), + ) .into_html_with_ref(self.tooltip_anchor.clone()), ) } else { @@ -268,7 +279,6 @@ impl Component for TopEntitiesComp { .style("position", "relative") .with_optional_child(tooltip_anchor); - let len = entity.rrd_data.data.len(); match props.graph_type { GraphType::Heat => graph_container.set_style("background-image", graph.clone()), GraphType::Line => { @@ -338,7 +348,7 @@ impl Component for TopEntitiesComp { tooltip_node, Some( AlignOptions::new( - pwt::dom::align::Point::BottomStart, + pwt::dom::align::Point::TopStart, pwt::dom::align::Point::TopStart, pwt::dom::align::GrowDirection::None, ) @@ -429,6 +439,8 @@ const GOOD_COLOR: &str = "var(--pwt-color-success)"; const WARN_COLOR: &str = "var(--pwt-color-warning)"; const ERR_COLOR: &str = "var(--pwt-color-error)"; const BACKGROUND_COLOR: &str = "var(--pwt-color-surface)"; +// must stay visible on top of all usage colors +const INDICATOR_COLOR: &str = "var(--pwt-color-on-surface)"; const COLOR_SPACE: &str = "oklab"; -- 2.47.3