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 907741FF09F for ; Tue, 01 Dec 2026 16:15:40 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id AA8C720C96; Tue, 01 Dec 2026 16:15:36 +0100 (CET) From: Dominik Csapak 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 Message-ID: <20261201151531.3348382-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201151531.3348382-1-d.csapak@proxmox.com> References: <20261201151531.3348382-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.243 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: SZAWSKUIDOM6GWMIJPJUKLQJ5EVG5QNQ X-Message-ID-Hash: SZAWSKUIDOM6GWMIJPJUKLQJ5EVG5QNQ 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: 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 --- 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 PdmClient { /// List the remotes, optionally limited to a folder subtree. - pub async fn list_remotes(&self, folder: Option<&str>) -> Result, Error> { + pub async fn list_remotes(&self, folder: Option<&str>) -> Result, 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, digest: Option, - 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 { } #[derive(Clone, Default, PartialEq, Serialize, Deserialize)] -pub struct RemoteList(Vec); +pub struct RemoteList(Vec); -impl From> for RemoteList { - fn from(mut value: Vec) -> Self { +impl From> for RemoteList { + fn from(mut value: Vec) -> 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( ) -> Option { 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, proxmox_client::Error>; +type MsgRemoteList = Result, proxmox_client::Error>; type MsgFolderList = Result<(Vec, Option), proxmox_client::Error>; type MsgViewList = Result, 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, String>, + Result, String>, Result, 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