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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 8D52066218 for ; Thu, 5 Nov 2020 18:49:23 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 843D81B1EF for ; Thu, 5 Nov 2020 18:48:53 +0100 (CET) Received: from gaia.proxmox.com (212-186-127-178.static.upcbusiness.at [212.186.127.178]) (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 5D3391B1E2 for ; Thu, 5 Nov 2020 18:48:52 +0100 (CET) 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 0A5HmnCW1117331; Thu, 5 Nov 2020 18:48:49 +0100 Received: (from oguz@localhost) by gaia.proxmox.com (8.15.2/8.15.2/Submit) id 0A5Hmnfo1117330; Thu, 5 Nov 2020 18:48:49 +0100 From: Oguz Bektas To: pbs-devel@lists.proxmox.com Date: Thu, 5 Nov 2020 18:48:18 +0100 Message-Id: <20201105174818.1116016-2-o.bektas@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201105174818.1116016-1-o.bektas@proxmox.com> References: <20201105174818.1116016-1-o.bektas@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.584 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 KHOP_HELO_FCRDNS 0.399 Relay HELO differs from its IP's reverse DNS NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records 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 v3 backup 2/2] ui: add textarea in remote -> add 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: Thu, 05 Nov 2020 17:49:23 -0000 automatically fills the ip and fingerprint. Signed-off-by: Oguz Bektas --- www/window/RemoteEdit.js | 60 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/www/window/RemoteEdit.js b/www/window/RemoteEdit.js index 56a248e0..757ea73e 100644 --- a/www/window/RemoteEdit.js +++ b/www/window/RemoteEdit.js @@ -5,6 +5,44 @@ Ext.define('PBS.window.RemoteEdit', { onlineHelp: 'backup_remote', + 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); + console.log(jsons); + let joinInfo = Ext.JSON.decode(jsons, true); + console.log(joinInfo); + + let info = { + ipAddress: joinInfo.ipAddress, + fingerprint: joinInfo.fingerprint, + datastore: joinInfo.datastore, + }; + console.log(info); + + vm.set('info', info); + console.log(vm); + }, + }, + + userid: undefined, isAdd: true, @@ -28,7 +66,7 @@ Ext.define('PBS.window.RemoteEdit', { }; }, - items: { + items: [{ xtype: 'inputpanel', column1: [ { @@ -49,6 +87,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; @@ -88,7 +129,6 @@ Ext.define('PBS.window.RemoteEdit', { name: 'port', }, ], - column2: [ { xtype: 'proxmoxtextfield', @@ -107,7 +147,6 @@ Ext.define('PBS.window.RemoteEdit', { }, }, ], - columnB: [ { xtype: 'proxmoxtextfield', @@ -116,6 +155,10 @@ Ext.define('PBS.window.RemoteEdit', { deleteEmpty: '{!isCreate}', }, fieldLabel: gettext('Fingerprint'), + bind: { + value: '{info.fingerprint}', + }, + }, { xtype: 'proxmoxtextfield', @@ -126,7 +169,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