From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <p.hufnagl@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 1C81290CD0
 for <pbs-devel@lists.proxmox.com>; Mon,  2 Oct 2023 10:11:13 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id E9A741454C
 for <pbs-devel@lists.proxmox.com>; Mon,  2 Oct 2023 10:10:42 +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
 for <pbs-devel@lists.proxmox.com>; Mon,  2 Oct 2023 10:10:39 +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 F253A42B5A
 for <pbs-devel@lists.proxmox.com>; Mon,  2 Oct 2023 10:10:38 +0200 (CEST)
Message-ID: <58e15fa1-841e-ee16-c6e0-692a1b955ddb@proxmox.com>
Date: Mon, 2 Oct 2023 10:10:38 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.1
Content-Language: en-US
To: Dominik Csapak <d.csapak@proxmox.com>,
 Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>
References: <20230929123007.1901798-1-p.hufnagl@proxmox.com>
 <ddee2393-7232-4b85-aa7a-9fa81c915519@proxmox.com>
From: Philipp Hufnagl <p.hufnagl@proxmox.com>
In-Reply-To: <ddee2393-7232-4b85-aa7a-9fa81c915519@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 1.479 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -3.058 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: [pbs-devel] [PATCH proxmox-backup] ui: fix #4260: add dynamic
 notes in backup group comment
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 02 Oct 2023 08:11:13 -0000



On 10/2/23 09:30, Dominik Csapak wrote:
> a few comments inline
> 
> On 9/29/23 14:30, Philipp Hufnagl wrote:
>> When there is no comment for a backup group, the comment of the last
>> snapshot in this group will be shown slightly grayed out as long as
>> the group is collapsed.
>>
>> Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
>> ---
>>   www/css/ext6-pbs.css     |  3 +++
>>   www/datastore/Content.js | 17 ++++++++++++++---
>>   2 files changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/www/css/ext6-pbs.css b/www/css/ext6-pbs.css
>> index 5fd65d25..324f73b8 100644
>> --- a/www/css/ext6-pbs.css
>> +++ b/www/css/ext6-pbs.css
>> @@ -226,6 +226,9 @@ span.snapshot-comment-column {
>>       display: inline-block;
>>       width: calc(100% - 18px);
>>   }
>> +span.snapshot-comment-derived {
>> +    opacity: 0.7;
>> +}
> 
> for such generic properties, i'd like to have more generic names,
> e.g 'pmx-disabled'  or 'pmx-faded' ?

That is a very good name. Ill make a V2
> 
>>     .x-action-col-icon.good:before {
>>       color: #21BF4B;
>> diff --git a/www/datastore/Content.js b/www/datastore/Content.js
>> index 9fc07d49..926aab89 100644
>> --- a/www/datastore/Content.js
>> +++ b/www/datastore/Content.js
>> @@ -146,6 +146,7 @@ Ext.define('PBS.DataStoreContent', {
>>               leaf: false,
>>               iconCls: "fa " + cls,
>>               expanded: false,
>> +            comment: item.data.comment,
>>               backup_type: item.data["backup-type"],
>>               backup_id: item.data["backup-id"],
>>               children: [],
>> @@ -287,6 +288,7 @@ Ext.define('PBS.DataStoreContent', {
>>               if (item["backup-time"] > last_backup && item.size !==
>> null) {
>>               last_backup = item["backup-time"];
>>               group["backup-time"] = last_backup;
>> +            group["last-comment"] = item.comment;
>>               group.files = item.files;
>>               group.size = item.size;
>>               group.owner = item.owner;
>> @@ -900,16 +902,25 @@ Ext.define('PBS.DataStoreContent', {
>>           flex: 1,
>>           renderer: (v, meta, record) => {
>>           let data = record.data;
>> +        let additional_classes = "";
> 
> i'd like for variables to be defined closer to where they are used,
> namely
> 
>>           if (!data || data.leaf || data.root) {
>>               return '';
>>           }
>> -        if (v === undefined || v === null) {
>> -            v = '';
>> +
> 
> here

Will do
> 
>> +        // when there is no group comment and the section is
>> collapsed,
>> +        // display the most recent snapshot comment
>> +        if (v === undefined || v === null|| v === '') {
>> +            if (data.expanded === false) {
>> +            v = data['last-comment'];
> 
> is it guaranteed to be a stringe here? else i'd do :
> 
> v = data['last-comment'] ?? '';
> 
> (or do it at the assignment level above)

I think it is garanteed since it comes from the backend. But I will
apply your suggestion to be sure
> 
>> +            additional_classes = "snapshot-comment-derived";
>> +            } else {
>> +            v = '';
>> +            } >           }
>>           v = Ext.String.htmlEncode(v);
>>           let icon = 'x-action-col-icon fa fa-fw fa-pencil pointer';
>>   -        return `<span class="snapshot-comment-column">${v}</span>
>> +        return `<span class="snapshot-comment-column
>> ${additinal_classes}">${v}</span>
> 
> please test your patches. i did not, but i can see clearly here that
> the additional classes
> could not have worked, since you have a typo in them
> 'additinal_classes' vs 'additional_classes'

I actually tested it and I do not understand how that actually worked
at my side. Regardless sorry for this misstake. Ill fix it in the v2
> 
> 
>>               <i data-qtip="${gettext('Edit')}" style="float: right;
>> margin: 0px;" class="${icon}"></i>`;
>>           },
>>           listeners: {
> 
>