[pve-devel] [PATCH manager 1/5 v2] Storage GUI: Rewrite backup content view as TreePanel.

Matthias Heiserer m.heiserer at proxmox.com
Wed Mar 30 14:59:58 CEST 2022


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 :)





More information about the pve-devel mailing list