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 783D864161; Thu, 29 Oct 2020 16:29:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6A400AB2D; Thu, 29 Oct 2020 16:29:31 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 25227AB20; Thu, 29 Oct 2020 16:29:30 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E839745F8B; Thu, 29 Oct 2020 16:29:29 +0100 (CET) To: Proxmox VE development discussion , Oguz Bektas , pbs-devel@lists.proxmox.com References: <20201029141902.988185-1-o.bektas@proxmox.com> From: Thomas Lamprecht Message-ID: Date: Thu, 29 Oct 2020 16:29:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201029141902.988185-1-o.bektas@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.336 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.921 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH proxmox-backup] ui: add 'join info' copy/paste button on datastore summary X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2020 15:29:31 -0000 On 29.10.20 15:19, Oguz Bektas wrote: > shows information about the datastore: > - datastore name > - hostname > - host x509 fingerprint >=20 > and creates the base64-encoded json blob to be pasted into PVE to add > as storage. >=20 code looks familiar, no reference from where you took it? ;-) Did you see no way to pull common stuff out from the PVE cluster join inf= o this was based on to widget toolkit? Also, where's a user for this code? I.e., the PVE Storage Add and PBS Rem= ote add? It's a bit hard to review if one has only half of the picture.. > Signed-off-by: Oguz Bektas > --- >=20 > www/DataStoreSummary.js | 35 ++++++++++++++- > www/Makefile | 1 + > www/window/DataStoreJoin.js | 88 +++++++++++++++++++++++++++++++++++++= > 3 files changed, 123 insertions(+), 1 deletion(-) > create mode 100644 www/window/DataStoreJoin.js >=20 > diff --git a/www/DataStoreSummary.js b/www/DataStoreSummary.js > index 93bd99a3..616e2cf7 100644 > --- a/www/DataStoreSummary.js > +++ b/www/DataStoreSummary.js > @@ -208,7 +208,40 @@ Ext.define('PBS.DataStoreSummary', { > padding: 5, > }, > =20 > - tbar: ['->', { xtype: 'proxmoxRRDTypeSelector' }], > + tbar: [ > + { > + xtype: 'button', > + text: gettext('Show Datastore Information'), > + handler: function() { > + let me =3D this; > + let panel =3D me.up('panel'); > + Proxmox.Utils.API2Request({ Why isn't this request not done by the "joininfowindow"? The button handler could also be a simple wrapper around creating that wi= ndow, which should do the request then on creation. Can be OK as is, but I'd then move this out as it gets a bit crowded here= =2E > + url: '/api2/extjs/nodes/localhost/status', > + method: 'GET', > + waitMsgTarget: panel, > + failure: function(e) { > + console.log(e); > + }, > + success: function(response) { > + let fingerprint =3D response.result.data.info.fingerprint; > + let hostname =3D window.location.hostname; > + let dsName =3D panel.datastore; > + Ext.create('PBS.JoinInfoWindow', { > + joinInfo: { > + ipAddress: hostname, > + fingerprint: fingerprint, > + dsName: dsName, s/dsName/datastore/ - clear, understandable names trumps saving a few let= ters. > + }, > + }).show(); > + }, > + }); > + }, > + }, > + '->', > + { > + xtype: 'proxmoxRRDTypeSelector', > + }, > + ], > =20 > items: [ > { > diff --git a/www/Makefile b/www/Makefile > index cba8bed5..42fe8724 100644 > --- a/www/Makefile > +++ b/www/Makefile > @@ -21,6 +21,7 @@ JSSRC=3D \ > window/BackupFileDownloader.js \ > window/CreateDirectory.js \ > window/DataStoreEdit.js \ > + window/DataStoreJoin.js \ > window/FileBrowser.js \ > window/NotesEdit.js \ > window/RemoteEdit.js \ > diff --git a/www/window/DataStoreJoin.js b/www/window/DataStoreJoin.js > new file mode 100644 > index 00000000..3a1dd87f > --- /dev/null > +++ b/www/window/DataStoreJoin.js > @@ -0,0 +1,88 @@ > +Ext.define('PBS.JoinInfoWindow', { join info is the wrong name here, use DatastoreInfo or something like tha= t, at least if that widget stays here and not in widget toolkit > + extend: 'Ext.window.Window', > + modal: true, > + width: 600, > + title: gettext('Datastore Join Information'), > + mixins: ['Proxmox.Mixin.CBind'], > + joinInfo: { > + ipAddress: undefined, > + fingerprint: undefined, > + dsName: 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: 'dsNameField', > + cbind: { > + value: '{joinInfo.dsName}', > + }, > + editable: false, > + }, > + { > + xtype: 'textarea', > + inputId: 'SerializedJoinInfo', > + fieldLabel: gettext('Join Information'), > + grow: true, > + editable: false, > + cbind: { > + joinInfo: '{joinInfo}', > + }, > + listeners: { > + afterrender: function(field) { > + var jsons =3D Ext.JSON.encode(field.joinInfo); > + var base64s =3D Ext.util.Base64.encode(jsons); > + field.setValue(base64s) > + }, > + }, > + }, > + ], > + }, > + ], > + buttons: [ > + { > + xtype: 'button', > + iconCls: 'fa fa-clipboard', > + handler: function(b) { > + var el =3D document.getElementById('SerializedJoinInfo'); > + el.select(); > + document.execCommand("copy"); > + }, > + text: gettext('Copy'), > + }, > + { > + text: gettext('Ok'), > + handler: function() { > + this.up('window').close(); > + }, > + }, > + ], > +}); > + > + >=20