From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 246251FF0B7 for ; Mon, 30 Nov 2026 14:43:16 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5F11521707; Mon, 30 Nov 2026 14:43:15 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 1/2] ui: pve: tree: add 'Open Shell' action to node rows Date: Mon, 30 Nov 2026 14:43:02 +0100 Message-ID: <20261130134311.2843926-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.247 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: LWV3C7OH4LW3YPJEM65WU33BUDK2AWES X-Message-ID-Hash: LWV3C7OH4LW3YPJEM65WU33BUDK2AWES 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: so users can open the shell of a node in its own browser window, like the console of a guest, instead of only in the 'Shell' tab of the node panel. The action is only shown if the user has 'Sys.Console' on the node and the pve-manager version of the node is new enough, like for the 'Shell' tab. It is always enabled then. If the shell cannot be opened, e.g. because the node is offline, the shell window itself shows the reason. Signed-off-by: Dominik Csapak --- ui/src/pve/tree.rs | 38 ++++++++++++++++++++++++++++++++++++-- ui/src/pve/utils.rs | 6 ++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs index 3c0b533d..2c3ffac3 100644 --- a/ui/src/pve/tree.rs +++ b/ui/src/pve/tree.rs @@ -28,7 +28,7 @@ use pwt::widget::{ use pwt::{prelude::*, widget::Button}; use pdm_api_types::{ - RemoteUpid, + PRIV_SYS_CONSOLE, RemoteUpid, resource::{AsResourceView, PveNodeResource, PveResource, Resource}, }; use pdm_search::SearchTerm; @@ -43,7 +43,10 @@ use crate::{ widget::{BulkActionWindow, MigrateWindow, bulk_action_disabled_reason}, }; -use super::{ConfirmGuestAction, GuestInfo, GuestRowActions, PowerAction, PowerActionExt, utils}; +use super::{ + ConfirmGuestAction, GuestInfo, GuestRowActions, PowerAction, PowerActionExt, action_tooltip, + utils, +}; #[derive(Clone, PartialEq)] pub enum PveTreeNode { @@ -856,9 +859,19 @@ fn columns( .on_activate(open_pve_ui(&link, &remote, node, local_id)), ) .tip(tr!("Open in PVE UI")); + let open_shell = match entry { + // a placeholder for a node that the remote did not list has no name + PveTreeNode::Resource(PveResource::Node(node)) if !node.node.is_empty() => { + let version = pve_manager_versions.get(&node.node); + open_shell_action(&acl, &remote, &node.node, version) + } + _ => None, + }; Row::new() .class(JustifyContent::FlexEnd) + // in front, so that the other icons stay in line with those of the other rows + .with_optional_child(open_shell) .with_child(open_pve_ui) .with_optional_child(match entry { PveTreeNode::Root if !querying => { @@ -907,6 +920,27 @@ fn columns( ]) } +/// The row action that opens a shell on `node` in its own window, if the user has `Sys.Console` +/// and the pve-manager version of the node is new enough. +fn open_shell_action( + acl: &AclContext, + remote: &str, + node: &str, + pve_manager_version: Option<&Version>, +) -> Option { + let may_open = acl.check_privs(&["resource", remote, "node", node], PRIV_SYS_CONSOLE); + let blocked = utils::console_unavailable_reason(may_open, pve_manager_version, node); + blocked.is_none().then(|| { + let (remote, node) = (remote.to_string(), node.to_string()); + action_tooltip( + ActionIcon::new("fa fa-terminal") + .on_activate(move |_| utils::open_node_shell(&remote, &node)), + tr!("Open Shell"), + None, + ) + }) +} + /// A callback that opens the resource in the web interface of the remote, in a new tab. It also /// closes the menu of a right click on a guest, which the other actions replace with a dialog. fn open_pve_ui( diff --git a/ui/src/pve/utils.rs b/ui/src/pve/utils.rs index 91cc03b0..17d9b34c 100644 --- a/ui/src/pve/utils.rs +++ b/ui/src/pve/utils.rs @@ -328,6 +328,12 @@ pub(crate) fn open_guest_console(remote: &str, node: &str, guest: GuestInfo, nov XTermJs::open_xterm_js_viewer(console_type, node, use_vnc); } +/// Opens a login shell on `node` of `remote` in its own browser window. +pub(crate) fn open_node_shell(remote: &str, node: &str) { + let console_type = ConsoleType::RemotePveLoginShell(remote.to_string()); + XTermJs::open_xterm_js_viewer(console_type, node, false); +} + /// Returns `console`, or why it cannot be shown if the user lacks `Sys.Console` or `node` runs a /// version of Proxmox VE that is too old for it. An unknown version counts as new enough. pub(crate) fn render_console( -- 2.47.3