From fbff1318dee4478e058d1a0cced89ae1e4ef6d7d Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 26 Oct 2011 04:29:57 +0000 Subject: [PATCH] Refresh nodes owned by user in self-service page git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10894 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/service/service.js | 60 +++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/xCAT-UI/js/service/service.js b/xCAT-UI/js/service/service.js index dc43fc963..2f938b5ba 100644 --- a/xCAT-UI/js/service/service.js +++ b/xCAT-UI/js/service/service.js @@ -551,27 +551,45 @@ function loadNodesTable(data) { var actionsLnk = $('Actions'); var refreshLnk = $('Refresh'); refreshLnk.click(function() { - var userName = $.cookie('srv_usrname'); - var userNodes = $.cookie(userName + '_usrnodes'); - if (userNodes) { - // Get nodes definitions - $.ajax( { - url : 'lib/srv_cmd.php', - dataType : 'json', - data : { - cmd : 'lsdef', - tgt : '', - args : userNodes, - msg : '' - }, - - success : loadNodesTable - }); - } else { - // Clear the tab before inserting the table - $('#manageTab').children().remove(); - $('#manageTab').append(createWarnBar('You are not managing any node. Try to provision a node.')); - } + // Get nodes owned by user + $.ajax( { + url : 'lib/srv_cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'nodetype', + msg : '' + }, + + success : function(data) { + // Save nodes owned by user + setUserNodes(data); + + // Refresh nodes table + var userName = $.cookie('srv_usrname'); + var userNodes = $.cookie(userName + '_usrnodes'); + if (userNodes) { + // Get nodes definitions + $.ajax( { + url : 'lib/srv_cmd.php', + dataType : 'json', + data : { + cmd : 'lsdef', + tgt : '', + args : userNodes, + msg : '' + }, + + success : loadNodesTable + }); + } else { + // Clear the tab before inserting the table + $('#manageTab').children().remove(); + $('#manageTab').append(createWarnBar('You are not managing any node. Try to provision a node.')); + } + } + }); }); var actionMenu = createMenu([cloneLnk, deleteLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, unlockLnk]);