checkpoint
[plewww.git] / planetlab / nodes / nodes.php
index b1daeff..43b994f 100644 (file)
@@ -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,12 +32,9 @@ $slice_id=intval($_GET['slice_id']);
 // --- decoration
 $title="Nodes";
 $tabs=array();
-$mysite_id=plc_my_site_id();
-$tabs['My nodes'] = array('url'=>l_nodes(),
-                         'values'=>array('site_id'=>plc_my_site_id()),
-                         'bubble'=>'Lists nodes on site ' . $mysite_id);
-$tabs['Local nodes'] = array ('url'=>l_nodes_peer('local'),
-                             'bubble' => 'Nodes local to this peer');
+$tabs []= tab_nodes_mysite();
+$tabs []= tab_nodes_local();
+
 // -------------------- 
 $node_filter=array();
 
@@ -56,7 +56,7 @@ function node_status ($node) {
 
 
 // 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;
@@ -71,12 +71,12 @@ $node_filter=array_merge($node_filter,$peerscope->filter());
 $title .= ' - ' . $peerscope->label();
 
 if ($site_id) {
-  $sites=$api->GetSites(array($site_id),array("name","login_base"));
+  $sites=$api->GetSites(array($site_id));
   $site=$sites[0];
   $name=$site['name'];
   $login_base=$site['login_base'];
   $title .= t_site($site);
-  $tabs = array_merge($tabs,tabs_site($site));
+  $tabs []= tab_site($site);
   $node_filter['site_id']=array($site_id);
 }
 
@@ -84,7 +84,7 @@ if ($slice_id) {
   $slices=$api->GetSlices(array($slice_id),array('node_ids','name'));
   $slice=$slices[0];
   $title .= t_slice($slice);
-  $tabs = array_merge($tabs,tabs_slice($slice));
+  $tabs []= tab_slice($slice);
   $node_filter['node_id'] = $slice['node_ids'];
  }
 
@@ -118,14 +118,16 @@ 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",
+$nifty=new PlekitNifty ('','objects-list','big');
+$nifty->start();
+$headers = array ("P"=>"string",
                  "Region"=>"string",
                  "Site"=>"string",
                  "State"=>"string",
@@ -133,43 +135,48 @@ $headers = array ("Peer"=>"string",
                  "IP"=>"IPAddress",
                  "Type"=>"string",
                  "Arch"=>"string",
+                 "S"=>'int',
                  "?"=>"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'];
+  $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'];
+  $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 (l_interface_t($interface_id,$ip));
+  $table->cell ($node_type);
+  $table->cell ($node['arch']);
+  $table->cell (count($node['slice_ids']));
+  $table->cell (node_status($node));
+  $table->row_end();
+  
 }
 
-$table->end();
+$notes=array("S = number of slivers");
+$table->end(array('notes'=>$notes));
+$nifty->end();
+
+//plekit_linetabs ($tabs,"bottom");
 
 // Print footer
 include 'plc_footer.php';