From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@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 9D66961025
 for <pbs-devel@lists.proxmox.com>; Fri, 11 Sep 2020 13:08:39 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 9529C24204
 for <pbs-devel@lists.proxmox.com>; Fri, 11 Sep 2020 13:08:09 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (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 63238241F5
 for <pbs-devel@lists.proxmox.com>; Fri, 11 Sep 2020 13:08:08 +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 3087A44B61
 for <pbs-devel@lists.proxmox.com>; Fri, 11 Sep 2020 13:08:08 +0200 (CEST)
To: pbs-devel@lists.proxmox.com
References: <20200828084658.22057-1-h.laimer@proxmox.com>
 <20200828084658.22057-5-h.laimer@proxmox.com>
From: Dominik Csapak <d.csapak@proxmox.com>
Message-ID: <f8a6a481-f4e8-d279-d9d7-9c58aced6ac4@proxmox.com>
Date: Fri, 11 Sep 2020 13:08:06 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:81.0) Gecko/20100101
 Thunderbird/81.0
MIME-Version: 1.0
In-Reply-To: <20200828084658.22057-5-h.laimer@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 2.337 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -3.576 Looks like a legit reply (A)
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 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 v3 proxmox-widget-toolbox 4/9] safe-destroy:
 add possibility to show a small note
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: Fri, 11 Sep 2020 11:08:39 -0000

comment inline

On 8/28/20 10:46 AM, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> add field to set the note and add ui-container for displaying it
> 
>   src/window/SafeDestroy.js | 26 ++++++++++++++++++++++++++
>   1 file changed, 26 insertions(+)
> 
> diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js
> index a6ad458..0027e98 100644
> --- a/src/window/SafeDestroy.js
> +++ b/src/window/SafeDestroy.js
> @@ -21,6 +21,7 @@ Ext.define('Proxmox.window.SafeDestroy', {
>   	    purgeable: false,
>   	},
>   	url: undefined,
> +	note: undefined,
>   	taskName: undefined,
>   	params: {},
>       },
> @@ -138,6 +139,22 @@ Ext.define('Proxmox.window.SafeDestroy', {
>   			'data-qtip': gettext('Remove from replication and backup jobs'),
>   		    },
>   		},
> +		{
> +		    xtype: 'container',
> +		    reference: 'noteContainer',
> +		    flex: 1,
> +		    layout: {
> +			type: 'vbox',
> +			align: 'middle',
> +		    },
> +		    height: 25,
> +		    items: [
> +			{
> +			    xtype: 'component',
> +			    reference: 'noteCmp',
> +			},
> +		    ],
> +		},

2 things here:
* if i have a very long message, it gets truncated and
is not completely visible anymore. since we often
have that text in a 'gettext' where we do not often
check for the length, this could be a problem

* i would set it to hidden by default

>   	    ],
>   	},
>       ],
> @@ -161,8 +178,17 @@ Ext.define('Proxmox.window.SafeDestroy', {
>   	}
>   
>   	const messageCmp = me.lookupReference('messageCmp');
> +	const noteCmp = me.lookupReference('noteCmp');
>   	let msg;
>   
> +	if (Ext.isDefined(me.getNote())) {
> +	    noteCmp.setHtml(`<small>${me.getNote()}</small>`);
> +	} else {
> +	    const noteContainer = me.lookupReference('noteContainer');
> +	    noteContainer.setDisabled(true);
> +	    noteContainer.setHidden(true);
> +	}

and here only make it visible if getNote is defined.
this makes the code a litte more compact
e.g.

let note = me.getNote();
if (Ext.isDefined(note)) {
     ...setHtml...
     ...setHidden(false)...
}

> +
>   	if (Ext.isDefined(me.getTaskName())) {
>   	    msg = Proxmox.Utils.format_task_description(me.getTaskName(), item.id);
>   	    messageCmp.setHtml(msg);
>