all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 2/2] api: move remote-tasks, remote-updates and metrics-collection under /remotes
Date: Tue,  2 Dec 2025 10:25:54 +0100	[thread overview]
Message-ID: <20251202092712.368428-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20251202092712.368428-1-f.gruenbichler@proxmox.com>

these are all endpoints/trees which are remote-type agnostic, but they are not
important enough to warrant their own top-level entry point..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
I hope I haven't missed any references, additional testing would be appreciated!

 lib/pdm-client/src/lib.rs          |  8 ++++----
 server/src/api/mod.rs              |  4 ----
 server/src/api/remotes.rs          | 10 +++++++++-
 ui/src/dashboard/filtered_tasks.rs |  2 +-
 ui/src/dashboard/view.rs           |  2 +-
 ui/src/main.rs                     |  2 +-
 ui/src/remotes/tasks.rs            |  2 +-
 7 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 2e4e3fc..8cce4f1 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -343,7 +343,7 @@ impl<T: HttpApiClient> PdmClient<T> {
         &self,
         remote: Option<&str>,
     ) -> Result<(), proxmox_client::Error> {
-        let path = "/api2/extjs/metric-collection/trigger";
+        let path = "/api2/extjs/remotes/metric-collection/trigger";
 
         #[derive(Serialize)]
         struct TriggerParams<'a> {
@@ -363,7 +363,7 @@ impl<T: HttpApiClient> PdmClient<T> {
     pub async fn get_metric_collection_status(
         &self,
     ) -> Result<Vec<pdm_api_types::MetricCollectionStatus>, Error> {
-        let path = "/api2/extjs/metric-collection/status";
+        let path = "/api2/extjs/remotes/metric-collection/status";
         Ok(self.0.get(path).await?.expect_json()?.data)
     }
 
@@ -1326,7 +1326,7 @@ impl<T: HttpApiClient> PdmClient<T> {
     ) -> Result<pdm_api_types::remote_updates::UpdateSummary, Error> {
         Ok(self
             .0
-            .get("/api2/extjs/remote-updates/summary")
+            .get("/api2/extjs/remotes/updates/summary")
             .await?
             .expect_json()?
             .data)
@@ -1336,7 +1336,7 @@ impl<T: HttpApiClient> PdmClient<T> {
     pub async fn refresh_remote_update_summary(&self) -> Result<pdm_api_types::UPID, Error> {
         Ok(self
             .0
-            .post_without_body("/api2/extjs/remote-updates/refresh")
+            .post_without_body("/api2/extjs/remotes/updates/refresh")
             .await?
             .expect_json()?
             .data)
diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs
index e3efed8..5688871 100644
--- a/server/src/api/mod.rs
+++ b/server/src/api/mod.rs
@@ -26,16 +26,12 @@ pub mod sdn;
 const SUBDIRS: SubdirMap = &sorted!([
     ("access", &access::ROUTER),
     ("config", &config::ROUTER),
-    ("metric-collection", &metric_collection::ROUTER),
     ("ping", &Router::new().get(&API_METHOD_PING)),
     ("pve", &pve::ROUTER),
     ("pbs", &pbs::ROUTER),
     ("remotes", &remotes::ROUTER),
     ("resources", &resources::ROUTER),
     ("nodes", &nodes::ROUTER),
-    ("remote-tasks", &remote_tasks::ROUTER),
-    // TODO: There might be a better place for this endpoint.
-    ("remote-updates", &remote_updates::ROUTER),
     ("sdn", &sdn::ROUTER),
     ("version", &Router::new().get(&API_METHOD_VERSION)),
 ]);
diff --git a/server/src/api/remotes.rs b/server/src/api/remotes.rs
index 17f8746..298ad13 100644
--- a/server/src/api/remotes.rs
+++ b/server/src/api/remotes.rs
@@ -21,6 +21,9 @@ use pdm_api_types::remotes::{Remote, RemoteType, RemoteUpdater, REMOTE_ID_SCHEMA
 use pdm_api_types::rrddata::RemoteDatapoint;
 use pdm_api_types::{Authid, ConfigDigest, PRIV_RESOURCE_AUDIT, PRIV_RESOURCE_MODIFY};
 
+use crate::api::metric_collection as metric_collection_api;
+use crate::api::remote_tasks;
+use crate::api::remote_updates;
 use crate::metric_collection;
 use crate::{connection, pbs_client};
 
@@ -33,7 +36,12 @@ pub const ROUTER: Router = Router::new()
     .subdirs(SUBDIRS);
 
 #[sortable]
-const SUBDIRS: SubdirMap = &sorted!([("remote", &REMOTE_ROUTER),]);
+const SUBDIRS: SubdirMap = &sorted!([
+    ("remote", &REMOTE_ROUTER),
+    ("updates", &remote_updates::ROUTER),
+    ("tasks", &remote_tasks::ROUTER),
+    ("metric-collection", &metric_collection_api::ROUTER),
+]);
 
 pub const REMOTE_ROUTER: Router = Router::new()
     .get(&API_METHOD_LIST_REMOTES)
diff --git a/ui/src/dashboard/filtered_tasks.rs b/ui/src/dashboard/filtered_tasks.rs
index fa59e59..bfe3347 100644
--- a/ui/src/dashboard/filtered_tasks.rs
+++ b/ui/src/dashboard/filtered_tasks.rs
@@ -112,7 +112,7 @@ impl PdmFilteredTasks {
             params["remote"] = serde_json::Value::String(remote);
         }
 
-        http_get("/remote-tasks/list", Some(params)).await
+        http_get("/remotes/tasks/list", Some(params)).await
     }
 }
 
diff --git a/ui/src/dashboard/view.rs b/ui/src/dashboard/view.rs
index 2791277..0606f1a 100644
--- a/ui/src/dashboard/view.rs
+++ b/ui/src/dashboard/view.rs
@@ -230,7 +230,7 @@ impl ViewComp {
                             "limit": 0,
                         });
                         add_view_filter(&mut params);
-                        let res = http_get("/remote-tasks/statistics", Some(params)).await;
+                        let res = http_get("/remotes/tasks/statistics", Some(params)).await;
                         link.send_message(Msg::LoadingResult(LoadingResult::TaskStatistics(res)));
                     }
                 };
diff --git a/ui/src/main.rs b/ui/src/main.rs
index b7dd3ef..63ac143 100644
--- a/ui/src/main.rs
+++ b/ui/src/main.rs
@@ -191,7 +191,7 @@ impl Component for DatacenterManagerApp {
                     let mut res: Vec<TaskListItem> =
                         http_get(url.to_string(), params.clone()).await?;
 
-                    let res2: Vec<_> = http_get("/remote-tasks/list", params).await?;
+                    let res2: Vec<_> = http_get("/remotes/tasks/list", params).await?;
                     res.extend_from_slice(&res2);
 
                     Ok(res.into_iter().take(100).collect())
diff --git a/ui/src/remotes/tasks.rs b/ui/src/remotes/tasks.rs
index 825bd57..f42fa0f 100644
--- a/ui/src/remotes/tasks.rs
+++ b/ui/src/remotes/tasks.rs
@@ -139,7 +139,7 @@ impl Component for PbsRemoteTaskList {
             });
 
         let mut task_list = Tasks::new()
-            .base_url("/remote-tasks/list")
+            .base_url("/remotes/tasks/list")
             .on_show_task({
                 let link = ctx.link().clone();
                 move |(upid_str, endtime)| link.send_message(Some((upid_str, endtime)))
-- 
2.47.3



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

  reply	other threads:[~2025-12-02  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02  9:25 [pdm-devel] [PATCH datacenter-manager 1/2] api structure: move /remotes/{id} to /remotes/remote/{id} Fabian Grünbichler
2025-12-02  9:25 ` Fabian Grünbichler [this message]
2025-12-02 12:29 ` [pdm-devel] applied: " 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=20251202092712.368428-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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