[pve-devel] [PATCH manager 1/2] Filter by default the displayed guest backups fix #1161

Emmanuel Kasper e.kasper at proxmox.com
Thu Dec 15 16:25:58 CET 2016


This add a default filter which is executed on store initial load,
so we display only the backups matching our ID.
---
 www/manager6/grid/BackupView.js | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/www/manager6/grid/BackupView.js b/www/manager6/grid/BackupView.js
index 1646b28..1de5323 100644
--- a/www/manager6/grid/BackupView.js
+++ b/www/manager6/grid/BackupView.js
@@ -43,13 +43,25 @@ Ext.define('PVE.grid.BackupView', {
 	    throw "unsupported VM type '" + vmtype + "'";
 	}
 
+	var searchFilter = {
+	    property: 'volid',
+	// on initial store display only our vmid backups
+	// surround with minus sign to prevent the 2016 VMID bug
+	    value: vmtype + '-' + vmid + '-',
+	    anyMatch: true,
+	    caseSensitive: false
+	};
+
 	me.store = Ext.create('Ext.data.Store', {
 	    model: 'pve-storage-content',
 	    sorters: { 
 		property: 'volid', 
 		order: 'DESC' 
 	    },
-	    filters: { filterFn: filterFn }
+	    filters: [
+	        filterFn,
+		searchFilter
+		]
 	});
 
 	var reload = Ext.Function.createBuffered(function() {
@@ -88,18 +100,15 @@ Ext.define('PVE.grid.BackupView', {
 	    labelWidth: 50,
 	    labelAlign: 'right',
 	    enableKeyEvents: true,
+	    value: searchFilter.value,
 	    listeners: {
 		buffer: 500,
 		keyup: function(field) {
 		    me.store.clearFilter(true);
+		    searchFilter.value = field.getValue();
 		    me.store.filter([
 			filterFn,
-			{
-			    property: 'volid',
-			    value: field.getValue(),
-			    anyMatch: true,
-			    caseSensitive: false
-			}
+			searchFilter
 		    ]);
 		}
 	    }
-- 
2.1.4





More information about the pve-devel mailing list