From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager v2 7/9] ui: pve: show ha maintenance mode for nodes
Date: Tue, 18 Aug 2026 15:25:57 +0200 [thread overview]
Message-ID: <20260818133000.3793412-8-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260818133000.3793412-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 hastate 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 | 3 +++
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, 29 insertions(+), 5 deletions(-)
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index c433a284..288d8543 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -490,6 +490,9 @@ pub struct PveNodeResource {
pub status: String,
/// Subscription level
pub level: String,
+ /// HA State
+ #[serde(default)]
+ 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 4ea5716a..1a7c9df0 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_info, render_resource_name, render_status_icon, render_tree_column,
+ },
widget::MigrateWindow,
};
@@ -573,6 +575,7 @@ fn create_empty_node(node_id: String) -> PveTreeNode {
uptime: Default::default(),
status: Default::default(),
level: Default::default(),
+ hastate: Default::default(),
}))
}
@@ -591,6 +594,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"),
@@ -601,11 +605,14 @@ fn columns(
tr!("Datacenter"),
),
PveTreeNode::Resource(r) => {
+ extra = render_resource_extra_info(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..fd1283fa 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_info(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..0681c24d 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_info, 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_info(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-18 13:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:25 [PATCH datacenter-manager v2 0/9] refactor and partially fix #7371 Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 1/9] lib: api types: add new ResourceView type and move accessors there Dominik Csapak
2026-08-20 11:07 ` Lukas Wagner
2026-08-20 11:20 ` Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 2/9] lib: api types: resource: add 'node' helper to ResourceView Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 3/9] lib: api types: add guest specific getter " Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 4/9] ui: pve: factor out the pve-manager version extraction Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 5/9] ui: renderer: use ResourceView for rendering Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 6/9] ui: pve: tree: reuse `PveResource` for `PveTreeNode` Dominik Csapak
2026-08-18 13:25 ` Dominik Csapak [this message]
2026-08-20 11:07 ` [PATCH datacenter-manager v2 7/9] ui: pve: show ha maintenance mode for nodes Lukas Wagner
2026-08-20 11:20 ` Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 8/9] ui: pve: node selector: show maintenance badge with node name Dominik Csapak
2026-08-18 13:25 ` [PATCH datacenter-manager v2 9/9] ui: pve: node: show HA maintenance badge Dominik Csapak
2026-08-20 11:08 ` [PATCH datacenter-manager v2 0/9] refactor and partially fix #7371 Lukas Wagner
2026-08-21 12:51 ` superseded: " 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=20260818133000.3793412-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.