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 F3E9867C74 for ; Tue, 10 Nov 2020 14:29:06 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F1ECF21F83 for ; Tue, 10 Nov 2020 14:29:06 +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 33C2821F73 for ; Tue, 10 Nov 2020 14:29:06 +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 0AADSuwv1269315; Tue, 10 Nov 2020 14:28:56 +0100 Received: (from oguz@localhost) by gaia.proxmox.com (8.15.2/8.15.2/Submit) id 0AADSurP1269314; Tue, 10 Nov 2020 14:28:56 +0100 From: Oguz Bektas To: pbs-devel@lists.proxmox.com Date: Tue, 10 Nov 2020 14:28:52 +0100 Message-Id: <20201110132853.1269082-1-o.bektas@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.570 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.4 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 proxmox-backup 1/2] ui: add 'join info' copy/paste button on datastore summary 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: Tue, 10 Nov 2020 13:29:07 -0000 shows info about the datastore: - datastore name - x509 fingerprint - hostname and creates the base64-encoded json blob to be pasted into Remote menu. Signed-off-by: Oguz Bektas --- v2->v3: * rebase on master www/Makefile | 1 + www/datastore/Summary.js | 35 ++++++++++++++- www/window/DataStoreJoin.js | 88 +++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 www/window/DataStoreJoin.js diff --git a/www/Makefile b/www/Makefile index f64d2bba..bea80994 100644 --- a/www/Makefile +++ b/www/Makefile @@ -26,6 +26,7 @@ JSSRC= \ window/BackupGroupChangeOwner.js \ window/CreateDirectory.js \ window/DataStoreEdit.js \ + window/DataStoreJoin.js \ window/FileBrowser.js \ window/NotesEdit.js \ window/RemoteEdit.js \ diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js index 5c757e8c..f81867e0 100644 --- a/www/datastore/Summary.js +++ b/www/datastore/Summary.js @@ -197,7 +197,40 @@ Ext.define('PBS.DataStoreSummary', { padding: 5, }, - tbar: ['->', { xtype: 'proxmoxRRDTypeSelector' }], + tbar: [ + { + xtype: 'button', + text: gettext('Show Datastore Information'), + handler: function() { + let me = this; + let panel = me.up('panel'); + Proxmox.Utils.API2Request({ + url: '/api2/extjs/nodes/localhost/status', + method: 'GET', + waitMsgTarget: panel, + failure: function(e) { + console.log(e); + }, + success: function(response) { + let fingerprint = response.result.data.info.fingerprint; + let hostname = window.location.hostname; + let datastore = panel.datastore; + Ext.create('PBS.JoinInfoWindow', { + joinInfo: { + ipAddress: hostname, + fingerprint: fingerprint, + datastore: datastore, + }, + }).show(); + }, + }); + }, + }, + '->', + { + xtype: 'proxmoxRRDTypeSelector', + }, + ], items: [ { diff --git a/www/window/DataStoreJoin.js b/www/window/DataStoreJoin.js new file mode 100644 index 00000000..023debc1 --- /dev/null +++ b/www/window/DataStoreJoin.js @@ -0,0 +1,88 @@ +Ext.define('PBS.JoinInfoWindow', { + extend: 'Ext.window.Window', + modal: true, + width: 600, + title: gettext('Datastore Join Information'), + mixins: ['Proxmox.Mixin.CBind'], + joinInfo: { + ipAddress: undefined, + fingerprint: undefined, + datastore: undefined, + }, + layout: 'form', + bodyPadding: '10 0', + items: [ + { + xtype: 'container', + layout: 'form', + border: false, + padding: '0 10 10 10', + items: [ + { + xtype: 'textfield', + fieldLabel: gettext('x509 Fingerprint'), + inputId: 'fingerprintField', + cbind: { + value: '{joinInfo.fingerprint}', + }, + editable: false, + }, + { + xtype: 'textfield', + fieldLabel: gettext('Hostname'), + editable: true, + inputId: 'hostnameField', + cbind: { + value: '{joinInfo.ipAddress}', + }, + }, + { + xtype: 'textfield', + fieldLabel: gettext('Datastore Name'), + inputId: 'datastoreField', + cbind: { + value: '{joinInfo.datastore}', + }, + editable: false, + }, + { + xtype: 'textarea', + inputId: 'SerializedJoinInfo', + fieldLabel: gettext('Join Information'), + grow: true, + editable: false, + cbind: { + joinInfo: '{joinInfo}', + }, + listeners: { + afterrender: function(field) { + var jsons = Ext.JSON.encode(field.joinInfo); + var base64s = Ext.util.Base64.encode(jsons); + field.setValue(base64s) + }, + }, + }, + ], + }, + ], + buttons: [ + { + xtype: 'button', + iconCls: 'fa fa-clipboard', + handler: function(b) { + var el = document.getElementById('SerializedJoinInfo'); + el.select(); + document.execCommand("copy"); + }, + text: gettext('Copy'), + }, + { + text: gettext('Ok'), + handler: function() { + this.up('window').close(); + }, + }, + ], +}); + + -- 2.20.1