From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <m.heiserer@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 407C98F26
 for <pve-devel@lists.proxmox.com>; Wed, 30 Mar 2022 15:00:32 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 23EC78C6D
 for <pve-devel@lists.proxmox.com>; Wed, 30 Mar 2022 15:00:02 +0200 (CEST)
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 id 1FE4B8C54
 for <pve-devel@lists.proxmox.com>; Wed, 30 Mar 2022 15:00:01 +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 CD53341CC6
 for <pve-devel@lists.proxmox.com>; Wed, 30 Mar 2022 15:00:00 +0200 (CEST)
Message-ID: <af7dc5a9-e1b2-3cb4-ed0d-173017ad4066@proxmox.com>
Date: Wed, 30 Mar 2022 14:59:58 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.7.0
Content-Language: en-US
To: Fabian Ebner <f.ebner@proxmox.com>, pve-devel@lists.proxmox.com,
 Thomas Lamprecht <t.lamprecht@proxmox.com>
References: <20220318135226.2360890-1-m.heiserer@proxmox.com>
 <20220318135226.2360890-2-m.heiserer@proxmox.com>
 <fad919f9-29ae-35ee-4a62-c331de7c305a@proxmox.com>
From: Matthias Heiserer <m.heiserer@proxmox.com>
In-Reply-To: <fad919f9-29ae-35ee-4a62-c331de7c305a@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.007 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           -0.001 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
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pve-devel] [PATCH manager 1/5 v2] Storage GUI: Rewrite backup
 content view as TreePanel.
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: Wed, 30 Mar 2022 13:00:32 -0000

8<

>> +	onLoad: function(store, records, success, operation) {
>> +	    let me = this;
>> +	    let view = me.getView();
>> +	    let selection = view.getSelection()?.[0];
>> +	    selection = selection?.parentNode?.data?.text +selection?.data?.volid;
> 
> Style nit: missing space after + and could use `${...}${...}` syntax
> instead.
That syntax won't work because then, if both parameters are undefined, 
the result would be a string instead of a falsy (NaN) value.
There's probably a better way of doing this.

> 
> (...)
> 
>> +	    if (selection) {
>> +		let rootnode = view.getRootNode();
>> +		let selected;
>> +		rootnode.cascade(node => {
>> +		    if (selected) {return false;} // skip if already found
> 
> Style nit: if body on the same line
Is 'if on one line' something we generally don't do? It appears 
occasionally in the code.
> 
>> +		method: 'DELETE',
>> +		callback: () => me.reload(),
>> +		failure: response => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
>> +	    });
>> +	},
>> +
>> +	searchKeyupFn: function(field) {
>> +	    let me = this;
>> +	    me.getView().getStore().getFilters().removeByKey('volid');
>> +	    me.getView().getStore().filter([
>> +		{
>> +		    property: 'volid',
>> +		    value: field.getValue(),
>> +		    anyMatch: true,
>> +		    caseSensitive: false,
>> +		    id: 'volid',
>>   		},
>> -		verification: {
>> -		    header: gettext('Verify State'),
>> -		    dataIndex: 'verification',
>> -		    renderer: PVE.Utils.render_backup_verification,
>> +	    ]);
>> +	},
>> +
>> +	searchClearHandler: function(field) {
>> +	    field.triggers.clear.setVisible(false);
>> +	    field.setValue(this.originalValue);
>> +	    this.getView().getStore().clearFilter();
>> +	},
>> +
>> +	searchChangeFn: function(field, newValue, oldValue) {
>> +	    if (newValue !== field.originalValue) {
>> +		field.triggers.clear.setVisible(true);
>> +	    }
>> +	},
>> +
>> +	storageSelectorBoxReady: function(selector, width, height, eOpts) {
>> +	    selector.setNodename(this.nodename);
>> +	},
> 
> Would cbind also be an option?
> 
Don't think so, as nodename comes from pveSelNode.
However, normal bind works :)