all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager 0/6] ui/api: implement and expose adding PBS remotes via the ui wizard
@ 2025-09-22 11:09 Christian Ebner
  2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 1/6] server: api: add TLS probe endpoint for PBS Christian Ebner
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

While it is already possible to add PBS remote via the cli, the UI currently
does not expose this functionality. Most of the required pieces are however
already there, so implement the missing api endpoints to check the TLS
connection and scan the remote for the PDM api and add the required methods to
the PDM client.

Finally, make sure the correct PDM implementation for PBS is used based on the
remote type as stored in the remote add wizard state and expose the button
to add the PBS instance.

datacenter-manager:

Christian Ebner (6):
  server: api: add TLS probe endpoint for PBS
  pdm-client: add method to probe TLS connection for PBS remotes
  server: api: implement endpoint to scan remote PBS instances
  pdm client: add method to scan remote PBS instances
  ui: remote: check connection for PBS remotes in remote add wizard
  ui: reorganize remote add button as dropdown menu to allow adding PBS

 lib/pdm-client/src/lib.rs             |  90 +++++++++++++++-------
 server/src/api/pbs/mod.rs             | 107 ++++++++++++++++++++++++--
 ui/src/remotes/add_wizard.rs          |   2 +-
 ui/src/remotes/config.rs              |  42 +++++-----
 ui/src/remotes/wizard_page_connect.rs |  16 ++--
 ui/src/remotes/wizard_page_info.rs    |  25 ++++--
 6 files changed, 211 insertions(+), 71 deletions(-)


Summary over all repositories:
  6 files changed, 211 insertions(+), 71 deletions(-)

-- 
Generated by git-murpp 0.8.1


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 1/6] server: api: add TLS probe endpoint for PBS
  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 ` 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
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

Analogous to the TLS probe implementation of PVE, add and api
endpoint allowing to probe the PBS hosts TLS certificate so this can
be checked by the remote add wizard.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 server/src/api/pbs/mod.rs | 42 +++++++++++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/server/src/api/pbs/mod.rs b/server/src/api/pbs/mod.rs
index a31481e..0ca97cd 100644
--- a/server/src/api/pbs/mod.rs
+++ b/server/src/api/pbs/mod.rs
@@ -5,11 +5,11 @@ use proxmox_router::{list_subdirs_api_method, Permission, Router, SubdirMap};
 use proxmox_schema::api;
 use proxmox_sortable_macro::sortable;
 
-use pdm_api_types::remotes::REMOTE_ID_SCHEMA;
-use pdm_api_types::PRIV_RESOURCE_AUDIT;
+use pdm_api_types::remotes::{RemoteType, TlsProbeOutcome, REMOTE_ID_SCHEMA};
+use pdm_api_types::{HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY};
 
 use crate::{
-    connection,
+    connection::{self, probe_tls_connection},
     pbs_client::{self, get_remote},
 };
 
@@ -20,7 +20,10 @@ pub const ROUTER: Router = Router::new()
     .subdirs(SUBDIRS);
 
 #[sortable]
-const SUBDIRS: SubdirMap = &sorted!([("remotes", &REMOTES_ROUTER)]);
+const SUBDIRS: SubdirMap = &sorted!([
+    ("remotes", &REMOTES_ROUTER),
+    ("probe-tls", &Router::new().post(&API_METHOD_PROBE_TLS)),
+]);
 
 const REMOTES_ROUTER: Router = Router::new().match_all("remote", &MAIN_ROUTER);
 
@@ -112,3 +115,34 @@ async fn list_snapshots_2(
     }
     .into())
 }
+
+#[api(
+    input: {
+        properties: {
+            hostname: {
+                type: String,
+                format: &HOST_OPTIONAL_PORT_FORMAT,
+                description: "Hostname (with optional port) of the target remote",
+            },
+            fingerprint: {
+                type: String,
+                description: "Fingerprint of the target remote.",
+                optional: true,
+            },
+        },
+    },
+    access: {
+        permission:
+            &Permission::Privilege(&["/"], PRIV_SYS_MODIFY, false),
+    },
+)]
+/// Probe the hosts TLS certificate.
+///
+/// If the certificate is not trusted with the given parameters, returns the certificate
+/// information.
+async fn probe_tls(
+    hostname: String,
+    fingerprint: Option<String>,
+) -> Result<TlsProbeOutcome, Error> {
+    probe_tls_connection(RemoteType::Pbs, hostname, fingerprint).await
+}
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 2/6] pdm-client: add method to probe TLS connection for PBS remotes
  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 ` 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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

