[pve-devel] [PATCH manager 3/6] add a new status column in the resourcestore

Dietmar Maurer dietmar at proxmox.com
Wed May 3 07:07:00 CEST 2017


This looks quite clumsy. Can't we compute a reasonable status at
the server side?

Why do you use different names like 'online', 'active' and 'status'?

Also, the 'running' field contains similar information? Can we 
merge that somehow?

> +	    status: {
> +		header: gettext('Status'),
> +		type: 'string',
> +		convert: function(value, record) {
> +		    var info = record.data;
> +		    var text = '';
> +
> +		    // for lxc and qemu we get a status from the backend
> +		    if (value) {
> +			return value;
> +		    }
> +
> +		    if (info.type === 'lxc' ||
> +			info.type === 'qemu') {
> +			text = 'unknown';
> +		    } else if (info.type === 'node') {
> +			if (info.online !== undefined && !info.online) {
> +			    text = 'offline';
> +			} else {
> +			    text = (info.uptime)?'online':'unknown';
> +			}
> +		    } else if (info.type === 'storage') {
> +			if (!info.active) {
> +			    text = 'unknown';
> +			}
> +		    }
> +		    return text;
> +		}
>  	    }
>  	};
>  
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list