diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 0b2485559..fc5df978a 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -402,7 +402,7 @@ function loadNodes(data) { sorted.sort(); // Add column for check box, node, ping, and power - sorted.unshift('', 'node', 'ping', 'power'); + sorted.unshift('', 'node', 'ping', 'power'); // Create a datatable var dTable = new DataTable('nodesDataTable'); @@ -623,7 +623,22 @@ function loadNodes(data) { // Turn table into a datatable var myDataTable = $('#nodesDataTable').dataTable(); setNodesDataTable(myDataTable); - + + // Do not sort ping and power column + var pingCol = $('#nodesDataTable thead tr th').eq(2); + var powerCol = $('#nodesDataTable thead tr th').eq(3); + pingCol.unbind('click'); + powerCol.unbind('click'); + + // Instead refresh the ping status and power status + pingCol.bind('click', function(event) { + refreshPingStatus(group); + }); + + powerCol.bind('click', function(event) { + refreshPowerStatus(group); + }); + /** * Get power and ping status for each node */ @@ -734,6 +749,29 @@ function loadPowerStatus(data) { } } +/** + * Refresh power status for each node + * + * @param group + * Group name + * @return Nothing + */ +function refreshPowerStatus(group) { + // Get the power status + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'rpower', + tgt : group, + args : 'stat', + msg : '' + }, + + success : loadPowerStatus + }); +} + /** * Load ping status for each node * @@ -762,6 +800,29 @@ function loadPingStatus(data) { } } +/** + * Refresh ping status for each node + * + * @param group + * Group name + * @return Nothing + */ +function refreshPingStatus(group) { + // Get the ping status + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'pping ' + group, + msg : '' + }, + + success : loadPingStatus + }); +} + /** * Load inventory for given node * @@ -1615,6 +1676,6 @@ function loadRconsPage(tgtNodes){ function addNode(v, m, f) { // If user clicks Ok if (v) { - + } } \ No newline at end of file