[pbs-devel] [PATCH proxmox-backup v3] ui: fix #4260: add dynamic notes in backup group comment

Dominik Csapak d.csapak at proxmox.com
Mon Oct 2 14:59:10 CEST 2023


two comments inline

otherwise LGTM

On 10/2/23 13:53, Philipp Hufnagl wrote:
> 
> Changes since v1:
> * fixed typo at "additonal classes"
> * renamed css class to "faded" so it can be used more generic
> * guarded snapshot comment for not being a string guarded snapshot
> 
> Changes since v2:
> * fixed variable name in violation of coding guidelines
> 
> 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 at 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..fce3f4cd 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.pmx-faded {
> +    opacity: 0.7;
> +}

please leave out the span, otherwise we can't use it on non-spans
the classname is 'namespaced' anyway, so no need to restrict it to
spans

>   
>   .x-action-col-icon.good:before {
>       color: #21BF4B;
> diff --git a/www/datastore/Content.js b/www/datastore/Content.js
> index 9fc07d49..1529bea7 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;
> @@ -903,13 +905,22 @@ Ext.define('PBS.DataStoreContent', {
>   		if (!data || data.leaf || data.root) {
>   		    return '';
>   		}
> -		if (v === undefined || v === null) {
> -		    v = '';
> +
> +		let additionalClasses = "";
> +		// 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'] ?? '';
> +		    additionalClasses = "pmx-faded";

the indentation here is off, i previously blamed my mail client, but there is a level of indentation 
missing in the if block here

> +		    } 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 ${additionalClasses}">${v}</span>
>   		    <i data-qtip="${gettext('Edit')}" style="float: right; margin: 0px;" class="${icon}"></i>`;
>   	    },
>   	    listeners: {






More information about the pbs-devel mailing list