[pdm-devel] [PATCH datacenter-manager 13/21] ui: pve wizard: info: use pdm_client for scanning
Dominik Csapak
d.csapak at proxmox.com
Fri May 16 15:36:03 CEST 2025
so that we don't have to use a string as the api path and get better
type safety.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
ui/src/remotes/wizard_page_info.rs | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/ui/src/remotes/wizard_page_info.rs b/ui/src/remotes/wizard_page_info.rs
index 9953f42..882eebd 100644
--- a/ui/src/remotes/wizard_page_info.rs
+++ b/ui/src/remotes/wizard_page_info.rs
@@ -94,18 +94,25 @@ async fn scan(connection_params: ConnectParams, form_ctx: FormContext) -> Result
data["fingerprint"] = fp.into();
}
- let data: ScanParams = serde_json::from_value(data.clone())?;
-
- let params = serde_json::to_value(&data)?;
- let mut result = match proxmox_yew_comp::http_post("/pve/scan", Some(params)).await? {
+ let ScanParams {
+ hostname,
+ authid,
+ token,
+ fingerprint,
+ } = serde_json::from_value(data.clone())?;
+
+ let mut result = match crate::pdm_client()
+ .pve_scan_remote(&hostname, fingerprint.as_deref(), &authid, &token)
+ .await?
+ {
ScanResult::TlsResult(_) => bail!("Untrusted certificate or invalid fingerprint"),
ScanResult::Remote(remote) => remote,
};
result.nodes.insert(
0,
PropertyString::new(NodeUrl {
- hostname: data.hostname,
- fingerprint: data.fingerprint,
+ hostname,
+ fingerprint,
}),
);
result.nodes.sort_by(|a, b| a.hostname.cmp(&b.hostname));
--
2.39.5
More information about the pdm-devel
mailing list