[pbs-devel] [PATCH v5 proxmox-backup 23/31] ui: sync: pass sync-direction to allow removing push jobs

Christian Ebner c.ebner at proxmox.com
Fri Oct 18 10:42:34 CEST 2024


Without the `sync-direction` parameter set, the job will not be
found in the config, because the `sync` config type is used instead
of the correct `sync-push` for sync jobs in push direction.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 4:
- no changes

changes since version 3:
- no changes

 www/config/SyncView.js | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/www/config/SyncView.js b/www/config/SyncView.js
index 68a147615..981b9b251 100644
--- a/www/config/SyncView.js
+++ b/www/config/SyncView.js
@@ -104,6 +104,26 @@ Ext.define('PBS.config.SyncJobView', {
 	    });
 	},
 
+	removeSyncJob: function(btn, event, rec) {
+	    let me = this;
+	    let view = me.getView();
+	    let params = {};
+	    if (view.syncDirection !== undefined) {
+		params["sync-direction"] = view.syncDirection;
+	    }
+	    Proxmox.Utils.API2Request({
+		url: '/config/sync/' + rec.getId(),
+		method: 'DELETE',
+		params: params,
+		callback: function(options, success, response) {
+		    Ext.callback(me.callback, me.scope, [options, success, response, 0, me]);
+		},
+		failure: function(response, opt) {
+		    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+		},
+	    });
+	},
+
 	render_optional_owner: function(value, metadata, record) {
 	    if (!value) return '-';
 	    return Ext.String.htmlEncode(value);
@@ -161,7 +181,7 @@ Ext.define('PBS.config.SyncJobView', {
 	},
 	{
 	    xtype: 'proxmoxStdRemoveButton',
-	    baseurl: '/config/sync/',
+	    handler: 'removeSyncJob',
 	    confirmMsg: gettext('Remove entry?'),
 	    callback: 'reload',
 	},
-- 
2.39.5





More information about the pbs-devel mailing list