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

Dominic Jäger d.jaeger at proxmox.com
Mon Aug 31 12:51:44 CEST 2020


Not 100% sure if I currently have the right eslint version

On Tue, Aug 25, 2020 at 05:14:25PM +0200, Aaron Lauterer wrote:
> +    getNodeVMs: function(nodename) {
> +	let rstore = PVE.data.ResourceStore;
> +	let vms = {}
WARN: line 1573 col 14: semi - Missing semicolon. (*)
> +	rstore.data.items.forEach((item) => {
> +	    if (!item.id.startsWith('qemu/')) { return; }
> +	    let vmdata = item.data;
> +	    if (vmdata.node != nodename) { return; }
ERR : line 1577 col 22: eqeqeq - Expected '!==' and instead saw '!='.
> +
> +	    vms[vmdata.vmid] = vmdata;
> +	});
> +	return vms;
> +    },

Looking at the forEach: Functional programming can be fun :)
return Object.fromEntries(rstore.data.items.filter(x => x.id.startsWith('qemu/')).filter(x => x.data.node === nodename).map(x => [x.data.vmid, x.data]));




More information about the pve-devel mailing list