public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH] ui: datastore: Add basic expand/collapse all button
Date: Mon, 13 Jul 2020 14:28:55 +0200	[thread overview]
Message-ID: <c458d99e-155a-b285-3d03-9b1bc113538a@proxmox.com> (raw)
In-Reply-To: <20200713120347.25811-1-a.lauterer@proxmox.com>

ignore this version as it will not handle situations with only some tree 
items expanded very well. v2 is underway.

On 7/13/20 2:03 PM, Aaron Lauterer wrote:
> The parent component to the tree grid (tab.panel) does not understand
> the Ext.panel.Tool class which would usually be used in such a
> situation.
> 
> As a workaround a simple button (right aligned) in the tbar section has
> to do the job for now.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>   www/DataStoreContent.js | 27 +++++++++++++++++++++++++--
>   1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js
> index a29436fc..cac0b481 100644
> --- a/www/DataStoreContent.js
> +++ b/www/DataStoreContent.js
> @@ -47,6 +47,8 @@ Ext.define('PBS.DataStoreContent', {
>   
>       title: gettext('Content'),
>   
> +    isExpanded: false,
> +
>       controller: {
>   	xclass: 'Ext.app.ViewController',
>   
> @@ -321,7 +323,22 @@ Ext.define('PBS.DataStoreContent', {
>   		'backup-time': (time.getTime()/1000).toFixed(0),
>   		'backup-type': type,
>   	    }).show();
> -	}
> +	},
> +
> +	expandCollapseAll: function (button) {
> +	    let me = this;
> +	    let view = me.getView();
> +
> +	    if (me.isExpanded) {
> +		view.collapseAll();
> +		me.isExpanded = false;
> +		button.setText(gettext('Expand All'));
> +	    } else {
> +		view.expandAll();
> +		me.isExpanded = true;
> +		button.setText(gettext('Collapse All'));
> +	    }
> +	},
>       },
>   
>       columns: [
> @@ -446,6 +463,12 @@ Ext.define('PBS.DataStoreContent', {
>   	    enableFn: function(record) {
>   		return !!record.data.leaf && record.size !== null && record.data.files.some(el => el.filename.endsWith('pxar.didx'));
>   	    },
> -	}
> +	},
> +	'->',
> +	{
> +	    xtype: "proxmoxButton",
> +	    text: gettext('Expand All'),
> +	    handler: 'expandCollapseAll',
> +	},
>       ],
>   });
> 




      reply	other threads:[~2020-07-13 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 12:03 Aaron Lauterer
2020-07-13 12:28 ` Aaron Lauterer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c458d99e-155a-b285-3d03-9b1bc113538a@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal