From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp v3 2/2] node status panel: remove power management and make fingerprint opt-in
Date: Mon, 10 Nov 2025 09:58:29 +0100 [thread overview]
Message-ID: <20251110085830.21887-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251110085830.21887-1-s.sterz@proxmox.com>
the panel appeared to dense with all these tools being present. so
remove the reboot and power off button and make the fingerprint button
opt-in.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/node_status_panel.rs | 70 ++++++++++------------------------------
1 file changed, 17 insertions(+), 53 deletions(-)
diff --git a/src/node_status_panel.rs b/src/node_status_panel.rs
index 3d37d80..c73594b 100644
--- a/src/node_status_panel.rs
+++ b/src/node_status_panel.rs
@@ -12,12 +12,11 @@ use pwt::widget::{error_message, Fa, Panel, Row, Tooltip};
use pwt::widget::{Button, Dialog};
use pwt_macros::builder;
-use proxmox_node_status::{NodePowerCommand, NodeStatus};
+use proxmox_node_status::NodeStatus;
use crate::utils::copy_text_to_clipboard;
use crate::{
- http_get, http_post, node_info, ConfirmButton, LoadableComponent, LoadableComponentContext,
- LoadableComponentMaster,
+ http_get, node_info, LoadableComponent, LoadableComponentContext, LoadableComponentMaster,
};
#[derive(Properties, Clone, PartialEq)]
@@ -27,6 +26,10 @@ pub struct NodeStatusPanel {
#[builder(IntoPropValue, into_prop_value)]
#[prop_or_default]
status_base_url: Option<AttrValue>,
+
+ #[builder(IntoPropValue, into_prop_value)]
+ #[prop_or_default]
+ fingerprint_button: bool,
}
impl NodeStatusPanel {
@@ -44,8 +47,6 @@ impl Default for NodeStatusPanel {
enum Msg {
Error(Error),
Loaded(Rc<NodeStatus>),
- RebootOrShutdown(NodePowerCommand),
- Reload,
}
#[derive(PartialEq)]
@@ -59,24 +60,6 @@ struct ProxmoxNodeStatusPanel {
}
impl ProxmoxNodeStatusPanel {
- fn change_power_state(&self, ctx: &LoadableComponentContext<Self>, command: NodePowerCommand) {
- let Some(url) = ctx.props().status_base_url.clone() else {
- return;
- };
- let link = ctx.link().clone();
-
- ctx.link().spawn(async move {
- let data = Some(serde_json::json!({
- "command": command,
- }));
-
- match http_post(url.as_str(), data).await {
- Ok(()) => link.send_message(Msg::Reload),
- Err(err) => link.send_message(Msg::Error(err)),
- }
- });
- }
-
fn fingerprint_dialog(
&self,
ctx: &LoadableComponentContext<Self>,
@@ -154,7 +137,7 @@ impl LoadableComponent for ProxmoxNodeStatusPanel {
})
}
- fn update(&mut self, ctx: &crate::LoadableComponentContext<Self>, msg: Self::Message) -> bool {
+ fn update(&mut self, _ctx: &crate::LoadableComponentContext<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Error(err) => {
self.error = Some(err);
@@ -165,11 +148,6 @@ impl LoadableComponent for ProxmoxNodeStatusPanel {
self.error = None;
true
}
- Msg::RebootOrShutdown(command) => {
- self.change_power_state(ctx, command);
- false
- }
- Msg::Reload => true,
}
}
@@ -195,7 +173,7 @@ impl LoadableComponent for ProxmoxNodeStatusPanel {
.as_ref()
.map(|r| crate::NodeStatus::Common(r));
- Panel::new()
+ let mut panel = Panel::new()
.border(false)
.class(FlexFit)
.title(
@@ -206,25 +184,11 @@ impl LoadableComponent for ProxmoxNodeStatusPanel {
.with_child(tr!("Node Status"))
.into_html(),
)
- .with_tool(
- ConfirmButton::new(tr!("Reboot"))
- .confirm_message(tr!("Are you sure you want to reboot the node?"))
- .on_activate(
- ctx.link()
- .callback(|_| Msg::RebootOrShutdown(NodePowerCommand::Reboot)),
- )
- .icon_class("fa fa-undo"),
- )
- .with_tool(
- ConfirmButton::new(tr!("Shutdown"))
- .confirm_message(tr!("Are you sure you want to shut down the node?"))
- .on_activate(
- ctx.link()
- .callback(|_| Msg::RebootOrShutdown(NodePowerCommand::Shutdown)),
- )
- .icon_class("fa fa-power-off"),
- )
- .with_tool(
+ .with_child(node_info(status))
+ .with_optional_child(self.error.as_ref().map(|e| error_message(&e.to_string())));
+
+ if ctx.props().fingerprint_button {
+ panel.add_tool(
Button::new(tr!("Show Fingerprint"))
.icon_class("fa fa-hashtag")
.class(ColorScheme::Primary)
@@ -232,10 +196,10 @@ impl LoadableComponent for ProxmoxNodeStatusPanel {
ctx.link()
.change_view_callback(|_| ViewState::FingerprintDialog),
),
- )
- .with_child(node_info(status))
- .with_optional_child(self.error.as_ref().map(|e| error_message(&e.to_string())))
- .into()
+ );
+ }
+
+ panel.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-10 8:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 8:58 [pdm-devel] [PATCH datacenter-manager/yew-comp v3 0/3] add node status panel to proxmox datacenter manager Shannon Sterz
2025-11-10 8:58 ` [pdm-devel] [PATCH yew-comp v3 1/2] node_info: only use build date from kernel version Shannon Sterz
2025-11-10 8:58 ` Shannon Sterz [this message]
2025-11-10 8:58 ` [pdm-devel] [PATCH datacenter-manager v3 1/1] ui: add a Node Status tab to the administration panel Shannon Sterz
2025-11-12 14:26 ` [pdm-devel] [PATCH datacenter-manager/yew-comp v3 0/3] add node status panel to proxmox datacenter manager Lukas Wagner
2025-11-12 14:34 ` Shannon Sterz
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=20251110085830.21887-3-s.sterz@proxmox.com \
--to=s.sterz@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.