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 083B31FF0B4 for ; Fri, 27 Nov 2026 17:14:05 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B8CCB218EE; Fri, 27 Nov 2026 17:13:15 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 36/38] ui: views: map: show the states of a cluster and ping problems Date: Fri, 27 Nov 2026 17:12:33 +0100 Message-ID: <20261127161241.3713494-37-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261127161241.3713494-1-d.csapak@proxmox.com> References: <20261127161241.3713494-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.248 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: DXBUI4ZGQAFDFDGO2SV5TK57CMES2YJO X-Message-ID-Hash: DXBUI4ZGQAFDFDGO2SV5TK57CMES2YJO 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: A point that combines several remotes only had the color of its worst state. If they are not all in the same state, show a ring around it that is divided by how many remotes are in which state. Points with a warning or an error also get a slow ping, so that they stand out between the others. Signed-off-by: Dominik Csapak --- ui/src/dashboard/map.rs | 55 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/ui/src/dashboard/map.rs b/ui/src/dashboard/map.rs index 1ffd127d..6626ec81 100644 --- a/ui/src/dashboard/map.rs +++ b/ui/src/dashboard/map.rs @@ -19,7 +19,7 @@ use pwt::state::{Loader, SharedState, SharedStateObserver}; use pwt::widget::canvas::Group; use pwt::widget::charts::{ Location, MapConnection, MapPointData, PointsRenderArgs, WorldMap, WorldPoint, - render_point_default, render_tooltip_default, + render_point_default, render_point_ping, render_point_shares, render_tooltip_default, }; use pwt::widget::container::span; use pwt::widget::{ActionIcon, Column, Container, Fa, Panel, Row, Tooltip, error_message}; @@ -558,34 +558,41 @@ impl MapPointData for PoiInfo { } fn render_point(args: &PointsRenderArgs) -> Group { - let mut worst = RemoteStatus::Good; - + // worst first + let mut shares = [ + (RemoteStatus::Error, 0, "error"), + (RemoteStatus::Warning, 0, "warning"), + (RemoteStatus::Unknown, 0, "primary"), + (RemoteStatus::Good, 0, "success"), + ]; for poi in args.points { - match (&poi.data.status, &worst) { - (RemoteStatus::Error, _) => worst = RemoteStatus::Error, - (RemoteStatus::Warning, RemoteStatus::Good | RemoteStatus::Unknown) => { - worst = RemoteStatus::Warning - } - (RemoteStatus::Unknown, RemoteStatus::Good) => worst = RemoteStatus::Unknown, - _ => {} + if let Some(share) = shares.iter_mut().find(|share| share.0 == poi.data.status) { + share.1 += 1; } } + let shares: Vec<_> = shares.into_iter().filter(|share| share.1 > 0).collect(); + let Some((worst, _, worst_color)) = shares.first() else { + return render_point_default(args); + }; + let color = |name: &str| format!("var(--pwt-color-{name})"); let mut args = args.clone(); - let txt = match worst { - RemoteStatus::Good => "success", - RemoteStatus::Warning => "warning", - RemoteStatus::Error => "error", - RemoteStatus::Unknown => { - // animate the not yet loaded remotes - args.selected = true; - "primary" - } - }; - render_point_default(&args).style( - "--pwt-map-location-color", - format!("var(--pwt-color-{txt})"), - ) + // animate the not yet loaded remotes + args.selected |= *worst == RemoteStatus::Unknown; + let mut point = + render_point_default(&args).style("--pwt-map-location-color", color(worst_color)); + // a ring shows how many remotes are in which state if they differ + if shares.len() > 1 { + let shares: Vec<(usize, AttrValue)> = shares + .iter() + .map(|(_, count, name)| (*count, color(name).into())) + .collect(); + point.add_child(render_point_shares(&args, &shares)); + } + if matches!(worst, RemoteStatus::Error | RemoteStatus::Warning) { + point.add_child(render_point_ping(&args)); + } + point } fn render_info(args: &PointsRenderArgs) -> Html { -- 2.47.3