[pve-devel] [PATCH v3 pve-manager 59/66] ui: perm path: load notification target/filter acl entries

Lukas Wagner l.wagner at proxmox.com
Mon Jul 17 17:00:44 CEST 2023


Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---

Notes:
    I'm not sure if I like this solution, but adding notification targets to
    the resources API endpoint would not have make sense.
    Maybe we could create a new API endpoint that returns all possible ACL
    paths and then use a normal store for the perm path combobox?

 www/manager6/data/PermPathStore.js | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/www/manager6/data/PermPathStore.js b/www/manager6/data/PermPathStore.js
index c3ac7f0e..b7e4fa33 100644
--- a/www/manager6/data/PermPathStore.js
+++ b/www/manager6/data/PermPathStore.js
@@ -9,6 +9,7 @@ Ext.define('PVE.data.PermPathStore', {
 	{ 'value': '/access/groups' },
 	{ 'value': '/access/realm' },
 	{ 'value': '/mapping' },
+	{ 'value': '/mapping/notification' },
 	{ 'value': '/nodes' },
 	{ 'value': '/pool' },
 	{ 'value': '/sdn/zones' },
@@ -46,8 +47,31 @@ Ext.define('PVE.data.PermPathStore', {
 		donePaths[path] = 1;
 	    }
 	});
-	me.resumeEvents();
 
+	Ext.Ajax.request({
+	    url: '/api2/json/cluster/notifications/targets',
+	    method: 'GET',
+	    success: function(response, opts) {
+		let obj = Ext.decode(response.responseText);
+
+		for (let target of obj.data) {
+		    me.add({ value: `/mapping/notification/${target.name}` });
+		}
+	    },
+	});
+	Ext.Ajax.request({
+	    url: '/api2/json/cluster/notifications/filters',
+	    method: 'GET',
+	    success: function(response, opts) {
+		let obj = Ext.decode(response.responseText);
+
+		for (let filter of obj.data) {
+		    me.add({ value: `/mapping/notification/${filter.name}` });
+		}
+	    },
+	});
+
+	me.resumeEvents();
 	me.fireEvent('refresh', me);
 	me.fireEvent('datachanged', me);
 
-- 
2.39.2






More information about the pve-devel mailing list