From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <a.lauterer@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 B76049238
 for <pve-devel@lists.proxmox.com>; Wed,  8 Mar 2023 13:03:36 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 961C31FE7E
 for <pve-devel@lists.proxmox.com>; Wed,  8 Mar 2023 13:03:06 +0100 (CET)
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
 for <pve-devel@lists.proxmox.com>; Wed,  8 Mar 2023 13:03:04 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7DFFD45DF1
 for <pve-devel@lists.proxmox.com>; Wed,  8 Mar 2023 13:03:04 +0100 (CET)
Message-ID: <c271299b-a0ec-5da5-ad79-6a91916948f3@proxmox.com>
Date: Wed, 8 Mar 2023 13:03:03 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.8.0
To: Dominik Csapak <d.csapak@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20230303155925.1142116-1-a.lauterer@proxmox.com>
 <20230303155925.1142116-3-a.lauterer@proxmox.com>
 <68c45f86-51f1-5656-b5d5-3f7b7d82b74c@proxmox.com>
Content-Language: en-US
From: Aaron Lauterer <a.lauterer@proxmox.com>
In-Reply-To: <68c45f86-51f1-5656-b5d5-3f7b7d82b74c@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.042 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
Subject: Re: [pve-devel] [PATCH v2 manager 2/2] ui: ceph status: add tooltip
 with details to warnings
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, 08 Mar 2023 12:03:36 -0000



On 3/8/23 10:27, Dominik Csapak wrote:
> nice, works really good now with the different interactions
> (button/container/changing store/etc)
> 
> some comments inline (mostly minor stuff though)
> 
> On 3/3/23 16:59, Aaron Lauterer wrote:
[...]
>> diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
>> index b223ab35..9de89df5 100644
>> --- a/www/manager6/ceph/Status.js
>> +++ b/www/manager6/ceph/Status.js
>> @@ -76,6 +76,66 @@ Ext.define('PVE.node.CephStatus', {
>>               trackRemoved: false,
>>               data: [],
>>               },
>> +            generateTooltipText: (text) => {
>> +            text = text?.trimStart();
> 
> above you indicate that text might be undefined (with the 'text?.'),
> but below you don't to any checks again
> 
> iff text can really be undefined, i'd do
> text = text?.trimStart() ?? '';
> 
> otherwise just drop the '?'


hmm yeah, AFAICT there are already checks in place before we even call 
generateTooltipText -> dropping the '?'

> 
>> +            if (text.length > 500) {
>> +                text = `${text.substring(0, 500)}…`;
>> +            }
>> +            return text.replaceAll('\n', '<br>');
>> +            },
>> +            updateTooltip: (view, isLeave) => {
>> +            if (!view.tooltip) {
> 
> i was rather confused at first what 'view' actually is, but
> i found out it's the table view of the grid
> 
> couldn't you use always the grid ('this') instead ?
> or is there some instance where 'this' isn't the grid?
> 
> i think that would make the code a bit more readable, since
> you don't have to pass the view around

as discussed off-list: arrow functions do not set 'this' in the same context -> 
switch to regular 'updateTooltip: function(..) {' instead of arrow functions and 
in other places too.
> 

[...]