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

Aaron Lauterer a.lauterer at proxmox.com
Mon Feb 15 16:26:46 CET 2021


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
v3 -> v4i -> v5: rebased
v2 -> v3: nothing changed
v1 -> v2: fixed linter errors


 www/manager6/Utils.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 7a1a7fb6..a298aac0 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1833,4 +1833,17 @@ Ext.define('PVE.Utils', {
 	});
     },
 
+    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