From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 347296CFB9 for ; Wed, 31 Mar 2021 12:39:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0FE1EE6A6 for ; Wed, 31 Mar 2021 12:38:32 +0200 (CEST) Received: from gaia.proxmox.com (unknown [94.136.29.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E303CE69E for ; Wed, 31 Mar 2021 12:38:30 +0200 (CEST) Received: from gaia.proxmox.com (localhost.localdomain [127.0.0.1]) by gaia.proxmox.com (8.15.2/8.15.2/Debian-14~deb10u1) with ESMTP id 12VAZhZK466384; Wed, 31 Mar 2021 12:35:43 +0200 Received: (from oguz@localhost) by gaia.proxmox.com (8.15.2/8.15.2/Submit) id 12VAZhQa466383; Wed, 31 Mar 2021 12:35:43 +0200 From: Oguz Bektas To: pbs-devel@lists.proxmox.com Date: Wed, 31 Mar 2021 12:35:40 +0200 Message-Id: <20210331103540.466071-2-o.bektas@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210331103540.466071-1-o.bektas@proxmox.com> References: <20210331103540.466071-1-o.bektas@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 2 AWL 0.062 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pbs-devel] [PATCH v4 backup 2/2] ui: add textarea in remote and menu for pasting json blob 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: , X-List-Received-Date: Wed, 31 Mar 2021 10:39:02 -0000 automatically fill hostname and fingerprint when pasted Signed-off-by: Oguz Bektas --- www/window/RemoteEdit.js | 55 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/www/window/RemoteEdit.js b/www/window/RemoteEdit.js index 4a4d8114..92b3d929 100644 --- a/www/window/RemoteEdit.js +++ b/www/window/RemoteEdit.js @@ -11,6 +11,39 @@ Ext.define('PBS.window.RemoteEdit', { fieldDefaults: { labelWidth: 120 }, + viewModel: { + parent: null, + data: { + info: { + ipAddress: '', + fingerprint: '', + datastore: '', + }, + }, + }, + + controller: { + xclass: 'Ext.app.ViewController', + control: { + 'textarea[name=serializedinfo]': { + change: 'deserializeInfo', + }, + }, + deserializeInfo: function(field, value) { + let vm = this.getViewModel(); + let jsons = Ext.util.Base64.decode(value); + let joinInfo = Ext.JSON.decode(jsons, true); + + let info = { + ipAddress: joinInfo.ipAddress, + fingerprint: joinInfo.fingerprint, + datastore: joinInfo.datastore, + }; + + vm.set('info', info); + }, + }, + cbindData: function(initialConfig) { let me = this; @@ -26,7 +59,7 @@ Ext.define('PBS.window.RemoteEdit', { }; }, - items: { + items: [{ xtype: 'inputpanel', column1: [ { @@ -47,6 +80,9 @@ Ext.define('PBS.window.RemoteEdit', { submitValue: false, vtype: 'HostPort', fieldLabel: gettext('Host'), + bind: { + value: '{info.ipAddress}', + }, listeners: { change: function(field, newvalue) { let host = newvalue; @@ -86,7 +122,6 @@ Ext.define('PBS.window.RemoteEdit', { name: 'port', }, ], - column2: [ { xtype: 'proxmoxtextfield', @@ -105,7 +140,6 @@ Ext.define('PBS.window.RemoteEdit', { }, }, ], - columnB: [ { xtype: 'proxmoxtextfield', @@ -114,6 +148,10 @@ Ext.define('PBS.window.RemoteEdit', { deleteEmpty: '{!isCreate}', }, fieldLabel: gettext('Fingerprint'), + bind: { + value: '{info.fingerprint}', + }, + }, { xtype: 'proxmoxtextfield', @@ -124,7 +162,16 @@ Ext.define('PBS.window.RemoteEdit', { fieldLabel: gettext('Comment'), }, ], - }, + }, + { + xtype: 'textarea', + name: 'serializedinfo', + fieldLabel: gettext('Remote Info Blob'), + submitValue: false, + emptyText: gettext('Paste encoded Remote Information here'), + value: '', + }, + ], setValues: function(values) { let me = this; -- 2.20.1