[pve-devel] [PATCH manager 3/4] ui: utils: add method to get VM data from resource store

Aaron Lauterer a.lauterer at proxmox.com
Tue Aug 25 17:14:25 CEST 2020


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 www/manager6/Utils.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index bf9ceda9..c96c60d4 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1566,6 +1566,19 @@ Ext.define('PVE.Utils', { utilities: {
     constructor: function() {
 	var me = this;
 	Ext.apply(me, me.utilities);
-    }
+    },
+
+    getNodeVMs: function(nodename) {
+	let rstore = PVE.data.ResourceStore;
+	let vms = {}
+	rstore.data.items.forEach((item) => {
+	    if (!item.id.startsWith('qemu/')) { return; }
+	    let vmdata = item.data;
+	    if (vmdata.node != nodename) { return; }
+
+	    vms[vmdata.vmid] = vmdata;
+	});
+	return vms;
+    },
 
 });
-- 
2.20.1





More information about the pve-devel mailing list