From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.whyte@proxmox.com>
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 AA4B96CFCF
 for <pbs-devel@lists.proxmox.com>; Wed, 31 Mar 2021 12:51:48 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 9B078E9DE
 for <pbs-devel@lists.proxmox.com>; Wed, 31 Mar 2021 12:51:48 +0200 (CEST)
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))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id E51BBE9D0
 for <pbs-devel@lists.proxmox.com>; Wed, 31 Mar 2021 12:51:47 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id AA34942F71
 for <pbs-devel@lists.proxmox.com>; Wed, 31 Mar 2021 12:51:47 +0200 (CEST)
To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Oguz Bektas <o.bektas@proxmox.com>
References: <20210331103540.466071-1-o.bektas@proxmox.com>
From: Dylan Whyte <d.whyte@proxmox.com>
Message-ID: <adb5e561-562f-dfcb-e690-edaceb76fffb@proxmox.com>
Date: Wed, 31 Mar 2021 12:51:46 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.9.0
MIME-Version: 1.0
In-Reply-To: <20210331103540.466071-1-o.bektas@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.016 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.001 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: [pbs-devel] [PATCH v4 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
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 31 Mar 2021 10:51:48 -0000

Hi,

I've just made one extra note to remove the "Datastore name" textfield 
update, as this field no longer exists. (Sorry, this is my bad for not 
seeing this during our off-list discussion).
Otherwise all is working perfectly.

Reviewed-By: Dylan Whyte<d.whyte@proxmox.com>

Tested-By: Dylan Whyte<d.whyte@proxmox.com>


On 3/31/21 12:35 PM, Oguz Bektas wrote:
> shows info about the datastore:
> - fingerprint
> - datastore name
> - hostname
>
> and creates the base64-encoded json blob to be pasted into Remote -> Add
> menu.
>
> Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
> ---
>   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 1790273f..61bb6e02 100644
> --- a/www/Makefile
> +++ b/www/Makefile
> @@ -61,6 +61,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 25a7b6e5..6a74155a 100644
> --- a/www/datastore/Summary.js
> +++ b/www/datastore/Summary.js
> @@ -185,7 +185,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..bb009cc4
> --- /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('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,
> +		},
This should also be pulled out, since this field is no longer present.
> +		{
> +		    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();
> +		},
> +	    },
> +	],
> +});
> +
> +