X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fnodes%2Fnodes.php;h=8a858b77e9805c0425d4e6954e38d3d92e7e0a6c;hb=2acd8f63883ad55c2c3c204d3b11db86da3417d2;hp=fd96f519b1b3b6d38665eeaf2101e2afd4629426;hpb=784cfe2a92ff21e58b773b6895e6ea4b82a0c646;p=plewww.git diff --git a/planetlab/nodes/nodes.php b/planetlab/nodes/nodes.php index fd96f51..8a858b7 100644 --- a/planetlab/nodes/nodes.php +++ b/planetlab/nodes/nodes.php @@ -1,7 +1,5 @@ +'); + -ini_set("memory_limit","48M"); +//error_reporting(0); // -------------------- // recognized URL arguments @@ -48,20 +56,162 @@ $node_filter=array(); // performs sanity check and summarize the result in a single column function node_status ($node) { - // do all this stuff on local nodes only - if ( $node['peer_id'] ) - return "n/a"; - $messages=array(); - // check that the node has interfaces - if (count($node['interface_ids']) == 0) { - $messages [] = "No interface"; + if ($node['node_type'] != 'regular' && $node['node_type'] != 'reservable' ) + $messages []= $node['node_type']; + + // checks on local nodes only + if ( ( ! $node['peer_id']) ) { + // has it got interfaces + if (count($node['interface_ids']) == 0) + $messages []= "No interface"; } return plc_vertical_table($messages,'plc-warning'); } + +if (plc_is_admin()) + $default_configuration = "ID:f|hostname:f|ST:f|AU:f|RES:f"; +else + $default_configuration = "hostname:f|ST:f|AU:f|RES:f"; + +//$extra_default = "LCN|DN|R|L|OS|MS|SN"; +$column_configuration = ""; +$slice_column_configuration = ""; +$show_configuration = ""; + + +$PersonTags=$api->GetPersonTags (array('person_id'=>$plc->person['person_id'])); +//print_r($PersonTags); +foreach ($PersonTags as $ptag) { + if ($ptag['tagname'] == 'columnconf') + { + $column_configuration = $ptag['value']; + $conf_tag_id = $ptag['person_tag_id']; + } + if ($ptag['tagname'] == 'showconf') + { + $show_configuration = $ptag['value']; + $show_tag_id = $ptag['person_tag_id']; + } +} + +//print("column configuration = ".$column_configuration); + +$nodesconf_exists = false; +if ($column_configuration == "") +{ + $column_configuration = "nodes;default"; + $nodesconf_exists = true; +} +else { + $slice_conf = explode(";",$column_configuration); + for ($i=0; $iOLD"); +//print_r($visiblecolumns); +//$node_columns=array_merge($node_fixed_columns,$visiblecolumns); + + // server-side filtering - set pattern in $_GET for filtering on hostname if ($pattern) { $node_filter['hostname']=$pattern; @@ -111,8 +261,24 @@ if ($person_id) { } // go +//print("getting nodes ".$node_columns); +//print_r($node_columns); $nodes=$api->GetNodes($node_filter,$node_columns); +//print("

GOT NODES

"); +//print_r($nodes); + +$ConfigureColumns->fetch_live_data($nodes); + +$show_columns_message = TRUE; +$show_conf = explode(";",$show_configuration); +foreach ($show_conf as $ss) { + if ($ss =="columns") + $show_columns_message = FALSE; +} + + + // build site_ids - interface_ids $site_ids=array(); $interface_ids=array(); @@ -149,26 +315,63 @@ if ( ! $nodes ) { $nifty=new PlekitNifty ('','objects-list','big'); $nifty->start(); -$headers = array (); $offset=0; -if (plc_is_admin()) { $headers["I"]="int"; $offset=1; } -$headers["P"]="string"; -$headers["R"]="string"; -$headers["Site"]="string"; -$headers["State"]="string"; -$headers["Hostname"]="string"; -$headers["Type"]="string"; -$headers["IP"]="sortIPAddress"; -$headers["A"]="string"; -$headers["S"]='int'; -$headers["?"]="string"; +$headers = array (); +$notes=array(); +$notes [] = "For information about the different columns please see the node table layout tab above or mouse over the column headers"; + +$info_header = array(); +$short="?"; $long="extra status info"; $type='string'; +$info_header[$short]=array('type'=>$type,'title'=>$long, 'label'=>'?', 'header'=>'?', 'visible'=>true); +//$notes []= "$short = $long"; +//$info_header["?"] = "none"; +$headers = array_merge($ConfigureColumns->get_headers(),$info_header); + +$layout_help=' +This tab allows you to customize the columns in the node tables, +below. Information on the nodes comes from a variety of monitoring +sources. If you, as either a user or a provider of monitoring data, +would like to see additional columns made available, please send us +your request in mail to support@myslice.info. You can +find more information about the MySlice project at http://trac.myslice.info. +'; +$toggle_nodes=new PlekitToggle('nodes-layout', + "Node table layout", + array('visible'=>NULL, + 'info-text'=>$layout_help, + 'info-visible'=>$show_columns_message)); +$toggle_nodes->start(); +print("
"); +print(""); +print(""); +print(""); +print(""); +print(""); +print(""); +print("
"); +print(""); + +////////// end + +$ConfigureColumns->configuration_panel_html(true); +$ConfigureColumns->javascript_init(); +$toggle_nodes->end(); + +$table_options = array('notes'=>$notes, + 'search_width'=>15, + 'pagesize'=>20, + 'configurable'=>true); # initial sort on hostnames -$table=new PlekitTable ("nodes",$headers,4+$offset); +$table=new PlekitTable ("nodes",$headers,2, $table_options); $table->start(); $peers = new Peers ($api); // write rows foreach ($nodes as $node) { + //$node_obj = new Node ($node); + $hostname=$node['hostname']; $node_id=$node['node_id']; $site_id=$node['site_id']; @@ -177,36 +380,40 @@ foreach ($nodes as $node) { $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(); + $table->cell($node['node_id'], array('display'=>'none')); if (plc_is_admin()) $table->cell(l_node_t($node_id,$node_id)); - $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'])); + $peers->cell ($table,$peer_id); + + //prefetch some columns + $node['domain'] = topdomain($hostname); + $node['sitename'] = l_site_t($site_id,$login_base); + if ($interface_id) + $node['ipaddress'] = l_interface_t($interface_id,$ip); + else + $node['ipaddress'] = "n/a"; + + list($label,$class) = Node::status_label_class_($node); + $table->cell ($label,array('class'=>$class)); + $table->cell( ($node['node_type']=='reservable')?reservable_mark():"" ); + //$table->cell (count($node['slice_ids'])); + //foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]); + $ConfigureColumns->cells($table, $node); $table->cell (node_status($node)); $table->row_end(); } -$notes=array(); -if (plc_is_admin()) $notes []= "I = node_id"; -$notes []= "R = region"; -$notes []= "A = arch"; -$notes []= "S = number of slivers"; -$notes []= "? = status"; -$table->end(array('notes'=>$notes)); +$table->end(); $nifty->end(); + //plekit_linetabs ($tabs,"bottom"); // Print footer include 'plc_footer.php'; ?> +