From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 3/4] ui: dashboard: subscriptions list: improve display of subscription state
Date: Thu, 27 Nov 2025 15:03:47 +0100 [thread overview]
Message-ID: <20251127140451.3131469-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251127140451.3131469-1-d.csapak@proxmox.com>
by doing the following:
* display standalone hosts inline, displaying the remote and hostname
* add an icon to the top level elements
* adding a red 'x' for clusters/nodes without a subscription
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
ui/src/dashboard/subscriptions_list.rs | 135 +++++++++++++++++--------
1 file changed, 93 insertions(+), 42 deletions(-)
diff --git a/ui/src/dashboard/subscriptions_list.rs b/ui/src/dashboard/subscriptions_list.rs
index 5037a9de..b0a96eb6 100644
--- a/ui/src/dashboard/subscriptions_list.rs
+++ b/ui/src/dashboard/subscriptions_list.rs
@@ -17,7 +17,7 @@ use pwt::{
tr,
widget::{
data_table::{DataTable, DataTableColumn, DataTableHeader},
- Fa, Row,
+ Container, Fa, Row,
},
};
@@ -48,6 +48,7 @@ struct NodeEntry {
remote: String,
name: String,
level: SubscriptionLevel,
+ standalone: bool,
}
#[derive(Clone, PartialEq)]
@@ -88,25 +89,42 @@ impl PdmSubscriptionsList {
let subscriptions = sort_subscriptions(&ctx.props().subscriptions);
for remote in subscriptions {
- let mut remote_node = root.append(SubscriptionTreeEntry::Remote(RemoteEntry {
- name: remote.remote.clone(),
- state: remote.state.clone(),
- error: remote.error.clone(),
- }));
-
- if let Some(node_status) = remote.node_status.as_ref() {
- if node_status.is_empty() {
- continue;
- }
-
- for (node_name, info) in node_status {
+ match remote.node_status {
+ Some(node_status) if node_status.len() == 1 => {
+ let (node_name, info) = node_status.into_iter().next().unwrap();
if let Some(info) = info {
- remote_node.append(SubscriptionTreeEntry::Node(NodeEntry {
+ root.append(SubscriptionTreeEntry::Node(NodeEntry {
remote: remote.remote.clone(),
name: node_name.clone(),
- level: info.level.clone(),
+ level: info.level,
+ standalone: true,
}));
}
+ continue;
+ }
+ _ => {
+ let mut remote_node = root.append(SubscriptionTreeEntry::Remote(RemoteEntry {
+ name: remote.remote.clone(),
+ state: remote.state.clone(),
+ error: remote.error.clone(),
+ }));
+
+ if let Some(node_status) = remote.node_status.as_ref() {
+ if node_status.is_empty() {
+ continue;
+ }
+
+ for (node_name, info) in node_status {
+ if let Some(info) = info {
+ remote_node.append(SubscriptionTreeEntry::Node(NodeEntry {
+ remote: remote.remote.clone(),
+ name: node_name.clone(),
+ level: info.level,
+ standalone: false,
+ }));
+ }
+ }
+ }
}
}
}
@@ -146,10 +164,17 @@ fn columns(
.render(|entry: &SubscriptionTreeEntry| {
let row = Row::new().class(AlignItems::Center).gap(2);
match entry {
- SubscriptionTreeEntry::Remote(remote) => row.with_child(remote.name.clone()).into(),
+ SubscriptionTreeEntry::Remote(remote) => row
+ .with_child(Fa::new("server").fixed_width())
+ .with_child(remote.name.clone())
+ .into(),
SubscriptionTreeEntry::Node(node) => row
- .with_child(Fa::new("server"))
- .with_child(node.name.clone())
+ .with_child(Fa::new("building").fixed_width())
+ .with_child(if node.standalone {
+ format!("{} - {}", node.remote, node.name)
+ } else {
+ node.name.clone()
+ })
.into(),
SubscriptionTreeEntry::Root => row.into(),
}
@@ -157,37 +182,63 @@ fn columns(
.sorter(|a: &SubscriptionTreeEntry, b: &SubscriptionTreeEntry| a.name().cmp(b.name()))
.into();
+ fn render_subscription_state(state: &RemoteSubscriptionState) -> Row {
+ let icon = match state {
+ RemoteSubscriptionState::Mixed => Fa::from(Status::Warning),
+ RemoteSubscriptionState::Active => Fa::from(Status::Success),
+ RemoteSubscriptionState::None => Fa::from(Status::Error),
+ _ => Fa::from(Status::Unknown),
+ };
+
+ let text = match state {
+ RemoteSubscriptionState::None => "None",
+ RemoteSubscriptionState::Unknown => "Unknown",
+ RemoteSubscriptionState::Mixed => "Mixed",
+ RemoteSubscriptionState::Active => "Active",
+ };
+
+ Row::new()
+ .class(AlignItems::Center)
+ .gap(2)
+ .with_child(icon)
+ .with_child(Container::from_tag("span").with_child(text))
+ }
+
+ fn render_subscription_level(level: SubscriptionLevel) -> &'static str {
+ match level {
+ SubscriptionLevel::None => "None",
+ SubscriptionLevel::Basic => "Basic",
+ SubscriptionLevel::Community => "Community",
+ SubscriptionLevel::Premium => "Premium",
+ SubscriptionLevel::Standard => "Standard",
+ SubscriptionLevel::Unknown => "Unknown",
+ }
+ }
+
let subscription_column = DataTableColumn::new(tr!("Subscription"))
.render(|entry: &SubscriptionTreeEntry| match entry {
SubscriptionTreeEntry::Node(node) => {
- let text = match node.level {
- SubscriptionLevel::None => "None",
- SubscriptionLevel::Basic => "Basic",
- SubscriptionLevel::Community => "Community",
- SubscriptionLevel::Premium => "Premium",
- SubscriptionLevel::Standard => "Standard",
- SubscriptionLevel::Unknown => "Unknown",
- };
- text.into()
+ if node.standalone {
+ let (sub_state, text) = match node.level {
+ SubscriptionLevel::None => (RemoteSubscriptionState::None, None),
+ SubscriptionLevel::Unknown => (RemoteSubscriptionState::Unknown, None),
+ other => (
+ RemoteSubscriptionState::Active,
+ Some(render_subscription_level(other)),
+ ),
+ };
+ render_subscription_state(&sub_state)
+ .with_optional_child(text)
+ .into()
+ } else {
+ render_subscription_level(node.level).into()
+ }
}
SubscriptionTreeEntry::Remote(remote) => {
if let Some(error) = &remote.error {
- html! { <span class="pwt-font-label-small">{error}</span> }.into()
+ html! { <span class="pwt-font-label-small">{error}</span> }
} else {
- let icon = match remote.state {
- RemoteSubscriptionState::Mixed => Fa::from(Status::Warning),
- RemoteSubscriptionState::Active => Fa::from(Status::Success),
- _ => Fa::from(Status::Unknown),
- };
-
- let text = match remote.state {
- RemoteSubscriptionState::None => "None",
- RemoteSubscriptionState::Unknown => "Unknown",
- RemoteSubscriptionState::Mixed => "Mixed",
- RemoteSubscriptionState::Active => "Active",
- };
-
- Row::new().gap(2).with_child(icon).with_child(text).into()
+ render_subscription_state(&remote.state).into()
}
}
SubscriptionTreeEntry::Root => "".into(),
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-11-27 14:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 14:03 [pdm-devel] [PATCH datacenter-manager 0/4] improve subscription display in Dominik Csapak
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 1/4] ui: dashboard: subscriptions: refactor subscriptions show logic Dominik Csapak
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 2/4] ui: dashboard: subscriptions list: update store when data changes Dominik Csapak
2025-11-27 14:03 ` Dominik Csapak [this message]
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 4/4] ui: dashboard: subscriptions details: add a 'force refresh' button Dominik Csapak
2025-11-27 16:13 ` Michael Köppl
2025-11-27 21:10 ` Thomas Lamprecht
2025-11-27 16:13 ` [pdm-devel] [PATCH datacenter-manager 0/4] improve subscription display in Michael Köppl
2025-11-27 21:12 ` [pdm-devel] applied: " Thomas Lamprecht
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=20251127140451.3131469-4-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