From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 58C0091EC for ; Thu, 31 Mar 2022 08:37:01 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 49415F0DE for ; Thu, 31 Mar 2022 08:37:01 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 0636FF5ED for ; Thu, 31 Mar 2022 08:37:00 +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 C80D5457B5 for ; Thu, 31 Mar 2022 08:36:59 +0200 (CEST) Message-ID: <943bba51-1bd3-263b-d8c7-1cd667d15d00@proxmox.com> Date: Thu, 31 Mar 2022 08:36:52 +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: Matthias Heiserer , pve-devel@lists.proxmox.com, Thomas Lamprecht References: <20220318135226.2360890-1-m.heiserer@proxmox.com> <20220318135226.2360890-2-m.heiserer@proxmox.com> From: Fabian Ebner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.114 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2022 06:37:01 -0000 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() ;)