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

Dominik Csapak d.csapak at proxmox.com
Fri Jun 12 13:29:24 CEST 2020


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);
+		    }
+		    return 0;
+		},
+	    },
 	    'node', 'upid', 'user', 'status', 'type', 'id',
 	],
 	idProperty: 'upid',
-- 
2.20.1





More information about the pve-devel mailing list