[pve-devel] [PATCH] GUI: add quick search fields to storage content and backup views

Stanislav German-Evtushenko ginermail at gmail.com
Tue Mar 31 18:20:10 CEST 2015


Signed-off-by: Stanislav German-Evtushenko <ginermail at gmail.com>
---
 www/manager/grid/BackupView.js     | 23 ++++++++++++++++++++++-
 www/manager/storage/ContentView.js | 21 +++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/www/manager/grid/BackupView.js b/www/manager/grid/BackupView.js
index 0ebad8f..ceef532 100644
--- a/www/manager/grid/BackupView.js
+++ b/www/manager/grid/BackupView.js
@@ -75,6 +75,27 @@ Ext.define('PVE.grid.BackupView', {
 	    }
 	});
 
+	var storagefilter = Ext.create('Ext.form.field.Text', {
+	    fieldLabel: gettext('Search'),
+	    labelWidth: 50,
+	    labelAlign: 'right',
+	    enableKeyEvents: true,
+	    listeners: {
+		buffer: 500,
+		keyup: function(field) {
+		    me.store.clearFilter(true);
+		    me.store.filter([
+			{
+			    property: 'volid',
+			    value: field.getValue(),
+			    anyMatch: true,
+			    caseSensitive: false
+			}
+		    ]);
+		}
+	    }
+	});
+
 	var sm = Ext.create('Ext.selection.RowModel', {});
 
 	var backup_btn = Ext.create('Ext.button.Button', {
@@ -151,7 +172,7 @@ Ext.define('PVE.grid.BackupView', {
 	Ext.apply(me, {
 	    stateful: false,
 	    selModel: sm,
-	    tbar: [ backup_btn, restore_btn, delete_btn, '->', storagesel ],
+	    tbar: [ backup_btn, restore_btn, delete_btn, '->', storagesel, storagefilter ],
 	    columns: [
 		{
 		    header: gettext('Name'),
diff --git a/www/manager/storage/ContentView.js b/www/manager/storage/ContentView.js
index fcbb0ac..1a715e3 100644
--- a/www/manager/storage/ContentView.js
+++ b/www/manager/storage/ContentView.js
@@ -443,6 +443,27 @@ Ext.define('PVE.storage.ContentView', {
 			win.show();
 			win.on('destroy', reload);
 		    }
+		},
+		'->',
+		gettext('Search') + ':', ' ',
+		{
+		    xtype: 'textfield',
+		    width: 200,
+		    enableKeyEvents: true,
+		    listeners: {
+			buffer: 500,
+			keyup: function(field) {
+			    store.clearFilter(true);
+			    store.filter([
+				{
+				    property: 'text',
+				    value: field.getValue(),
+				    anyMatch: true,
+				    caseSensitive: false
+				}
+			    ]);
+			}
+		    }
 		}
 	    ],
 	    columns: [
-- 
1.9.1




More information about the pve-devel mailing list