From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id AC71C1FF173 for ; Mon, 11 Nov 2024 16:50:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2B1AD106A1; Mon, 11 Nov 2024 16:50:37 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Mon, 11 Nov 2024 16:43:49 +0100 Message-Id: <20241111154353.482734-28-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241111154353.482734-1-c.ebner@proxmox.com> References: <20241111154353.482734-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH v7 proxmox-backup 27/31] ui: sync job: adapt edit window to be used for pull and push X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Switch the subject and labels to be shown based on the direction of the sync job, and set the `sync-direction` parameter from the submit values in case of push direction. Signed-off-by: Christian Ebner --- changes since version 6: - conditionally set sync-direction request param www/window/SyncJobEdit.js | 41 ++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/www/window/SyncJobEdit.js b/www/window/SyncJobEdit.js index 9ca79eaa9..0e648e7b3 100644 --- a/www/window/SyncJobEdit.js +++ b/www/window/SyncJobEdit.js @@ -9,7 +9,7 @@ Ext.define('PBS.window.SyncJobEdit', { isAdd: true, - subject: gettext('Sync Job'), + subject: gettext('Sync Job - Pull Direction'), bodyPadding: 0, @@ -29,6 +29,30 @@ Ext.define('PBS.window.SyncJobEdit', { me.scheduleValue = id ? null : 'hourly'; me.authid = id ? null : Proxmox.UserName; me.editDatastore = me.datastore === undefined && me.isCreate; + + if (me.syncDirection === 'push') { + me.subject = gettext('Sync Job - Push Direction'); + me.syncDirectionPush = true; + me.syncRemoteLabel = gettext('Target Remote'); + me.syncRemoteDatastore = gettext('Target Datastore'); + me.syncRemoteNamespace = gettext('Target Namespace'); + me.syncLocalOwner = gettext('Local User'); + // Sync direction request parameter is only required for creating new jobs, + // for edit and delete it is derived from the job config given by it's id. + if (me.isCreate) { + me.extraRequestParams = { + "sync-direction": 'push', + }; + } + } else { + me.subject = gettext('Sync Job - Pull Direction'); + me.syncDirectionPush = false; + me.syncRemoteLabel = gettext('Source Remote'); + me.syncRemoteDatastore = gettext('Source Datastore'); + me.syncRemoteNamespace = gettext('Source Namespace'); + me.syncLocalOwner = gettext('Local Owner'); + } + return { }; }, @@ -118,10 +142,10 @@ Ext.define('PBS.window.SyncJobEdit', { }, }, { - fieldLabel: gettext('Local Owner'), xtype: 'pbsAuthidSelector', name: 'owner', cbind: { + fieldLabel: '{syncLocalOwner}', value: '{authid}', deleteEmpty: '{!isCreate}', }, @@ -151,6 +175,9 @@ Ext.define('PBS.window.SyncJobEdit', { xtype: 'radiogroup', fieldLabel: gettext('Location'), defaultType: 'radiofield', + cbind: { + disabled: '{syncDirectionPush}', + }, items: [ { boxLabel: 'Local', @@ -201,7 +228,9 @@ Ext.define('PBS.window.SyncJobEdit', { }, }, { - fieldLabel: gettext('Source Remote'), + cbind: { + fieldLabel: '{syncRemoteLabel}', + }, xtype: 'pbsRemoteSelector', allowBlank: false, name: 'remote', @@ -222,13 +251,13 @@ Ext.define('PBS.window.SyncJobEdit', { }, }, { - fieldLabel: gettext('Source Datastore'), xtype: 'pbsRemoteStoreSelector', allowBlank: false, autoSelect: false, name: 'remote-store', cbind: { datastore: '{datastore}', + fieldLabel: '{syncRemoteDatastore}', }, listeners: { change: function(field, value) { @@ -249,7 +278,9 @@ Ext.define('PBS.window.SyncJobEdit', { }, }, { - fieldLabel: gettext('Source Namespace'), + cbind: { + fieldLabel: '{syncRemoteNamespace}', + }, xtype: 'pbsRemoteNamespaceSelector', allowBlank: true, autoSelect: false, -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel