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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9ABA49208 for ; Thu, 31 Mar 2022 08:57:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 89C98F93A for ; Thu, 31 Mar 2022 08:56:58 +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 DDBF0F92E for ; Thu, 31 Mar 2022 08:56:56 +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 A5A4C42991 for ; Thu, 31 Mar 2022 08:56:56 +0200 (CEST) Message-ID: Date: Thu, 31 Mar 2022 08:56:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Thunderbird/99.0 Content-Language: en-US To: Fabian Ebner , Matthias Heiserer , pve-devel@lists.proxmox.com References: <20220318135226.2360890-1-m.heiserer@proxmox.com> <20220318135226.2360890-2-m.heiserer@proxmox.com> <943bba51-1bd3-263b-d8c7-1cd667d15d00@proxmox.com> From: Thomas Lamprecht In-Reply-To: <943bba51-1bd3-263b-d8c7-1cd667d15d00@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] 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:57:28 -0000 On 31.03.22 08:36, Fabian Ebner wrote: > Am 30.03.22 um 14:59 schrieb Matthias Heiserer: >> 8< >> >>>> +=C2=A0=C2=A0=C2=A0 onLoad: function(store, records, success, operat= ion) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let me =3D this; >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let view =3D me.getView(= ); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let selection =3D view.g= etSelection()?.[0]; >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 selection =3D selection?= =2EparentNode?.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. >> seems odd use of side-effect, if that's relevant it could be checked more= explicitly with a boolean expression (as JS "arithmetic" operations can be quite wei= rd). Note also that `var foo =3D "asdf" + undefined;` makes `foo` be "asdfunde= fined" so are you sure that's the behavior you want? FWIW, you could also destructure an additional object level like: let { data, parentNode } =3D view.getSelection()?.[0] ?? {}; =20 Could make checking explicitly easier. >>> (...) >>> >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (selection) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let rootnode =3D view.ge= tRootNode(); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let selected; >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rootnode.cascade(node =3D= > { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = 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. >=20 Thanks for the hint, it's now: https://pve.proxmox.com/wiki/Javascript_Style_Guide#Single-Line_If-Statem= ent