[pve-devel] r6016 - in pve-manager/pve2/www/new: . node

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 24 14:07:15 CEST 2011


Author: dietmar
Date: 2011-05-24 14:07:14 +0200 (Tue, 24 May 2011)
New Revision: 6016

Added:
   pve-manager/pve2/www/new/node/Tasks.js
Modified:
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/node/Config.js
Log:
start task list


Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	2011-05-24 10:36:28 UTC (rev 6015)
+++ pve-manager/pve2/www/new/Makefile.am	2011-05-24 12:07:14 UTC (rev 6016)
@@ -42,6 +42,7 @@
 	node/ServiceView.js				\
 	node/NetworkEdit.js				\
 	node/NetworkView.js				\
+	node/Tasks.js					\
 	node/Config.js					\
 	qemu/StatusView.js				\
 	qemu/Summary.js					\

Modified: pve-manager/pve2/www/new/node/Config.js
===================================================================
--- pve-manager/pve2/www/new/node/Config.js	2011-05-24 10:36:28 UTC (rev 6015)
+++ pve-manager/pve2/www/new/node/Config.js	2011-05-24 12:07:14 UTC (rev 6016)
@@ -41,9 +41,7 @@
 		{
 		    title: 'Tasks',
 		    itemId: 'tasks',
-		    //xtype: 'pveNodeTasks',
-		    //nodename: nodename
-		    html: "time"
+		    xtype: 'pveNodeTasks'
 		}
 	    ]
 	});

Added: pve-manager/pve2/www/new/node/Tasks.js
===================================================================
--- pve-manager/pve2/www/new/node/Tasks.js	                        (rev 0)
+++ pve-manager/pve2/www/new/node/Tasks.js	2011-05-24 12:07:14 UTC (rev 6016)
@@ -0,0 +1,118 @@
+Ext.define('PVE.node.Tasks', {
+    extend: 'Ext.grid.GridPanel',
+
+    alias: ['widget.pveNodeTasks'],
+
+    initComponent : function() {
+	var me = this;
+
+	var nodename = me.pveSelNode.data.node;
+	if (!nodename) 
+	    throw "no node name specified";
+
+	var store = Ext.create('Ext.data.Store', {
+	    pageSize: 500,
+ 	    model: Ext.define('pve-tasks', {
+		extend: 'Ext.data.Model',
+		fields:  [ 
+		    { name: 'starttime', type : 'date', dateFormat: 'timestamp' }, 
+		    { name: 'endtime', type : 'date', dateFormat: 'timestamp' }, 
+		    { name: 'pid', type: 'int' },
+		    'node', 'upid', 'user', 'status', 'type', 'id'
+		],
+		idProperty: 'upid'
+	    }),
+	    proxy: {
+                type: 'pve',
+		startParam: 'start',
+		limitParam: 'limit',
+
+                url: "/api2/json/nodes/" + nodename + "/tasks"
+	    },
+	   // sorters: [{
+	//	property: 'starttime',
+	//	direction: 'DESC'
+          //  }]
+	});
+
+	var ptbar = new Ext.PagingToolbar({
+	    store: store,       // grid and PagingToolbar using same store
+	    displayInfo: true
+	});
+
+
+	var userfilter = '';
+	var filter_errors = 0;
+
+	var reload_task = new Ext.util.DelayedTask(function() {
+	    var params = {
+		// specify params for the first page load if using paging
+		start: 0,          
+		limit: store.pageSize,
+		errors: filter_errors
+	    };
+	    if (userfilter)
+		params.userfilter = userfilter;
+
+	    store.baseParams = params;
+	    ptbar.doRefresh();
+	});
+
+	//reload_task.delay(10);
+	store.loadPage(1);
+
+	Ext.apply(me, {
+	    store: store,
+	    stateful: false,
+	    bbar: ptbar,
+	    columns: [
+		{ 
+		    header: "Start Time", dataIndex: 'starttime',
+		    width: 100,
+		    sortable: false,
+		    renderer: function(value) { 
+			return Ext.Date.format(value, "M d H:i:s"); 
+		    }
+		},
+		{ 
+		    header: "End Time", dataIndex: 'endtime',
+		    width: 100,
+		    sortable: false,
+		    renderer: function(value, metaData, record) {
+			return  Ext.Date.format(value,"M d H:i:s"); 
+		    }
+		},
+		{ 
+		    header: "Node", dataIndex: 'node',
+		    sortable: false,
+		    width: 100
+		},
+		{ 
+		    header: "User", dataIndex: 'user',
+		    sortable: false,
+		    width: 150
+		},
+		{ 
+		    header: "Description", dataIndex: 'upid', 
+		    sortable: false,
+		    flex: 1,
+		    renderer: PVE.Utils.render_upid
+		},
+		{ 
+		    header: "Status", dataIndex: 'status', 
+		    sortable: false,
+		    width: 200,
+		    renderer: function(value, metaData, record) { 
+			if (value == 'OK')
+			    return 'OK';
+			// metaData.attr = 'style="color:red;"'; 
+			return "ERROR: " + value;
+		    }
+		}
+	    ]
+	});
+
+	me.callParent();
+    }
+});
+




More information about the pve-devel mailing list