From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <a.lauterer@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 E05E991B59
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 11:33:45 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id C36BB227EE
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 11:33:45 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (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
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 11:33:41 +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 141024623E
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 11:33:41 +0100 (CET)
Message-ID: <4075a841-6ffc-8f2d-942b-fa6d546d0ae0@proxmox.com>
Date: Thu, 9 Feb 2023 11:33:39 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.6.1
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Dominik Csapak <d.csapak@proxmox.com>
References: <20230202144135.3892582-1-d.csapak@proxmox.com>
 <20230202144135.3892582-6-d.csapak@proxmox.com>
From: Aaron Lauterer <a.lauterer@proxmox.com>
In-Reply-To: <20230202144135.3892582-6-d.csapak@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.531 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -1.148 Looks like a legit reply (A)
 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 manager v2 5/6] ui: add window for changing
 tree related options
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 09 Feb 2023 10:33:45 -0000

two small nits inline

On 2/2/23 15:41, Dominik Csapak wrote:
> such as the sorting/grouping of guests. saves them in the browser local
> storage under 'pve-tree-sorting'
> 
> adds a button for it next to the the view selector
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>   www/manager6/Makefile                   |  1 +
>   www/manager6/Workspace.js               | 26 +++++++-
>   www/manager6/window/TreeSettingsEdit.js | 87 +++++++++++++++++++++++++
>   3 files changed, 112 insertions(+), 2 deletions(-)
>   create mode 100644 www/manager6/window/TreeSettingsEdit.js
> 
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 2c487655f..b73b729ad 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -119,6 +119,7 @@ JSSRC= 							\
>   	window/ScheduleSimulator.js			\
>   	window/Wizard.js				\
>   	window/GuestDiskReassign.js				\
> +	window/TreeSettingsEdit.js			\
>   	ha/Fencing.js					\
>   	ha/GroupEdit.js					\
>   	ha/GroupSelector.js				\
> diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
> index a3872b560..b80a4a2f6 100644
> --- a/www/manager6/Workspace.js
> +++ b/www/manager6/Workspace.js
> @@ -223,7 +223,9 @@ Ext.define('PVE.StdWorkspace', {
>   	let appState = Ext.create('PVE.StateProvider');
>   	Ext.state.Manager.setProvider(appState);
>   
> -	let selview = Ext.create('PVE.form.ViewSelector');
> +	let selview = Ext.create('PVE.form.ViewSelector', {
> +	    flex: 1,
> +	});
>   
>   	let rtree = Ext.createWidget('pveResourceTree', {
>   	    viewFilter: selview.getViewFilter(),
> @@ -449,7 +451,27 @@ Ext.define('PVE.StdWorkspace', {
>   		    margin: '0 0 0 5',
>   		    split: true,
>   		    width: 300,
> -		    items: [selview, rtree],
> +		    items: [
> +			{
> +			    xtype: 'container',
> +			    layout: 'hbox',
> +			    padding: '0 0 5 0',
> +			    items: [
> +				selview,
> +				{
> +				    xtype: 'button',

It currently looks a bit cramped.
Can we add a
margin: '0 0 0 5',
here? This way we leave the same space to the drop down menu to the left as 
everywhere else in that part of the UI.

> +				    iconCls: 'fa fa-fw fa-gear',
> +				    handler: () => {
> +					Ext.create('PVE.window.TreeSettingsEdit', {
> +					    autoShow: true,
> +					    apiCallDone: () => PVE.UIOptions.fireUIConfigChanged(),
> +					});
> +				    },
> +				},
> +			    ],
> +			},
> +			rtree,
> +		    ],
>   		    listeners: {
>   			resize: function(panel, width, height) {
>   			    var viewWidth = me.getSize().width;
> diff --git a/www/manager6/window/TreeSettingsEdit.js b/www/manager6/window/TreeSettingsEdit.js
> new file mode 100644
> index 000000000..058980dc1
> --- /dev/null
> +++ b/www/manager6/window/TreeSettingsEdit.js
> @@ -0,0 +1,87 @@
> +Ext.define('PVE.window.TreeSettingsEdit', {
> +    extend: 'Proxmox.window.Edit',
> +    alias: 'widget.pveTreeSettingsEdit',
> +
> +    title: gettext('Tree Settings'),
> +
> +    isCreate: false,
> +
> +    // we don't want an url, we override submit(), but it is needed by the parent class
> +    url: 'bogus',
> +
> +    fieldDefaults: {
> +	labelWidth: 120,
> +    },
> +
> +    items: [
> +	{
> +	    xtype: 'inputpanel',
> +	    items: [
> +		{
> +		    xtype: 'proxmoxKVComboBox',
> +		    name: 'sort-field',
> +		    fieldLabel: gettext('Sort Field'),
> +		    comboItems: [
> +			['__default__', `${Proxmox.Utils.defaultText} (VMID)`],
> +			['vmid', 'VMID'],
> +			['name', gettext('Name')],
> +		    ],
> +		    defaultValue: '__default__',
> +		    value: '__default__',
> +		    deleteEmpty: false,
> +		},
> +		{
> +		    xtype: 'proxmoxKVComboBox',
> +		    name: 'group-templates',
> +		    fieldLabel: gettext('Group Templates'),
> +		    comboItems: [
> +			['__default__', `${Proxmox.Utils.defaultText} (${gettext("Yes")})`],
> +			[1, gettext('Yes')],
> +			[0, gettext('No')],
> +		    ],
> +		    defaultValue: '__default__',
> +		    value: '__default__',
> +		    deleteEmpty: false,
> +		},
> +		{
> +		    xtype: 'proxmoxKVComboBox',
> +		    name: 'group-guest-types',
> +		    fieldLabel: gettext('Group Types'),
> +		    comboItems: [
> +			['__default__', `${Proxmox.Utils.defaultText} (${gettext("Yes")})`],
> +			[1, gettext('Yes')],
> +			[0, gettext('No')],
> +		    ],
> +		    defaultValue: '__default__',
> +		    value: '__default__',
> +		    deleteEmpty: false,
> +		},
> +		{
> +		    xtype: 'displayfield',
> +		    userCls: 'pmx-hint',
> +		    value: gettext('Settings are saved in the browser local storage'),

s/browser/browser's/  to indicate possession. Or we could rephrase it to 
"Settings are saved in the local storage of the browser".

> +		},
> +	    ],
> +	},
> +    ],
> +
> +    submit: function() {
> +	let me = this;
> +
> +	let localStorage = Ext.state.Manager.getProvider();
> +	localStorage.set('pve-tree-sorting', me.down('inputpanel').getValues() || null);
> +
> +	me.apiCallDone();
> +	me.close();
> +    },
> +
> +    initComponent: function() {
> +	let me = this;
> +
> +	me.callParent();
> +
> +	let localStorage = Ext.state.Manager.getProvider();
> +	me.down('inputpanel').setValues(localStorage.get('pve-tree-sorting'));
> +    },
> +
> +});