[pve-devel] [PATCH manager] replication; merge status and status text and add to dc mode

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Jun 29 11:06:05 CEST 2017


It was a bit strange to have two separate status columns, which do
effectively the same thing. So merge them together to save a bit
space and have less columns.

Show this field also in the datacenter replication panel, as else we
have no feed back about jobs there. This was especially confusing
when deleting jobs.

We do not need to translate 'Status Text' as a nice side effect.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/grid/Replication.js | 94 ++++++++++++++++------------------------
 1 file changed, 38 insertions(+), 56 deletions(-)

diff --git a/www/manager6/grid/Replication.js b/www/manager6/grid/Replication.js
index 682da659..1bfb54c2 100644
--- a/www/manager6/grid/Replication.js
+++ b/www/manager6/grid/Replication.js
@@ -328,6 +328,41 @@ Ext.define('PVE.grid.ReplicaView', {
 	    {
 		text: gettext('Target'),
 		dataIndex: 'target'
+	    },
+	    {
+		text: gettext('Status'),
+		dataIndex: 'state',
+		minWidth: 160,
+		flex: 1,
+		renderer: function(value, metadata, record) {
+
+		    if (record.data.pid) {
+			metadata.tdCls = 'x-grid-row-loading';
+			return '';
+		    }
+
+		    var icons = [];
+		    var states = [];
+
+		    if (record.data.remove_job) {
+			icons.push('<i class="fa fa-ban warning" title="'
+				    + gettext("Removal Scheduled") + '"></i>');
+			states.push(gettext("Removal Scheduled"));
+		    }
+
+		    if (record.data.error) {
+			icons.push('<i class="fa fa-times critical" title="'
+				    + gettext("Error") + '"></i>');
+			states.push(record.data.error);
+		    }
+
+		    if (icons.length == 0) {
+			icons.push('<i class="fa fa-check good"></i>');
+			states.push(gettext('OK'));
+		    }
+
+		    return icons.join(',') + ' ' + states.join(',');
+		}
 	    }
 	];
 
@@ -345,59 +380,6 @@ Ext.define('PVE.grid.ReplicaView', {
 	if (mode !== 'dc') {
 	    me.columns.push(
 		{
-		    text: gettext('Status'),
-		    dataIndex: 'state',
-		    width: 60,
-		    renderer: function(value, metadata, record) {
-
-			if (record.data.pid) {
-			    metadata.tdCls = 'x-grid-row-loading';
-			    return '';
-			}
-
-			var states = [];
-
-			if (record.data.remove_job) {
-			    states.push('<i class="fa fa-ban warning" title="'
-					+ gettext("Removal Scheduled") + '"></i>');
-			}
-
-			if (record.data.error) {
-			    states.push('<i class="fa fa-times critical" title="'
-					+ gettext("Error") + '"></i>');
-			}
-
-			if (states.length > 0) {
-			    return states.join(',');
-			}
-
-			return '<i class="fa fa-check good"></i>';
-		    }
-		},
-		{
-		    text: gettext('Status Text'),
-		    dataIndex: 'error',
-		    minWidth: 100,
-		    flex: 1,
-		    renderer: function(value, metadata, record) {
-			var states = [];
-
-			if (record.data.remove_job) {
-			    states.push(gettext("Removal Scheduled"));
-			}
-
-			if (record.data.error) {
-			    states.push(record.data.error);
-			}
-
-			if (states.length > 0) {
-			    return states.join(', ');
-			}
-
-			return gettext('OK');
-		    }
-		},
-		{
 		    text: gettext('Last Sync'),
 		    dataIndex: 'last_sync',
 		    width: 150,
@@ -514,7 +496,8 @@ Ext.define('PVE.grid.ReplicaView', {
     Ext.define('pve-replication', {
 	extend: 'Ext.data.Model',
 	fields: [
-	    'id', 'target', 'comment', 'rate', 'type',
+	    'id', 'target', 'comment', 'rate', 'type', 'state', 'remove_job',
+	    'error',
 	    { name: 'guest', type: 'integer' },
 	    { name: 'jobnum', type: 'integer' },
 	    { name: 'schedule', defaultValue: '*/15' },
@@ -526,8 +509,7 @@ Ext.define('PVE.grid.ReplicaView', {
     Ext.define('pve-replication-state', {
 	extend: 'pve-replication',
 	fields: [
-	    'last_sync', 'next_sync', 'error', 'duration', 'state',
-	    'fail_count', 'remove_job', 'pid'
+	    'last_sync', 'next_sync', 'duration', 'fail_count', 'pid'
 	]
     });
 
-- 
2.11.0





More information about the pve-devel mailing list