X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fnodes%2Fnodes.php;h=fca82147e7005e141f9c92c2faaea61f68b7d3a1;hb=e8610d5468f1757a209b68d52978d05f0c85affd;hp=8541c13aee7e36eaa12dc1df68e65957ec44b378;hpb=8dfeb8aa13ccfe89e04ca7e290f0dfbd10e1b5ab;p=plewww.git diff --git a/planetlab/nodes/nodes.php b/planetlab/nodes/nodes.php index 8541c13..fca8214 100644 --- a/planetlab/nodes/nodes.php +++ b/planetlab/nodes/nodes.php @@ -16,8 +16,11 @@ include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_peers.php'; -require_once 'plc_minitabs.php'; -require_once 'plc_tables.php'; +require_once 'linetabs.php'; +require_once 'table.php'; +require_once 'nifty.php'; + +ini_set("memory_limit","48M"); // -------------------- // recognized URL arguments @@ -29,7 +32,6 @@ $slice_id=intval($_GET['slice_id']); // --- decoration $title="Nodes"; $tabs=array(); -$mysite_id=plc_my_site_id(); $tabs []= tab_nodes_mysite(); $tabs []= tab_nodes_local(); @@ -40,21 +42,21 @@ $node_filter=array(); // performs sanity check and summarize the result in a single column function node_status ($node) { - $messages=array(); - // do all this stuff on local nodes only - if ( ! $node['peer_id'] ) { - // check that the node has keys - if (count($node['interface_ids']) == 0) { - $messages [] = "No interface"; - } + if ( $node['peer_id'] ) + return "n/a"; + + $messages=array(); + // check that the node has interfaces + if (count($node['interface_ids']) == 0) { + $messages [] = "No interface"; } return plc_vertical_table($messages,'plc-warning'); } // fetch nodes -$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id', "arch"); +$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id', 'arch','slice_ids'); // server-side filtering - set pattern in $_GET for filtering on hostname if ($pattern) { $node_filter['hostname']=$pattern; @@ -116,58 +118,70 @@ foreach ($sites as $site) $site_hash[$site['site_id']]=$site; // -------------------- drupal_set_title($title); -plc_tabs($tabs); +plekit_linetabs($tabs); if ( ! $nodes ) { drupal_set_message ('No node found'); return; } -$headers = array ("Peer"=>"string", - "Region"=>"string", - "Site"=>"string", - "State"=>"string", - "Hostname"=>"string", - "IP"=>"IPAddress", - "Type"=>"string", - "Arch"=>"string", - "?"=>"string", - ); +$nifty=new PlekitNifty ('','objects-list','big'); +$nifty->start(); +$headers = array (); +$headers["P"]="string"; +$headers["R"]="string"; +$headers["Site"]="string"; +$headers["State"]="string"; +$headers["Hostname"]="string"; +$headers["Type"]="string"; +$headers["IP"]="IPAddress"; +$headers["A"]="string"; +$headers["S"]='int'; +if (plc_is_admin()) $headers["I"]="int"; +$headers["?"]="string"; # initial sort on hostnames -$table=new PlcTable ("nodes",$headers,4); +$table=new PlekitTable ("nodes",$headers,4); $table->start(); $peers = new Peers ($api); // write rows foreach ($nodes as $node) { - $hostname=$node['hostname']; - $node_id=$node['node_id']; - $site_id=$node['site_id']; - $site=$site_hash[$site_id]; - $login_base = $site['login_base']; - $node_id=$node['node_id']; - $ip=$interface_hash[$node['node_id']]['ip']; - $interface_id=$interface_hash[$node['node_id']]['interface_id']; - $peer_id=$node['peer_id']; - $shortname = $peers->shortname($peer_id); - $node_type = $node['node_type']; - - $table->row_start(); - $table->cell ($peers->link($peer_id,$shortname)); - $table->cell (topdomain($hostname)); - $table->cell (l_site_t($site_id,$login_base)); - $table->cell ($node['boot_state']); - $table->cell (l_node_t($node_id,$hostname)); - $table->cell (l_interface_t($interface_id,$ip)); - $table->cell ($node_type); - $table->cell ($node['arch']); - $table->cell (node_status($node)); - $table->row_end(); - + $hostname=$node['hostname']; + $node_id=$node['node_id']; + $site_id=$node['site_id']; + $site=$site_hash[$site_id]; + $login_base = $site['login_base']; + $ip=$interface_hash[$node['node_id']]['ip']; + $interface_id=$interface_hash[$node['node_id']]['interface_id']; + $peer_id=$node['peer_id']; + $node_type = $node['node_type']; + + $table->row_start(); + $peers->cell ($table,$peer_id); + $table->cell (topdomain($hostname)); + $table->cell (l_site_t($site_id,$login_base)); + $table->cell ($node['boot_state']); + $table->cell (l_node_t($node_id,$hostname)); + $table->cell ($node_type); + $table->cell (l_interface_t($interface_id,$ip),array('only-if'=> !$peer_id)); + $table->cell ($node['arch'],array('only-if'=> !$peer_id)); + $table->cell (count($node['slice_ids'])); + if (plc_is_admin()) $table->cell(l_node_t($node_id,$node_id)); + $table->cell (node_status($node)); + $table->row_end(); + } -$table->end(); +$notes=array(); +$notes []= "R = region"; +$notes []= "A = arch"; +$notes []= "S = number of slivers"; +if (plc_is_admin()) $notes []= "I = node_id"; +$table->end(array('notes'=>$notes)); +$nifty->end(); + +//plekit_linetabs ($tabs,"bottom"); // Print footer include 'plc_footer.php';