[pve-devel] r5755 - in pve-manager/pve2: lib/PVE/API2 www/manager

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Mar 25 12:43:51 CET 2011


Author: dietmar
Date: 2011-03-25 12:43:51 +0100 (Fri, 25 Mar 2011)
New Revision: 5755

Modified:
   pve-manager/pve2/lib/PVE/API2/Nodes.pm
   pve-manager/pve2/www/manager/NodeConfig.js
Log:
add filters for task list


Modified: pve-manager/pve2/lib/PVE/API2/Nodes.pm
===================================================================
--- pve-manager/pve2/lib/PVE/API2/Nodes.pm	2011-03-25 07:58:39 UTC (rev 5754)
+++ pve-manager/pve2/lib/PVE/API2/Nodes.pm	2011-03-25 11:43:51 UTC (rev 5755)
@@ -182,6 +182,14 @@
 		minimum => 0,
 		optional => 1,
 	    },
+	    userfilter => {
+		type => 'string',
+		optional => 1,
+	    },
+	    errors => {
+		type => 'boolean',
+		optional => 1,
+	    },
 	},
     },
     returns => {
@@ -205,6 +213,8 @@
 
 	my $start = $param->{start} || 0;
 	my $limit = $param->{limit} || 50;
+	my $userfilter = $param->{userfilter};
+	my $errors = $param->{errors};
 
 	my $count = 0;
 	my $line;
@@ -215,9 +225,12 @@
 		my $endtime = $3;
 		my $status = $5;
 		if ((my $task = PVE::Tools::upid_decode($upid, 1))) {
-		    next if $count++ < $start;
-		    next if $limit <= 0;
+		    return if $userfilter && $task->{user} !~ m/\Q$userfilter\E/i;
+		    return if $errors && $status && $status eq 'OK';
 
+		    return if $count++ < $start;
+		    return if $limit <= 0;
+
 		    $task->{upid} = $upid;
 		    $task->{endtime} = hex($endtime) if $endtime;
 		    $task->{status} = $status if $status;

Modified: pve-manager/pve2/www/manager/NodeConfig.js
===================================================================
--- pve-manager/pve2/www/manager/NodeConfig.js	2011-03-25 07:58:39 UTC (rev 5754)
+++ pve-manager/pve2/www/manager/NodeConfig.js	2011-03-25 11:43:51 UTC (rev 5755)
@@ -1349,14 +1349,31 @@
 
 	var page_size = 50;
 
-	taskstore.load({
-	    params: {
+	var userfilter = '';
+	var filter_errors = 0;
+
+	var ptbar = new Ext.PagingToolbar({
+	    store: taskstore,       // grid and PagingToolbar using same store
+	    displayInfo: true,
+	    pageSize: page_size
+	});
+
+	var reload_task = new Ext.util.DelayedTask(function() {
+	    var params = {
 		// specify params for the first page load if using paging
 		start: 0,          
 		limit: page_size,
-	    }
+		errors: filter_errors
+	    };
+	    if (userfilter)
+		params.userfilter = userfilter;
+
+	    taskstore.baseParams = params;
+	    ptbar.doRefresh();
 	});
 
+	reload_task.delay(1);
+
 	Ext.apply(self, {
 	    store: taskstore,
 	    border: false,
@@ -1370,11 +1387,33 @@
 			return "x-form-invalid";
 		}
 	    },
-	    bbar: new Ext.PagingToolbar({
-		store: taskstore,       // grid and PagingToolbar using same store
-		displayInfo: true,
-		pageSize: page_size,
-	    }),
+	    tbar: [
+		'->', 'User:', ' ',
+		{
+		    xtype: 'textfield',
+		    width: 200,
+		    value: userfilter,
+		    enableKeyEvents: true,
+		    listeners: {
+			keyup: function(field, e) {
+			    userfilter = field.getValue();
+			    reload_task.delay(500);
+			}
+		    }
+		}, ' ', 'Only Errors:', ' ',
+		{
+		    xtype: 'checkbox',
+		    hideLabel: true,
+		    checked: filter_errors,
+		    listeners: {
+			check: function(field, checked) {
+			    filter_errors = checked ? 1 : 0;
+			    reload_task.delay(1);
+			}
+		    }
+		}
+	    ],
+	    bbar: ptbar,
 	    columns: [
 		{ header: "Start Time", dataIndex: 'starttime',
 		  width: 100,



More information about the pve-devel mailing list