[pve-devel] [PATCH v4 manager 3/4] ui: utils: add method to get VM data from resource store
Aaron Lauterer
a.lauterer at proxmox.com
Tue Dec 15 14:39:58 CET 2020
Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
v3 -> v4: rebased
v2 -> v3: nothing changed
v1 -> v2: fixed linter errors
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 366385da..f70e901f 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1746,6 +1746,19 @@ Ext.define('PVE.Utils', { utilities: {
vzumount: ['CT', gettext('Unmount')],
zfscreate: [gettext('ZFS Storage'), gettext('Create')],
});
- }
+ },
+
+ 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