[pve-devel] [PATCH widget-toolkit 3/4] TaskViewer: show endtime and duration in status

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jun 15 15:29:10 CEST 2020


Am 6/12/20 um 1:29 PM schrieb Dominik Csapak:
> but only when the caller gives us the endtime, since the status
> api call does not give us the endtime
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/node/Tasks.js        |  1 +
>  src/window/TaskViewer.js | 23 +++++++++++++++++++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/src/node/Tasks.js b/src/node/Tasks.js
> index 5aff06d..c41f0b5 100644
> --- a/src/node/Tasks.js
> +++ b/src/node/Tasks.js
> @@ -60,6 +60,7 @@ Ext.define('Proxmox.node.Tasks', {
>  
>  	    let win = Ext.create('Proxmox.window.TaskViewer', {
>  		upid: rec.data.upid,
> +		endtime: rec.data.endtime,
>  	    });
>  	    win.show();
>  	};
> diff --git a/src/window/TaskViewer.js b/src/window/TaskViewer.js
> index 2f31023..fedf693 100644
> --- a/src/window/TaskViewer.js
> +++ b/src/window/TaskViewer.js
> @@ -152,6 +152,29 @@ Ext.define('Proxmox.window.TaskViewer', {
>  	    },
>  	};
>  
> +	if (me.endtime) {
> +	    if (typeof me.endtime === 'object') {
> +		// convert to epoch
> +		me.endtime = parseInt(me.endtime.getTime()/1000, 10);
> +	    }
> +	    rows.endtime = {
> +		header: gettext('End Time'),
> +		required: true,
> +		renderer: function() {
> +		    return Proxmox.Utils.render_timestamp(me.endtime);
> +		},
> +	    };
> +	    rows.duration = {
> +		header: gettext('Duration'),
> +		required: true,
> +		renderer: function() {
> +		    let starttime = statgrid.getObjectValue('starttime');
> +		    let duration = me.endtime - starttime;
> +		    return Proxmox.Utils.format_duration_human(duration);
> +		},

this could be still added if no endtime is yet defined, as live tracker about the
duration from starttime to now (utc unix timestamp should be OK from browser too).
For longer tasks this could be nice, that it's still running is already visible
from the status row.

Just updating with the store update interval, if endtime is set use that else use
`Date.now() / 1000` (floor'd or so).

> +	    };
> +	}
> +
>  	let statstore = Ext.create('Proxmox.data.ObjectStore', {
>              url: "/api2/json/nodes/" + task.node + "/tasks/" + me.upid + "/status",
>  	    interval: 1000,
> 





More information about the pve-devel mailing list