Adds the PDM client method to perform API calls to the servers
TLS probe endpoint for PBS, analogous to the PVE implementation.

Since this is mostly the same for both remote types, common code is
factored into a generic private helper method.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 lib/pdm-client/src/lib.rs | 41 ++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index f2ff4d4..e8a4ee5 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -3,7 +3,7 @@
 use std::collections::HashMap;
 use std::time::Duration;
 
-use pdm_api_types::remotes::TlsProbeOutcome;
+use pdm_api_types::remotes::{RemoteType, TlsProbeOutcome};
 use pdm_api_types::resource::{PveResource, RemoteResources, ResourceType, TopEntities};
 use pdm_api_types::rrddata::{
     LxcDataPoint, NodeDataPoint, PbsDatastoreDataPoint, PbsNodeDataPoint, PveStorageDataPoint,
@@ -976,18 +976,7 @@ impl<T: HttpApiClient> PdmClient<T> {
         hostname: &str,
         fingerprint: Option<&str>,
     ) -> Result<TlsProbeOutcome, Error> {
-        let mut params = json!({
-            "hostname": hostname,
-        });
-        if let Some(fp) = fingerprint {
-            params["fingerprint"] = fp.into();
-        }
-        Ok(self
-            .0
-            .post("/api2/extjs/pve/probe-tls", &params)
-            .await?
-            .expect_json()?
-            .data)
+        self.probe_tls(hostname, fingerprint, RemoteType::Pve).await
     }
 
     /// Uses /pve/scan to scan the remote cluster for node/fingerprint information
@@ -1068,6 +1057,32 @@ impl<T: HttpApiClient> PdmClient<T> {
 
         Ok(self.0.post(path, &params).await?.expect_json()?.data)
     }
+
+    /// uses /pbs/probe-tls to probe the tls connection to the given host
+    pub async fn pbs_probe_tls(
+        &self,
+        hostname: &str,
+        fingerprint: Option<&str>,
+    ) -> Result<TlsProbeOutcome, Error> {
+        self.probe_tls(hostname, fingerprint, RemoteType::Pbs).await
+    }
+
+    /// uses /{remote-type}/probe-tls to probe the tls connection to the given host
+    async fn probe_tls(
+        &self,
+        hostname: &str,
+        fingerprint: Option<&str>,
+        remote_type: RemoteType,
+    ) -> Result<TlsProbeOutcome, Error> {
+        let path = format!("/api2/extjs/{remote_type}/probe-tls");
+        let mut params = json!({
+            "hostname": hostname,
+        });
+        if let Some(fp) = fingerprint {
+            params["fingerprint"] = fp.into();
+        }
+        Ok(self.0.post(&path, &params).await?.expect_json()?.data)
+    }
 }
 
 /// Builder for migration parameters.
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 3/6] server: api: implement endpoint to scan remote PBS instances
  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 ` Christian Ebner
  2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 4/6] pdm client: add method " Christian Ebner
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

Provide the analogous api endpoint as for PVE, but since there is no
cluster information and only a single host for PBS, limit the
implementation to a basic login check using the provided credentials
for now.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 server/src/api/pbs/mod.rs | 69 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 65 insertions(+), 4 deletions(-)

diff --git a/server/src/api/pbs/mod.rs b/server/src/api/pbs/mod.rs
index 0ca97cd..2e203ca 100644
--- a/server/src/api/pbs/mod.rs
+++ b/server/src/api/pbs/mod.rs
@@ -1,16 +1,17 @@
-use anyhow::Error;
+use anyhow::{format_err, Error};
 use futures::StreamExt;
 
 use proxmox_router::{list_subdirs_api_method, Permission, Router, SubdirMap};
 use proxmox_schema::api;
+use proxmox_schema::property_string::PropertyString;
 use proxmox_sortable_macro::sortable;
 
-use pdm_api_types::remotes::{RemoteType, TlsProbeOutcome, REMOTE_ID_SCHEMA};
-use pdm_api_types::{HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY};
+use pdm_api_types::remotes::{NodeUrl, Remote, RemoteType, TlsProbeOutcome, REMOTE_ID_SCHEMA};
+use pdm_api_types::{Authid, HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY};
 
 use crate::{
     connection::{self, probe_tls_connection},
-    pbs_client::{self, get_remote},
+    pbs_client::{self, get_remote, PbsClient},
 };
 
 mod rrddata;
@@ -22,6 +23,7 @@ pub const ROUTER: Router = Router::new()
 #[sortable]
 const SUBDIRS: SubdirMap = &sorted!([
     ("remotes", &REMOTES_ROUTER),
+    ("scan", &Router::new().post(&API_METHOD_SCAN_REMOTE_PBS)),
     ("probe-tls", &Router::new().post(&API_METHOD_PROBE_TLS)),
 ]);
 
@@ -146,3 +148,62 @@ async fn probe_tls(
 ) -> Result<TlsProbeOutcome, Error> {
     probe_tls_connection(RemoteType::Pbs, hostname, fingerprint).await
 }
+
+pub async fn connect_or_login(remote: &Remote) -> Result<Box<PbsClient>, Error> {
+    connection::make_pbs_client_and_login(remote).await
+}
+
+#[api(
+    input: {
+        properties: {
+            hostname: {
+                type: String,
+                format: &HOST_OPTIONAL_PORT_FORMAT,
+                description: "Hostname (with optional port) of the target remote",
+            },
+            fingerprint: {
+                type: String,
+                description: "Fingerprint of the target remote.",
+                optional: true,
+            },
+            "authid": {
+                type: Authid,
+            },
+            "token": {
+                type: String,
+                description: "The token secret or the user password.",
+            },
+        },
+    },
+    access: {
+        permission:
+            &Permission::Privilege(&["/"], PRIV_SYS_MODIFY, false),
+    },
+)]
+/// Scans the given connection info for pbs host information.
+///
+/// Checks login using the provided credentials.
+pub async fn scan_remote_pbs(
+    hostname: String,
+    fingerprint: Option<String>,
+    authid: Authid,
+    token: String,
+) -> Result<Remote, Error> {
+    let remote = Remote {
+        ty: RemoteType::Pbs,
+        id: hostname.clone(),
+        nodes: vec![PropertyString::new(NodeUrl {
+            hostname,
+            fingerprint,
+        })],
+        authid: authid.clone(),
+        token,
+        web_url: None,
+    };
+
+    let _client = connect_or_login(&remote)
+        .await
+        .map_err(|err| format_err!("could not login: {err}"))?;
+
+    Ok(remote)
+}
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 4/6] pdm client: add method to scan remote PBS instances
  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
                   ` (2 preceding siblings ...)
  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 ` Christian Ebner
  2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 5/6] ui: remote: check connection for PBS remotes in remote add wizard Christian Ebner
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

Adds the PDM client method to perform API calls to the servers
scan remote endpoint for PBS, analogous to the PVE implementation.

Since this is mostly the same for both remote types, common code is
factored into a generic private helper method.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 lib/pdm-client/src/lib.rs | 49 ++++++++++++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 14 deletions(-)

diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index e8a4ee5..f81de67 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -987,20 +987,8 @@ impl<T: HttpApiClient> PdmClient<T> {
         authid: &str,
         token: &str,
     ) -> Result<Remote, Error> {
-        let mut params = json!({
-            "hostname": hostname,
-            "authid": authid,
-            "token": token,
-        });
-        if let Some(fp) = fingerprint {
-            params["fingerprint"] = fp.into();
-        }
-        Ok(self
-            .0
-            .post("/api2/extjs/pve/scan", &params)
-            .await?
-            .expect_json()?
-            .data)
+        self.scan_remote(hostname, fingerprint, authid, token, RemoteType::Pve)
+            .await
     }
 
     pub async fn pve_sdn_list_controllers(
@@ -1083,6 +1071,39 @@ impl<T: HttpApiClient> PdmClient<T> {
         }
         Ok(self.0.post(&path, &params).await?.expect_json()?.data)
     }
+
+    /// Uses /pbs/scan to scan the remote cluster for node/fingerprint information
+    pub async fn pbs_scan_remote(
+        &self,
+        hostname: &str,
+        fingerprint: Option<&str>,
+        authid: &str,
+        token: &str,
+    ) -> Result<Remote, Error> {
+        self.scan_remote(hostname, fingerprint, authid, token, RemoteType::Pbs)
+            .await
+    }
+
+    /// Uses /{remote-type}/scan to scan the remote for node/fingerprint information
+    pub async fn scan_remote(
+        &self,
+        hostname: &str,
+        fingerprint: Option<&str>,
+        authid: &str,
+        token: &str,
+        remote_type: RemoteType,
+    ) -> Result<Remote, Error> {
+        let path = format!("/api2/extjs/{remote_type}/scan");
+        let mut params = json!({
+            "hostname": hostname,
+            "authid": authid,
+            "token": token,
+        });
+        if let Some(fp) = fingerprint {
+            params["fingerprint"] = fp.into();
+        }
+        Ok(self.0.post(&path, &params).await?.expect_json()?.data)
+    }
 }
 
 /// Builder for migration parameters.
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 5/6] ui: remote: check connection for PBS remotes in remote add wizard
  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
                   ` (3 preceding siblings ...)
  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
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 6/6] ui: reorganize remote add button as dropdown menu to allow adding PBS
  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
                   ` (4 preceding siblings ...)
  2025-09-22 11:09 ` [pdm-devel] [PATCH datacenter-manager 5/6] ui: remote: check connection for PBS remotes in remote add wizard Christian Ebner
