[pve-devel] [PATCH widget-toolkit 1/4] ProxmoxProxy: add duration fields for proxmox-tasks

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jun 15 15:23:20 CEST 2020


Am 6/12/20 um 1:29 PM schrieb Dominik Csapak:
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/data/ProxmoxProxy.js | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/data/ProxmoxProxy.js b/src/data/ProxmoxProxy.js
> index 53e92f3..40fdc08 100644
> --- a/src/data/ProxmoxProxy.js
> +++ b/src/data/ProxmoxProxy.js
> @@ -43,6 +43,18 @@ Ext.define('Proxmox.RestProxy', {
>  	    { name: 'starttime', type: 'date', dateFormat: 'timestamp' },
>  	    { name: 'endtime', type: 'date', dateFormat: 'timestamp' },
>  	    { name: 'pid', type: 'int' },
> +	    {
> +		name: 'duration',
> +		sortType: 'asInt',
> +		calculate: function(data) {
> +		    let endtime = data.endtime;
> +		    let starttime = data.starttime;
> +		    if (endtime !== undefined) {
> +			return ((endtime - starttime)/1000).toFixed(0);

maybe do not drop sub second accuracy here already, that should happen in the
renderer, at least one or even two decimal points would be nice.

> +		    }
> +		    return 0;
> +		},
> +	    },
>  	    'node', 'upid', 'user', 'status', 'type', 'id',
>  	],
>  	idProperty: 'upid',
> 





More information about the pve-devel mailing list