[pve-devel] [PATCH manager 1/2] ui: Replication: use render_duration from widget-toolkit

Dominik Csapak d.csapak at proxmox.com
Thu May 28 13:02:52 CEST 2020


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js            | 27 ---------------------------
 www/manager6/grid/Replication.js |  2 +-
 2 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 676f56a8..5c81d7f8 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -536,26 +536,6 @@ Ext.define('PVE.Utils', { utilities: {
 	return msg;
     },
 
-    format_duration_short: function(ut) {
-
-	if (ut < 60) {
-	    return ut.toFixed(1) + 's';
-	}
-
-	if (ut < 3600) {
-	    var mins = ut / 60;
-	    return mins.toFixed(1) + 'm';
-	}
-
-	if (ut < 86400) {
-	    var hours = ut / 3600;
-	    return hours.toFixed(1) + 'h';
-	}
-
-	var days = ut / 86400;
-	return days.toFixed(1) + 'd';
-    },
-
     contentTypes: {
 	'images': gettext('Disk image'),
 	'backup': gettext('VZDump backup file'),
@@ -836,13 +816,6 @@ Ext.define('PVE.Utils', { utilities: {
 	return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s');
     },
 
-    render_duration: function(value) {
-	if (value === undefined) {
-	    return '-';
-	}
-	return PVE.Utils.format_duration_short(value);
-    },
-
     calculate_mem_usage: function(data) {
 	if (!Ext.isNumeric(data.mem) ||
 	    data.maxmem === 0 ||
diff --git a/www/manager6/grid/Replication.js b/www/manager6/grid/Replication.js
index 40f15982..eabf5524 100644
--- a/www/manager6/grid/Replication.js
+++ b/www/manager6/grid/Replication.js
@@ -382,7 +382,7 @@ Ext.define('PVE.grid.ReplicaView', {
 		    text: gettext('Duration'),
 		    dataIndex: 'duration',
 		    width: 60,
-		    renderer: PVE.Utils.render_duration
+		    renderer: Proxmox.Utils.render_duration
 		},
 		{
 		    text: gettext('Next Sync'),
-- 
2.20.1





More information about the pve-devel mailing list