@ 2025-09-22 11:09 ` 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 17:59 ` [pdm-devel] applied-series: " Thomas Lamprecht
  7 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 11:09 UTC (permalink / raw)
  To: pdm-devel

Already implemented, just switch out the code in the comment with the
current one.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 ui/src/remotes/config.rs | 42 +++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/ui/src/remotes/config.rs b/ui/src/remotes/config.rs
index db5646b..7efc6e8 100644
--- a/ui/src/remotes/config.rs
+++ b/ui/src/remotes/config.rs
@@ -25,7 +25,7 @@ use pwt::state::{Selection, Store};
 use pwt::widget::data_table::{DataTable, DataTableColumn, DataTableHeader};
 //use pwt::widget::form::{delete_empty_values, Field, FormContext, InputType};
 use pwt::widget::{
-    //menu::{Menu, MenuButton, MenuItem},
+    menu::{Menu, MenuButton, MenuItem},
     Button,
     Column,
     Toolbar,
@@ -173,29 +173,23 @@ impl LoadableComponent for PbsRemoteConfigPanel {
             .class("pwt-overflow-hidden")
             .class("pwt-border-bottom")
             .with_child({
-                Button::new(tr!("Add Proxmox VE"))
-                    .icon_class("fa fa-building")
-                    .on_activate(
-                        link.change_view_callback(|_| Some(ViewState::Add(RemoteType::Pve))),
-                    )
-                // FIXME: add PBS support
-                //MenuButton::new(tr!("Add")).show_arrow(true).menu(
-                //    Menu::new()
-                //        .with_item(
-                //            MenuItem::new("Proxmox VE")
-                //                .icon_class("fa fa-building")
-                //                .on_select(link.change_view_callback(|_| {
-                //                    Some(ViewState::Add(RemoteType::Pve))
-                //                })),
-                //        )
-                //        .with_item(
-                //            MenuItem::new("Proxmox Backup Server")
-                //                .icon_class("fa fa-floppy-o")
-                //                .on_select(link.change_view_callback(|_| {
-                //                    Some(ViewState::Add(RemoteType::Pbs))
-                //                })),
-                //        ),
-                //)
+                MenuButton::new(tr!("Add")).show_arrow(true).menu(
+                    Menu::new()
+                        .with_item(
+                            MenuItem::new("Proxmox VE")
+                                .icon_class("fa fa-building")
+                                .on_select(link.change_view_callback(|_| {
+                                    Some(ViewState::Add(RemoteType::Pve))
+                                })),
+                        )
+                        .with_item(
+                            MenuItem::new("Proxmox Backup Server")
+                                .icon_class("fa fa-floppy-o")
+                                .on_select(link.change_view_callback(|_| {
+                                    Some(ViewState::Add(RemoteType::Pbs))
+                                })),
+                        ),
+                )
             })
             .with_spacer()
             .with_child(
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [pdm-devel] [PATCH datacenter-manager 0/6] ui/api: implement and expose adding PBS remotes via the ui wizard
  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
                   ` (5 preceding siblings ...)
  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 ` Lukas Wagner
  2025-09-22 12:56   ` Christian Ebner
  2025-09-22 17:59 ` [pdm-devel] applied-series: " Thomas Lamprecht
  7 siblings, 1 reply; 10+ messages in thread
From: Lukas Wagner @ 2025-09-22 12:50 UTC (permalink / raw)
  To: Proxmox Datacenter Manager development discussion, Christian Ebner

On Mon Sep 22, 2025 at 1:09 PM CEST, Christian Ebner wrote:
> While it is already possible to add PBS remote via the cli, the UI currently
> does not expose this functionality. Most of the required pieces are however
> already there, so implement the missing api endpoints to check the TLS
> connection and scan the remote for the PDM api and add the required methods to
> the PDM client.
>
> Finally, make sure the correct PDM implementation for PBS is used based on the
> remote type as stored in the remote add wizard state and expose the button
> to add the PBS instance.
>
> datacenter-manager:
>
> Christian Ebner (6):
>   server: api: add TLS probe endpoint for PBS
>   pdm-client: add method to probe TLS connection for PBS remotes
>   server: api: implement endpoint to scan remote PBS instances
>   pdm client: add method to scan remote PBS instances
>   ui: remote: check connection for PBS remotes in remote add wizard
>   ui: reorganize remote add button as dropdown menu to allow adding PBS
>
>  lib/pdm-client/src/lib.rs             |  90 +++++++++++++++-------
>  server/src/api/pbs/mod.rs             | 107 ++++++++++++++++++++++++--
>  ui/src/remotes/add_wizard.rs          |   2 +-
>  ui/src/remotes/config.rs              |  42 +++++-----
>  ui/src/remotes/wizard_page_connect.rs |  16 ++--
>  ui/src/remotes/wizard_page_info.rs    |  25 ++++--
>  6 files changed, 211 insertions(+), 71 deletions(-)
>
>
> Summary over all repositories:
>   6 files changed, 211 insertions(+), 71 deletions(-)

Looks good to me. I applied this on the latest master and give it a
spin.

Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>

The only thing that I noticed is that when creating a new API token via
the wizard, further API calls to actually give this new token adequate
permissions are needed, since PBS enforces privilege-separation for API
tokens. For PVE this is not a problem, since there we just don't use
privilege-separation, so the token has the same privs as the user.


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [pdm-devel] [PATCH datacenter-manager 0/6] ui/api: implement and expose adding PBS remotes via the ui wizard
  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
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Ebner @ 2025-09-22 12:56 UTC (permalink / raw)
  To: Lukas Wagner, Proxmox Datacenter Manager development discussion

On 9/22/25 2:49 PM, Lukas Wagner wrote:
> On Mon Sep 22, 2025 at 1:09 PM CEST, Christian Ebner wrote:
>> While it is already possible to add PBS remote via the cli, the UI currently
>> does not expose this functionality. Most of the required pieces are however
>> already there, so implement the missing api endpoints to check the TLS
>> connection and scan the remote for the PDM api and add the required methods to
>> the PDM client.
>>
>> Finally, make sure the correct PDM implementation for PBS is used based on the
>> remote type as stored in the remote add wizard state and expose the button
>> to add the PBS instance.
>>
>> datacenter-manager:
>>
>> Christian Ebner (6):
>>    server: api: add TLS probe endpoint for PBS
>>    pdm-client: add method to probe TLS connection for PBS remotes
>>    server: api: implement endpoint to scan remote PBS instances
>>    pdm client: add method to scan remote PBS instances
>>    ui: remote: check connection for PBS remotes in remote add wizard
>>    ui: reorganize remote add button as dropdown menu to allow adding PBS
>>
>>   lib/pdm-client/src/lib.rs             |  90 +++++++++++++++-------
>>   server/src/api/pbs/mod.rs             | 107 ++++++++++++++++++++++++--
>>   ui/src/remotes/add_wizard.rs          |   2 +-
>>   ui/src/remotes/config.rs              |  42 +++++-----
>>   ui/src/remotes/wizard_page_connect.rs |  16 ++--
>>   ui/src/remotes/wizard_page_info.rs    |  25 ++++--
>>   6 files changed, 211 insertions(+), 71 deletions(-)
>>
>>
>> Summary over all repositories:
>>    6 files changed, 211 insertions(+), 71 deletions(-)
> 
> Looks good to me. I applied this on the latest master and give it a
> spin.
> 
> Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
> Tested-by: Lukas Wagner <l.wagner@proxmox.com>
> 
> The only thing that I noticed is that when creating a new API token via
> the wizard, further API calls to actually give this new token adequate
> permissions are needed, since PBS enforces privilege-separation for API
> tokens. For PVE this is not a problem, since there we just don't use
> privilege-separation, so the token has the same privs as the user.

Thanks for review and testing!

Noticed the missing privs for the token only after sending the patches. 
Will adapt this as followup patches however, as the privileges will 
depend also on what information should be shown for the PBS hosts. 
`Datastore.Audit` on path `/datastore` should be enough for the initial 
listing of the backup snapshots.


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pdm-devel] applied-series: [PATCH datacenter-manager 0/6] ui/api: implement and expose adding PBS remotes via the ui wizard
  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
                   ` (6 preceding siblings ...)
  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 17:59 ` Thomas Lamprecht
  7 siblings, 0 replies; 10+ messages in thread
From: Thomas Lamprecht @ 2025-09-22 17:59 UTC (permalink / raw)
  To: pdm-devel, Christian Ebner

On Mon, 22 Sep 2025 13:09:52 +0200, Christian Ebner wrote:
> While it is already possible to add PBS remote via the cli, the UI currently
> does not expose this functionality. Most of the required pieces are however
> already there, so implement the missing api endpoints to check the TLS
> connection and scan the remote for the PDM api and add the required methods to
> the PDM client.
> 
> Finally, make sure the correct PDM implementation for PBS is used based on the
> remote type as stored in the remote add wizard state and expose the button
> to add the PBS instance.
> 
> [...]

Applied, thanks!

btw. some pre-existing things that I noticed with the remote add wizard,
certainly do not have to be fixed by you, just wanted to jot them down before I
forget them. Anyway:

- One can use a full URL with https:// and trailing slash and the probe will
  work fine, but on the final step of the wizard one will get an error about a
  invalid character in the URL. Would be great if this works (or does not work)
  consistently for probing and actual usage; e.g. by stripping default
  protocol, single trailing slash or default port (or whatever is required to
  make it work).

- after going back just to edit the URL the whole wizard gets reset, that is
  not really that nice. It's not a trivial thing to solve in an always correct
  way, so maybe ask the user about wanting to reset the wizard? But IMO most of
  the time all data one entered was entered with the intend for it to actually
  be correct, so fixing small typos should probably not reset anything by
  default, as what's the upside here? A compromis might be to deactivate the
  next steps but retain the values, that way all intra-step checks will be
  executed but an user does not needs to re-enter information.

- The URL won't be updated when going back from the summary page of the wizard
  to the first and changing it. At least the same old value was rendered in the
  summary and when then going back again to the first step the outdated value
  was again shown there too (and I got the error from the backend, but did not
  check if the same was actually send, might have had another "error" in the
  URL).

[1/6] server: api: add TLS probe endpoint for PBS
      commit: 239d0eb0cb13eac72686e6c337eb328e8bd0182c
[2/6] pdm-client: add method to probe TLS connection for PBS remotes
      commit: a9837ef08c1082dd6d282dadafd35144b97ddc63
[3/6] server: api: implement endpoint to scan remote PBS instances
      commit: bdb844b271e8397b0346a66f4bf8d1d877f402d3
[4/6] pdm client: add method to scan remote PBS instances
      commit: 645a92d5d6fd0817b059c2a7197be20506e8c1be
[5/6] ui: remote: check connection for PBS remotes in remote add wizard
      commit: 6ce9dcad2b8ec7eb218ce41e18f8942d02dfa3ef
[6/6] ui: reorganize remote add button as dropdown menu to allow adding PBS
      commit: 62a96d23363b8fc6fb2342dd868a8a76f1aab937


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-09-22 18:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pdm-devel] [PATCH datacenter-manager 5/6] ui: remote: check connection for PBS remotes in remote add wizard Christian Ebner
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
2025-09-22 17:59 ` [pdm-devel] applied-series: " Thomas Lamprecht

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal