[pve-devel] applied: [PATCH v4 manager] Fix #1831: Add filter to CT template/appliances download window

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 1 09:30:13 CET 2019


On 1/31/19 5:29 PM, Christian Ebner wrote:
> This adds the posibility to filter CT template/appliances by package as well as
> description in the CT template/appliances download window.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> 
> Version 4:
>     * Inlined filter function (thanks, makes it indeed a lot more readable!)
>     * Replaced != with !==
>     * No more trailing whitespaces
> 
>  www/manager6/storage/ContentView.js | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
> index 6b73f437..c2b8c64b 100644
> --- a/www/manager6/storage/ContentView.js
> +++ b/www/manager6/storage/ContentView.js
> @@ -40,6 +40,26 @@ Ext.define('PVE.grid.TemplateSelector', {
>  	Ext.apply(me, {
>  	    store: store,
>  	    selModel: sm,
> +	    tbar: [
> +		'->',
> +		gettext('Filter: '),
> +		{
> +		    xtype: 'textfield',
> +		    width: 200,
> +		    enableKeyEvents: true,
> +		    listeners: {
> +			buffer: 500,
> +			keyup: function(field) {
> +			    var value = field.getValue().toLowerCase();
> +			    store.clearFilter(true);
> +			    store.filterBy(function(rec) {
> +				return (rec.data['package'].toLowerCase().indexOf(value) !== -1)
> +				|| (rec.data.headline.toLowerCase().indexOf(value) !== -1);
> +			    });
> +			}
> +		    }
> +		}
> +	    ],
>  	    features: [ groupingFeature ],
>  	    columns: [
>  		{
> @@ -92,8 +112,8 @@ Ext.define('PVE.storage.TemplateDownload', {
>      modal: true,
>      title: gettext('Templates'),
>      layout: 'fit',
> -    width: 600,
> -    height: 400,
> +    width: 900,
> +    height: 600,
>      initComponent : function() {
>  	/*jslint confusion: true */
>          var me = this;
> 

applied thanks, but replaced 'Filter: ' with 'Search' (sorry, I know I suggested something
like Filter off-list, but Search is already translated and works here too, so I took than
one).




More information about the pve-devel mailing list