all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 3/4] pdm-client: return the cluster flag with the remote list
Date: Tue,  1 Dec 2026 16:12:07 +0100	[thread overview]
Message-ID: <20261201151531.3348382-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261201151531.3348382-1-d.csapak@proxmox.com>

by returning `ListedRemote` from `list_remotes`, so that the UI can
use it.

Adapt the remote list of the UI to keep the `ListedRemote` entries.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 lib/pdm-client/src/lib.rs |  4 ++--
 ui/src/folders/mod.rs     |  4 ++--
 ui/src/lib.rs             | 12 ++++++------
 ui/src/main.rs            |  4 ++--
 ui/src/remotes/config.rs  | 10 +++++-----
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index af5c7d0d..1f5adf77 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -37,7 +37,7 @@ use types::*;
 pub mod types {
     pub use proxmox_access_control::types::{User, UserWithTokens};
 
-    pub use pdm_api_types::remotes::Remote;
+    pub use pdm_api_types::remotes::{ListedRemote, Remote};
     pub use pdm_api_types::{
         AclListItem, Authid, ConfigurationState, NodePowerCommand, RemoteUpid,
     };
@@ -133,7 +133,7 @@ pub struct PveListStoragesFilter {
 
 impl<T: HttpApiClient> PdmClient<T> {
     /// List the remotes, optionally limited to a folder subtree.
-    pub async fn list_remotes(&self, folder: Option<&str>) -> Result<Vec<Remote>, Error> {
+    pub async fn list_remotes(&self, folder: Option<&str>) -> Result<Vec<ListedRemote>, Error> {
         let path = ApiPathBuilder::new("/api2/extjs/remotes/remote")
             .maybe_arg("folder", &folder)
             .build();
diff --git a/ui/src/folders/mod.rs b/ui/src/folders/mod.rs
index 77465aa7..c0501476 100644
--- a/ui/src/folders/mod.rs
+++ b/ui/src/folders/mod.rs
@@ -4,7 +4,7 @@ use std::rc::Rc;
 use pdm_api_types::folders::{
     FolderListEntry, folder_acl_path, folder_ancestry, folder_name, folder_order, folder_parent,
 };
-use pdm_api_types::remotes::{Remote, RemoteType};
+use pdm_api_types::remotes::{ListedRemote, RemoteType};
 use pdm_client::ConfigDigest;
 use pwt::prelude::*;
 use serde::{Deserialize, Serialize};
@@ -68,7 +68,7 @@ impl CatalogData {
     pub fn new(
         folders: Vec<FolderListEntry>,
         digest: Option<ConfigDigest>,
-        remotes: &[Remote],
+        remotes: &[ListedRemote],
     ) -> Self {
         let remotes = remotes
             .iter()
diff --git a/ui/src/lib.rs b/ui/src/lib.rs
index 7dbc591b..1caec158 100644
--- a/ui/src/lib.rs
+++ b/ui/src/lib.rs
@@ -4,7 +4,7 @@ use gloo_utils::format::JsValueSerdeExt;
 use gloo_utils::window;
 use js_sys::{Array, JsString, Object};
 use pdm_api_types::remote_updates::RemoteUpdateSummary;
-use pdm_api_types::remotes::RemoteType;
+use pdm_api_types::remotes::{ListedRemote, RemoteType};
 use pdm_api_types::resource::AsResourceView;
 use pdm_api_types::subscription::PdmSubscriptionInfo;
 use proxmox_deb_version::Version;
@@ -117,17 +117,17 @@ pub fn shown_error(err: impl Into<anyhow::Error>) -> anyhow::Error {
 }
 
 #[derive(Clone, Default, PartialEq, Serialize, Deserialize)]
-pub struct RemoteList(Vec<pdm_client::types::Remote>);
+pub struct RemoteList(Vec<ListedRemote>);
 
-impl From<Vec<pdm_client::types::Remote>> for RemoteList {
-    fn from(mut value: Vec<pdm_client::types::Remote>) -> Self {
+impl From<Vec<ListedRemote>> for RemoteList {
+    fn from(mut value: Vec<ListedRemote>) -> Self {
         value.retain(|remote| !remote.is_disabled());
         Self(value)
     }
 }
 
 impl std::ops::Deref for RemoteList {
-    type Target = [pdm_client::types::Remote];
+    type Target = [ListedRemote];
 
     fn deref(&self) -> &Self::Target {
         &self.0
@@ -168,7 +168,7 @@ pub(crate) fn get_remote<C: yew::Component>(
 ) -> Option<pdm_client::types::Remote> {
     for remote in get_remote_list(link)?.iter() {
         if remote.id == id {
-            return Some(remote.clone());
+            return Some(remote.remote.clone());
         }
     }
 
diff --git a/ui/src/main.rs b/ui/src/main.rs
index 72f5ecf0..656d29ea 100644
--- a/ui/src/main.rs
+++ b/ui/src/main.rs
@@ -20,7 +20,7 @@ use proxmox_yew_comp::{
 };
 
 use pdm_api_types::folders::FolderListEntry;
-use pdm_api_types::remotes::Remote;
+use pdm_api_types::remotes::ListedRemote;
 use pdm_api_types::views::ViewConfig;
 use pdm_ui::folders::{CatalogCache, CatalogData, CatalogProvider, CatalogStatus, FolderCatalog};
 use pdm_ui::{
@@ -28,7 +28,7 @@ use pdm_ui::{
     ViewListContext, check_pdm_subscription, pdm_subscription_alert,
 };
 
-type MsgRemoteList = Result<Vec<Remote>, proxmox_client::Error>;
+type MsgRemoteList = Result<Vec<ListedRemote>, proxmox_client::Error>;
 type MsgFolderList =
     Result<(Vec<FolderListEntry>, Option<pdm_client::ConfigDigest>), proxmox_client::Error>;
 type MsgViewList = Result<Vec<String>, Error>;
diff --git a/ui/src/remotes/config.rs b/ui/src/remotes/config.rs
index c11502d8..5391524b 100644
--- a/ui/src/remotes/config.rs
+++ b/ui/src/remotes/config.rs
@@ -14,7 +14,7 @@ use crate::remotes::remove_remote::RemoveRemote;
 use crate::remotes::{remote_status_display, updates};
 
 use pdm_api_types::folders::folder_relative;
-use pdm_api_types::remotes::{Remote, RemoteStatusSummary};
+use pdm_api_types::remotes::{ListedRemote, Remote, RemoteStatusSummary};
 use pdm_api_types::resource::RemoteStatus;
 use pdm_api_types::{PRIV_RESOURCE_AUDIT, PRIV_RESOURCE_MODIFY};
 use proxmox_yew_comp::AclContext;
@@ -124,7 +124,7 @@ pub enum Msg {
     RemoveItem(bool),
     /// The loaded remotes and their status.
     Loaded(
-        Result<Vec<Remote>, String>,
+        Result<Vec<ListedRemote>, String>,
         Result<Vec<RemoteStatusSummary>, String>,
     ),
     UpdateAcl(AclContext),
@@ -282,9 +282,9 @@ impl LoadableComponent for PbsRemoteConfigPanel {
                         self.store.write().set_data(
                             remotes
                                 .into_iter()
-                                .map(|remote| RemoteEntry {
-                                    status: status.remove(&remote.id),
-                                    remote,
+                                .map(|entry| RemoteEntry {
+                                    status: status.remove(&entry.id),
+                                    remote: entry.remote,
                                 })
                                 .collect(),
                         );
-- 
2.47.3





  parent reply	other threads:[~2026-12-01 15:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 15:12 [PATCH datacenter-manager 0/4] api/ui: show consistent remote icons Dominik Csapak
2026-12-01 15:12 ` [PATCH datacenter-manager 1/4] server: remote mapping: remember whether a pve remote is a cluster Dominik Csapak
2026-12-01 15:12 ` [PATCH datacenter-manager 2/4] api: remotes: report whether a remote is a cluster in the list Dominik Csapak
2026-12-01 15:12 ` Dominik Csapak [this message]
2026-12-01 15:12 ` [PATCH datacenter-manager 4/4] ui: use consistent icons for the types of remotes Dominik Csapak
2026-12-01 18:29 ` applied: [PATCH datacenter-manager 0/4] api/ui: show consistent remote icons Thomas Lamprecht

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=20261201151531.3348382-4-d.csapak@proxmox.com \
    --to=d.csapak@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal