[pbs-devel] [PATCH backup 1/2] move subscription API path to /nodes

Stefan Reiter s.reiter at proxmox.com
Tue Jul 21 13:41:06 CEST 2020


This aligns it with PVE and allows the widget toolkit's update window
"refresh" to work without modifications once POST /apt/update is
implemented.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

I believe it makes more sense here in general, it is certainly node specific.

 src/api2.rs                         | 2 --
 src/api2/node.rs                    | 2 ++
 src/api2/{ => node}/subscription.rs | 8 ++++++++
 www/Dashboard.js                    | 2 +-
 www/Subscription.js                 | 2 +-
 5 files changed, 12 insertions(+), 4 deletions(-)
 rename src/api2/{ => node}/subscription.rs (88%)

diff --git a/src/api2.rs b/src/api2.rs
index 178f3f45..85d29ed2 100644
--- a/src/api2.rs
+++ b/src/api2.rs
@@ -4,7 +4,6 @@ pub mod backup;
 pub mod config;
 pub mod node;
 pub mod reader;
-mod subscription;
 pub mod status;
 pub mod types;
 pub mod version;
@@ -26,7 +25,6 @@ pub const SUBDIRS: SubdirMap = &[
     ("pull", &pull::ROUTER),
     ("reader", &reader::ROUTER),
     ("status", &status::ROUTER),
-    ("subscription", &subscription::ROUTER),
     ("version", &version::ROUTER),
 ];
 
diff --git a/src/api2/node.rs b/src/api2/node.rs
index 13ff282c..e67cab4e 100644
--- a/src/api2/node.rs
+++ b/src/api2/node.rs
@@ -9,6 +9,7 @@ mod syslog;
 mod journal;
 mod services;
 mod status;
+mod subscription;
 pub(crate) mod rrd;
 pub mod disks;
 
@@ -20,6 +21,7 @@ pub const SUBDIRS: SubdirMap = &[
     ("rrd", &rrd::ROUTER),
     ("services", &services::ROUTER),
     ("status", &status::ROUTER),
+    ("subscription", &subscription::ROUTER),
     ("syslog", &syslog::ROUTER),
     ("tasks", &tasks::ROUTER),
     ("time", &time::ROUTER),
diff --git a/src/api2/subscription.rs b/src/api2/node/subscription.rs
similarity index 88%
rename from src/api2/subscription.rs
rename to src/api2/node/subscription.rs
index 7d1b0237..186019cb 100644
--- a/src/api2/subscription.rs
+++ b/src/api2/node/subscription.rs
@@ -5,8 +5,16 @@ use proxmox::api::{api, Router, Permission};
 
 use crate::tools;
 use crate::config::acl::PRIV_SYS_AUDIT;
+use crate::api2::types::NODE_SCHEMA;
 
 #[api(
+    input: {
+        properties: {
+            node: {
+                schema: NODE_SCHEMA,
+            },
+        },
+    },
     returns: {
         description: "Subscription status.",
         properties: {
diff --git a/www/Dashboard.js b/www/Dashboard.js
index 7f699d93..d6dc40d2 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -209,7 +209,7 @@ Ext.define('PBS.Dashboard', {
 		autoDestroy: true,
 		proxy: {
 		    type: 'proxmox',
-		    url: '/api2/json/subscription'
+		    url: '/api2/json/nodes/localhost/subscription'
 		},
 		listeners: {
 		    load: 'updateSubscription'
diff --git a/www/Subscription.js b/www/Subscription.js
index f5a64459..8746091f 100644
--- a/www/Subscription.js
+++ b/www/Subscription.js
@@ -37,7 +37,7 @@ Ext.define('PBS.Subscription', {
 	    me.rstore.load();
 	};
 
-	var baseurl = '/subscription';
+	var baseurl = '/nodes/localhost/subscription';
 
 	var render_status = function(value) {
 
-- 
2.20.1






More information about the pbs-devel mailing list