[pve-devel] [PATCH manager 1/5 v2] Storage GUI: Rewrite backup content view as TreePanel.
Fabian Ebner
f.ebner at proxmox.com
Thu Mar 31 08:36:52 CEST 2022
Am 30.03.22 um 14:59 schrieb Matthias Heiserer:
> 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.
>
Ok.
>>
>> (...)
>>
>>> + 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.
I don't think it's explicitly forbidden by our style guide, which
essentially is what the linter complains about, but in the (vast)
majority of cases, the body is on its own line.
>>
>>> + 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 :)
I mean, you would need to return it as part of the cbindData() ;)
More information about the pve-devel
mailing list