From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 7/8] ui: pve: show ha maintenance mode for nodes
Date: Fri, 14 Aug 2026 15:44:03 +0200 [thread overview]
Message-ID: <20260814134548.3446943-8-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260814134548.3446943-1-d.csapak@proxmox.com>
By rendering a small `Badge` after the nodename in the pve tree and the
resource tree, when the node is in ha maintenance mode.
I opted for showing the ha state here differently than in PVE, because
seeing the online/offline state separately from the hastat can make
sense (so there is no ambiguity if the node is online or offline).
To do this we have to add the hastate to the `PveNodeResource` and wire
that through from the /cluster/resources call.
We also have to update the pwt-assets submodule to get the necessary CSS
classes for the badge.
This partially fixes #7371.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
lib/pdm-api-types/src/resource.rs | 2 ++
server/src/api/resources.rs | 1 +
ui/pwt-assets | 2 +-
ui/src/pve/tree.rs | 11 +++++++++--
ui/src/renderer.rs | 14 +++++++++++++-
ui/src/widget/resource_tree.rs | 3 ++-
6 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index 18177dab..0db56dc4 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -490,6 +490,8 @@ pub struct PveNodeResource {
pub status: String,
/// Subscription level
pub level: String,
+ /// HA State
+ pub hastate: String,
}
#[api]
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 09d2b88d..2e4b3aba 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -1189,6 +1189,7 @@ pub(super) fn map_pve_node(remote: &str, resource: ClusterResource) -> Option<Pv
uptime: resource.uptime.unwrap_or_default() as u64,
status: resource.status.unwrap_or_default(),
level: resource.level.unwrap_or_default(),
+ hastate: resource.hastate.unwrap_or_default(),
}),
_ => None,
}
diff --git a/ui/pwt-assets b/ui/pwt-assets
index cd2819ed..5b3a866f 160000
--- a/ui/pwt-assets
+++ b/ui/pwt-assets
@@ -1 +1 @@
-Subproject commit cd2819edb53c4b01a9df7f0a2f1f43736ff677fa
+Subproject commit 5b3a866ff9e2a0945bf5d84176d0d23ae83ef782
diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs
index f68c728e..75eaa362 100644
--- a/ui/src/pve/tree.rs
+++ b/ui/src/pve/tree.rs
@@ -29,7 +29,9 @@ use pdm_api_types::{
use crate::{
get_deep_url,
- renderer::{render_resource_name, render_status_icon, render_tree_column},
+ renderer::{
+ render_resource_extra, render_resource_name, render_status_icon, render_tree_column,
+ },
widget::MigrateWindow,
};
@@ -572,6 +574,7 @@ fn create_empty_node(node_id: String) -> PveTreeNode {
uptime: Default::default(),
status: Default::default(),
level: Default::default(),
+ hastate: Default::default(),
}))
}
@@ -590,6 +593,7 @@ fn columns(
.flex(1)
.tree_column(store)
.render(move |entry: &PveTreeNode| {
+ let mut extra = None;
let (icon, text) = match entry {
PveTreeNode::Root if loading => (
Container::from_tag("i").class("pwt-loading-icon"),
@@ -600,11 +604,14 @@ fn columns(
tr!("Datacenter"),
),
PveTreeNode::Resource(r) => {
+ extra = render_resource_extra(r);
(render_status_icon(r), render_resource_name(r, true))
}
};
- render_tree_column(icon.into(), text).into()
+ render_tree_column(icon.into(), text)
+ .with_optional_child(extra)
+ .into()
})
.into(),
DataTableColumn::new(tr!("Tags"))
diff --git a/ui/src/renderer.rs b/ui/src/renderer.rs
index 0eecc889..b116fab8 100644
--- a/ui/src/renderer.rs
+++ b/ui/src/renderer.rs
@@ -2,7 +2,7 @@ use proxmox_yew_comp::MeterLabel;
use pwt::css::{AlignItems, FlexFit, FontStyle, JustifyContent};
use pwt::prelude::*;
use pwt::props::ContainerBuilder;
-use pwt::widget::{Column, Container, Fa, Row};
+use pwt::widget::{Badge, Column, Container, Fa, Row};
use proxmox_human_byte::HumanByte;
@@ -22,6 +22,18 @@ pub fn render_resource_name(resource: impl AsResourceView, vmid_first: bool) ->
}
}
+pub fn render_resource_extra(resource: impl AsResourceView) -> Option<Html> {
+ match resource.as_resource_view() {
+ ResourceView::PveNode(node) => (node.hastate == "maintenance").then_some(
+ Badge::new(tr!("HA Maintenance"))
+ .color_scheme(pwt::css::ColorScheme::PrimaryContainer)
+ .icon("wrench")
+ .into(),
+ ),
+ _ => None,
+ }
+}
+
pub fn render_resource_icon(resource: impl AsResourceView) -> Fa {
let class = match resource.as_resource_view() {
ResourceView::PveStorage(_) => "database",
diff --git a/ui/src/widget/resource_tree.rs b/ui/src/widget/resource_tree.rs
index 337d8e23..bf2ffee3 100644
--- a/ui/src/widget/resource_tree.rs
+++ b/ui/src/widget/resource_tree.rs
@@ -35,7 +35,7 @@ use crate::{
dashboard::view::ViewContext,
get_deep_url,
pve::utils::render_guest_tags,
- renderer::{render_resource_name, render_status_icon},
+ renderer::{render_resource_extra, render_resource_name, render_status_icon},
};
const REFRESH_TIME_S: u32 = 60;
@@ -381,6 +381,7 @@ fn columns(
Row::new()
.gap(1)
.with_child(render_resource_name(resource, true))
+ .with_optional_child(render_resource_extra(resource))
.with_child(render_guest_tags(match resource {
Resource::PveQemu(pve_qemu_resource) => &pve_qemu_resource.tags[..],
Resource::PveLxc(pve_lxc_resource) => &pve_lxc_resource.tags[..],
--
2.47.3
next prev parent reply other threads:[~2026-08-14 13:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 13:43 [PATCH datacenter-manager 0/8] refactor and partially fix #7371 Dominik Csapak
2026-08-14 13:43 ` [PATCH datacenter-manager 1/8] lib: add new ResourceView type and move accessors there Dominik Csapak
2026-08-14 13:43 ` [PATCH datacenter-manager 2/8] lib: api types: resource: add 'node' helper to ResourceView Dominik Csapak
2026-08-14 13:43 ` [PATCH datacenter-manager 3/8] lib: api-types: add 'vmid' getter " Dominik Csapak
2026-08-14 13:44 ` [PATCH datacenter-manager 4/8] ui: pve: factor out the pve-manager version extraction Dominik Csapak
2026-08-14 13:44 ` [PATCH datacenter-manager 5/8] ui: renderer: use ResourceView for rendering Dominik Csapak
2026-08-14 13:44 ` [PATCH datacenter-manager 6/8] ui: pve: tree: reuse `PveResource` for `PveTreeNode` Dominik Csapak
2026-08-14 13:44 ` Dominik Csapak [this message]
2026-08-14 13:44 ` [PATCH datacenter-manager 8/8] ui: pve: node selector: show maintenance badge with node name Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260814134548.3446943-8-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox