From: Christian Ebner <c.ebner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 5/6] ui: remote: check connection for PBS remotes in remote add wizard
Date: Mon, 22 Sep 2025 13:09:57 +0200 [thread overview]
Message-ID: <20250922110958.369653-6-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250922110958.369653-1-c.ebner@proxmox.com>
Adds the TLS connection check for PBS remotes currently not
implemented in the wizard.
Uses the PDM client to check the connection to a remote PBS instance
with the provided hostname (port) and fingerprint.
Since the pdm client will use the implementation based on the provided
remote type, pass it along from the wizard page props, which is
extended to provide this information.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/remotes/add_wizard.rs | 2 +-
ui/src/remotes/wizard_page_connect.rs | 16 +++++++++++-----
ui/src/remotes/wizard_page_info.rs | 25 +++++++++++++++++--------
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/ui/src/remotes/add_wizard.rs b/ui/src/remotes/add_wizard.rs
index 205d8ff..72ab9cb 100644
--- a/ui/src/remotes/add_wizard.rs
+++ b/ui/src/remotes/add_wizard.rs
@@ -114,7 +114,7 @@ impl Component for AddWizardState {
let info = self.connect_info.clone();
let link = ctx.link().clone();
move |p: &WizardPageRenderInfo| {
- WizardPageInfo::new(p.clone())
+ WizardPageInfo::new(p.clone(), remote_type)
.connect_info(info.clone())
.on_server_change(link.callback(Msg::ServerChange))
.into()
diff --git a/ui/src/remotes/wizard_page_connect.rs b/ui/src/remotes/wizard_page_connect.rs
index ce2a36b..e59a506 100644
--- a/ui/src/remotes/wizard_page_connect.rs
+++ b/ui/src/remotes/wizard_page_connect.rs
@@ -1,6 +1,6 @@
use std::rc::Rc;
-use anyhow::{bail, Error};
+use anyhow::Error;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use yew::html::IntoEventCallback;
@@ -45,16 +45,22 @@ pub struct ConnectParams {
}
async fn connect(form_ctx: FormContext, remote_type: RemoteType) -> Result<TlsProbeOutcome, Error> {
+ let hostname = normalize_hostname(form_ctx.read().get_field_text("hostname"));
+ let fingerprint = get_fingerprint(&form_ctx);
+ let pdm_client = crate::pdm_client();
match remote_type {
RemoteType::Pve => {
- let hostname = normalize_hostname(form_ctx.read().get_field_text("hostname"));
- let fingerprint = get_fingerprint(&form_ctx);
- crate::pdm_client()
+ pdm_client
.pve_probe_tls(&hostname, fingerprint.as_deref())
.await
.map_err(Error::from)
}
- RemoteType::Pbs => bail!("not implemented"),
+ RemoteType::Pbs => {
+ pdm_client
+ .pbs_probe_tls(&hostname, fingerprint.as_deref())
+ .await
+ .map_err(Error::from)
+ }
}
}
diff --git a/ui/src/remotes/wizard_page_info.rs b/ui/src/remotes/wizard_page_info.rs
index da7c38b..1e0bdf1 100644
--- a/ui/src/remotes/wizard_page_info.rs
+++ b/ui/src/remotes/wizard_page_info.rs
@@ -18,7 +18,7 @@ use pwt::{
AsyncPool,
};
-use pdm_api_types::remotes::{NodeUrl, Remote};
+use pdm_api_types::remotes::{NodeUrl, Remote, RemoteType};
use pwt_macros::builder;
@@ -37,11 +37,12 @@ pub struct WizardPageInfo {
#[builder]
#[prop_or_default]
connect_info: Option<ConnectParams>,
+ remote_type: RemoteType,
}
impl WizardPageInfo {
- pub fn new(info: WizardPageRenderInfo) -> Self {
- yew::props!(Self { info })
+ pub fn new(info: WizardPageRenderInfo, remote_type: RemoteType) -> Self {
+ yew::props!(Self { info, remote_type })
}
}
@@ -72,7 +73,7 @@ pub struct ScanParams {
fingerprint: Option<String>,
}
-async fn scan(connection_params: ConnectParams, form_ctx: FormContext) -> Result<Remote, Error> {
+async fn scan(connection_params: ConnectParams, form_ctx: FormContext, remote_type: RemoteType) -> Result<Remote, Error> {
let mut data = form_ctx.get_submit_data();
data["hostname"] = connection_params.hostname.into();
@@ -87,9 +88,15 @@ async fn scan(connection_params: ConnectParams, form_ctx: FormContext) -> Result
fingerprint,
} = serde_json::from_value(data.clone())?;
- let mut result = crate::pdm_client()
- .pve_scan_remote(&hostname, fingerprint.as_deref(), &authid, &token)
- .await?;
+ let client = crate::pdm_client();
+ let mut result = match remote_type {
+ RemoteType::Pve => client
+ .pve_scan_remote(&hostname, fingerprint.as_deref(), &authid, &token)
+ .await?,
+ RemoteType::Pbs => client
+ .pbs_scan_remote(&hostname, fingerprint.as_deref(), &authid, &token)
+ .await?,
+ };
// try to deduplicate the entered info from the first page with the nodelist here
// either via the hostname or the fingerprint. if none matches the entered info will
@@ -235,8 +242,10 @@ impl Component for PdmWizardPageInfo {
props.info.page_lock(true);
if let Some(connection_info) = props.connect_info.clone() {
+ let remote_type = props.remote_type;
+
self.async_pool.spawn(async move {
- let result = scan(connection_info, form_ctx).await;
+ let result = scan(connection_info, form_ctx, remote_type).await;
link.send_message(Msg::ConnectResult(result));
});
} else {
--
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-09-22 11:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 11:09 [pdm-devel] [PATCH datacenter-manager 0/6] ui/api: implement and expose adding PBS remotes via the ui wizard Christian Ebner
2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 1/6] server: api: add TLS probe endpoint for PBS Christian Ebner
2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 2/6] pdm-client: add method to probe TLS connection for PBS remotes Christian Ebner
2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 3/6] server: api: implement endpoint to scan remote PBS instances Christian Ebner
2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 4/6] pdm client: add method " Christian Ebner
2025-09-22 11:09 ` Christian Ebner [this message]
2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 6/6] ui: reorganize remote add button as dropdown menu to allow adding PBS Christian Ebner
2025-09-22 12:50 ` [pdm-devel] [PATCH datacenter-manager 0/6] ui/api: implement and expose adding PBS remotes via the ui wizard Lukas Wagner
2025-09-22 12:56 ` Christian Ebner
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=20250922110958.369653-6-c.ebner@proxmox.com \
--to=c.ebner@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.