[pve-devel] [PATCH manager 2/2] replication: show disabled jobs and allow enabling/disabling

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Jun 29 10:08:29 CEST 2017


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/API2/Replication.pm          |  2 +-
 www/manager6/grid/Replication.js | 23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Replication.pm b/PVE/API2/Replication.pm
index dca93d8c..1f792d39 100644
--- a/PVE/API2/Replication.pm
+++ b/PVE/API2/Replication.pm
@@ -153,7 +153,7 @@ __PACKAGE__->register_method ({
 	my $rpcenv = PVE::RPCEnvironment::get();
 	my $authuser = $rpcenv->get_user();
 
-	my $jobs = PVE::ReplicationState::job_status();
+	my $jobs = PVE::ReplicationState::job_status(1);
 
 	my $res = [];
 	foreach my $id (sort keys %$jobs) {
diff --git a/www/manager6/grid/Replication.js b/www/manager6/grid/Replication.js
index e5c703fe..682da659 100644
--- a/www/manager6/grid/Replication.js
+++ b/www/manager6/grid/Replication.js
@@ -50,6 +50,13 @@ Ext.define('PVE.window.ReplicaEdit', {
 		xtype: 'textfield',
 		fieldLabel: gettext('Comment'),
 		name: 'comment'
+	    },
+	    {
+		xtype: 'pvecheckbox',
+		name: 'enabled',
+		defaultValue: 'on',
+		checked: true,
+		fieldLabel: gettext('Enabled')
 	    }
 	);
 
@@ -62,7 +69,11 @@ Ext.define('PVE.window.ReplicaEdit', {
 		onGetValues: function(values) {
 		    var me = this.up('window');
 
+		    values.disable = values.enabled ? 0 : 1;
+		    delete values.enabled;
+
 		    PVE.Utils.delete_if_default(values, 'rate', '', me.isCreate);
+		    PVE.Utils.delete_if_default(values, 'disable', 0, me.isCreate);
 		    PVE.Utils.delete_if_default(values, 'schedule', '*/15', me.isCreate);
 		    PVE.Utils.delete_if_default(values, 'comment', '', me.isCreate);
 
@@ -109,6 +120,7 @@ Ext.define('PVE.window.ReplicaEdit', {
 	} else {
 	    me.load({
 		success: function(response, options) {
+		    response.result.data.enabled = !response.result.data.disable;
 		    me.setValues(response.result.data);
 		    me.digest = response.result.data.digest;
 		}
@@ -291,6 +303,13 @@ Ext.define('PVE.grid.ReplicaView', {
 
 	me.columns = [
 	    {
+		text: gettext('Enabled'),
+		dataIndex: 'enabled',
+		xtype: 'checkcolumn',
+		sortable: true,
+		disabled: true
+	    },
+	    {
 		text: gettext('ID'),
 		dataIndex: 'id',
 		width: 60,
@@ -498,7 +517,9 @@ Ext.define('PVE.grid.ReplicaView', {
 	    'id', 'target', 'comment', 'rate', 'type',
 	    { name: 'guest', type: 'integer' },
 	    { name: 'jobnum', type: 'integer' },
-	    { name: 'schedule', defaultValue: '*/15' }
+	    { name: 'schedule', defaultValue: '*/15' },
+	    { name: 'disable', defaultValue: '' },
+	    { name: 'enabled', calculate: function(data) { return !data.disable; } }
 	]
     });
 
-- 
2.11.0





More information about the pve-devel mailing list