X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fnodes%2Fnodes.php;h=5d9b61e3e04800643f524a0c5c241fb92e6bbfa5;hb=d694eb9fdfe0a7bcb9d8fc7b571751475f4227be;hp=7ef48cab2263c420512520ce9e6837cdaf71e407;hpb=a3aba05dfc606b0b48ac7f91bc822319c30c406c;p=plewww.git diff --git a/planetlab/nodes/nodes.php b/planetlab/nodes/nodes.php index 7ef48ca..5d9b61e 100644 --- a/planetlab/nodes/nodes.php +++ b/planetlab/nodes/nodes.php @@ -17,12 +17,21 @@ include 'plc_header.php'; require_once 'plc_functions.php'; require_once 'plc_objects.php'; require_once 'plc_peers.php'; -require_once 'plc_visibletags.php'; +require_once 'plc_visibletags2.php'; require_once 'linetabs.php'; -require_once 'table.php'; +require_once 'table2.php'; require_once 'nifty.php'; +require_once 'toggle.php'; +require_once 'columns.php'; + +// keep css separate for now +drupal_set_html_head(' + +'); + ini_set("memory_limit","64M"); +//error_reporting(0); // -------------------- // recognized URL arguments @@ -63,13 +72,144 @@ function node_status ($node) { return plc_vertical_table($messages,'plc-warning'); } + +$first_time_configuration = false; + +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 = ""; +$show_columns_message = '1'; + + +$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 == "") +{ + $first_time_configuration = true; + $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; @@ -119,8 +259,23 @@ 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_conf = explode(";",$show_configuration); +foreach ($show_conf as $ss) { + if ($ss =="columns") + $show_columns_message = '0'; +} + + + // build site_ids - interface_ids $site_ids=array(); $interface_ids=array(); @@ -159,7 +314,10 @@ $nifty=new PlekitNifty ('','objects-list','big'); $nifty->start(); $headers = array (); $offset=0; $notes=array(); +$notes [] = "For information about the different columns please see the node table layout tab above or mouse over the column headers"; + +/* // fixed columns if (plc_is_admin()) { $short="I"; $long="node_id"; $type='int'; @@ -183,15 +341,67 @@ $headers=array_merge($headers,$visibletags->headers()); $notes=array_merge($notes,$visibletags->notes()); $short="?"; $long="extra status info"; $type='string'; $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long"; +*/ + +$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); + +if ($first_time_configuration) +$column_conf_visible = '1'; +else +$column_conf_visible = '0'; + +$toggle_nodes=new PlekitToggle('nodes-column-configuration', + "Node table layout", + array('visible'=>$column_conf_visible, 'info_div'=>'note_columns_div')); +$toggle_nodes->start(); +print("
"); +print(""); +print(""); +print(""); +print(""); +print(""); +print(""); +print("
"); +print(""); + +if ($show_columns_message == '0') +$note_display = "display:none;"; +else +$note_display = ""; + + +print << +
+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. +hide message permanently +
+ +EOF; + +$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,3+$offset); +$table=new PlekitTable ("nodes",$headers,3+$offset, $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']; @@ -202,27 +412,38 @@ foreach ($nodes as $node) { $peer_id=$node['peer_id']; $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 (l_node_t($node_id,$hostname)); - $table->cell (l_interface_t($interface_id,$ip),array('only-if'=> !$peer_id)); + $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 (count($node['slice_ids'])); - foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]); + $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(); } -$table->end(array('notes'=>$notes)); +$table->end(); $nifty->end(); + //plekit_linetabs ($tabs,"bottom"); // Print footer include 'plc_footer.php'; ?> +