diff --git a/xCAT-UI/index.php b/xCAT-UI/index.php index a7dbfc6d6..762d59d99 100644 --- a/xCAT-UI/index.php +++ b/xCAT-UI/index.php @@ -22,26 +22,17 @@ if (!isAuthenticated()) { function testCmdPhp() { $xml = docmd('rinv', 'ca4dsls08', array('all')); $rsp = array(); - + foreach ($xml->children() as $child) { - // Get the 1st level child - foreach ($child->children() as $level_one) { - if ($level_one->children()) { - // Get the 2nd level child - foreach ($level_one->children() as $level_two) { - if ($level_two->children()) { - // Get the 3rd level child - foreach ($level_two->children() as $level_three) { - array_push($rsp, "$level_three"); - } - } else { - array_push($rsp, "$level_two"); - } - } - } else { - array_push($rsp, "$level_one"); + foreach ($child->children() as $data) { + if($data->name) { + $node = $data->name; + $cont = $data->data->contents; + array_push($rsp, "$node: $cont"); + } else if(strlen("$data") > 2) { + array_push($rsp, "$data"); } - } + } } $rtn = array("rsp" => $rsp, "msg" => ''); diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index ddf57860b..06407678c 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -44,12 +44,10 @@ hmc.prototype.loadInventory = function(data) { // Loop through each property for ( var k = 0; k < inv.length; k++) { - if (inv[k] != '0' && inv[k].indexOf(node) < 0) { - // Create a list item for each property - item = $('
  • '); - item.append(inv[k]); - oList.append(item); - } + // Create a list item for each property + item = $('
  • '); + item.append(inv[k].replace(node + ': ', '')); + oList.append(item); } // Append to inventory form diff --git a/xCAT-UI/lib/cmd.php b/xCAT-UI/lib/cmd.php index 92f72df84..397377105 100644 --- a/xCAT-UI/lib/cmd.php +++ b/xCAT-UI/lib/cmd.php @@ -64,22 +64,13 @@ if (isset($_GET["cmd"])) { // Handle the typical output else { foreach ($xml->children() as $child) { - // Get the 1st level child - foreach ($child->children() as $level_one) { - if ($level_one->children()) { - // Get the 2nd level child - foreach ($level_one->children() as $level_two) { - if ($level_two->children()) { - // Get the 3rd level child - foreach ($level_two->children() as $level_three) { - array_push($rsp, "$level_three"); - } - } else { - array_push($rsp, "$level_two"); - } - } - } else { - array_push($rsp, "$level_one"); + foreach ($child->children() as $data) { + if($data->name) { + $node = $data->name; + $cont = $data->data->contents; + array_push($rsp, "$node: $cont"); + } else if(strlen("$data") > 2) { + array_push($rsp, "$data"); } } }