From 0f0545cc1217bc84a7540c642cd631683bd13689 Mon Sep 17 00:00:00 2001 From: Panos Date: Wed, 13 Oct 2010 18:31:40 +0200 Subject: [PATCH] The first "production" version of the column selection interface --- planetlab/css/my_slice.css | 16 +- planetlab/includes/plc_visibletags2.php | 11 +- planetlab/slices/slice2.php | 690 +++++++------- plekit/icons/ajax-loader.gif | Bin 0 -> 2608 bytes plekit/php/columns.php | 199 ++-- plekit/php/logSorting.php | 25 + plekit/php/table2.php | 92 +- ...updateConf.php => updateConfiguration.php} | 8 +- plekit/table/columns.js | 877 ++++++++++++------ 9 files changed, 1182 insertions(+), 736 deletions(-) create mode 100644 plekit/icons/ajax-loader.gif create mode 100644 plekit/php/logSorting.php rename plekit/php/{updateConf.php => updateConfiguration.php} (69%) diff --git a/planetlab/css/my_slice.css b/planetlab/css/my_slice.css index d33730f..0a20eb2 100644 --- a/planetlab/css/my_slice.css +++ b/planetlab/css/my_slice.css @@ -40,14 +40,17 @@ table#leases_data { #leases_buttons { padding: 0px 10px 10px 10px; } #leases_clear { position: relative; left: 30%;} #leases_submit { position: relative; left: 60%; } - + -/*panos: some additional styles for the column configuration */ +/* column configuation style */ div#toggle-container-my-slice-nodes-configuration { background: #f8f8f8; } +OPTION.out{background-color:white; color:black} +OPTION.in{background-color:#CAE8EA; color:#4f6b72} + div.out{background-color:white; color:black} div.in{background-color:#CAE8EA; color:#4f6b72} div.selected{background-color:gray; color:black} @@ -59,16 +62,17 @@ div.invisible{display:none} } .myslice .title { - font: 11px; - font-weight: bold; + font: 11px; + font-weight: bold; } .myslice .desc { - font: 11px; - font-style: italic; + font: 11px; + font-style: italic; } .myslice .subtitle{ color: #bb9c61; } + diff --git a/planetlab/includes/plc_visibletags2.php b/planetlab/includes/plc_visibletags2.php index 10341c3..319ac7f 100644 --- a/planetlab/includes/plc_visibletags2.php +++ b/planetlab/includes/plc_visibletags2.php @@ -49,7 +49,8 @@ class VisibleTags { # cache for next time $this->columns=$columns; -// plc_debug('columns',$columns); + + //plc_debug('columns',$columns); return $columns; } @@ -63,8 +64,14 @@ class VisibleTags { $headers=array(); $columns=$this->columns(); foreach ($columns as $column) + { //panos: needed a few more fields in the header array - $headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['description']); + $headerId = $column['header']; + if ($column['headerId'] != "") + $headerId = $column['headerId']; + + $headers[$headerId]=array('header'=>$column['header'],'headerId'=>$headerId, 'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['description']); + } /* if ($column['header'] == $column['tagname']) $headers[$column['header']]=$column['type']; diff --git a/planetlab/slices/slice2.php b/planetlab/slices/slice2.php index 385c8b5..a793905 100644 --- a/planetlab/slices/slice2.php +++ b/planetlab/slices/slice2.php @@ -23,24 +23,33 @@ require_once 'table2.php'; require_once 'details.php'; require_once 'toggle.php'; require_once 'form.php'; +require_once 'raphael.php'; require_once 'columns.php'; // keep css separate for now drupal_set_html_head(' + '); // -------------------- admins potentially need to get full list of users ini_set('memory_limit','32M'); +$profiling=false; +if ($_GET['profiling']) $profiling=true; + +if ($profiling) plc_debug_prof_start(); + // -------------------- // recognized URL arguments $slice_id=intval($_GET['id']); if ( ! $slice_id ) { plc_error('Malformed URL - id not set'); return; } //////////////////// -// Get all columns as we focus on only one entry -$slices= $api->GetSlices( array($slice_id)); +// have to name columns b/c we need the non-native 'omf_control' column +$slice_columns=array('slice_id','name','peer_id','site_id','person_ids','node_ids','expires', + 'url','description','instantiation','omf_control'); +$slices= $api->GetSlices( array($slice_id), $slice_columns); if (empty($slices)) { drupal_set_message ("Slice " . $slice_id . " not found"); @@ -49,6 +58,7 @@ if (empty($slices)) { $slice=$slices[0]; +if ($profiling) plc_debug_prof('2: slice',count($slices)); // pull all node info to vars $name= $slice['name']; $expires = date( "d/m/Y", $slice['expires'] ); @@ -61,12 +71,15 @@ $peer_id= $slice['peer_id']; $peers=new Peers ($api); $local_peer = ! $peer_id; +if ($profiling) plc_debug_prof('3: peers',count($peers)); + // gets site info $sites= $api->GetSites( array( $site_id ) ); $site=$sites[0]; $site_name= $site['name']; $max_slices = $site['max_slices']; +if ($profiling) plc_debug_prof('4: sites',count($sites)); //////////////////////////////////////// building blocks for the renew area // Constants global $DAY; $DAY = 24*60*60; @@ -146,10 +159,15 @@ EOF; } else { print <<< EOF
-

You must provide a short description as well as a link to a project website before renewing it. -Do not provide bogus information; if a complaint is lodged against your slice -and PlanetLab Operations is unable to determine what the normal behavior of your slice is, -your slice may be deleted to resolve the complaint.

+

You must provide a short description, +as well as a link to a project website, before renewing it. + +
Please make sure to provide reasonable details on +the kind of traffic, and copyrights if relevant. +Do not provide bogus information; if a complaint is lodged against +your slice and your PlanetLab Operations Center is unable to determine what the normal behavior +of your slice is, your slice may be deleted to resolve the complaint.

+

NOTE: Slices cannot be renewed beyond another $max_renewal_weeks week(s) ($max_renewal_date).

@@ -185,7 +203,7 @@ $tags_privileges = $privileges || plc_is_admin(); $tabs=array(); $tabs [] = tab_nodes_slice($slice_id); -$tabs [] = tab_site($site_id); +$tabs [] = tab_site($site); // are these the right privileges for deletion ? if ($privileges) { @@ -252,6 +270,7 @@ $details->th_td('URL',$slice['url'],'url',array('width'=>50)); $details->tr_submit("submit","Update Slice"); $details->th_td('Expires',$expires); $details->th_td('Instantiation',$slice['instantiation']); +$details->th_td("OMF-friendly", ($slice['omf_control'] ? 'Yes' : 'No') . " [to change: see 'omf_control' in the tags section below]"); $details->th_td('Site',l_site_obj($site)); // xxx show the PIs here //$details->th_td('PIs',...); @@ -275,8 +294,9 @@ $potential_persons= $person_columns); $count=count($persons); +if ($profiling) plc_debug_prof('4: persons',count($persons)); $toggle= - new PlekitToggle ('my-slice-persons',"$count users", + new PlekitToggle ('my-slice-persons',"$count Users", array('bubble'=> 'Manage accounts attached to this slice', 'visible'=>get_arg('show_persons',false))); @@ -298,7 +318,7 @@ $headers['first']='string'; $headers['last']='string'; $headers['R']='string'; if ($privileges) $headers[plc_delete_icon()]="none"; -$table=new PlekitTable2('persons',$headers,'0', NULL, +$table=new PlekitTable('persons',$headers,'0', array('notes_area'=>false)); $form=new PlekitForm(l_actions(),array('slice_id'=>$slice['slice_id'])); $form->start(); @@ -349,7 +369,7 @@ if ($privileges) { // show search for admins only as other people won't get that many names to add if ( ! plc_is_admin() ) $options['search_area']=false; - $table=new PlekitTable2('add_persons',$headers,'0',NULL,$options); + $table=new PlekitTable('add_persons',$headers,'0',$options); $form=new PlekitForm(l_actions(),array('slice_id'=>$slice['slice_id'])); $form->start(); $table->start(); @@ -386,15 +406,20 @@ $toggle->end(); // (.) type is passed to the javascript table, for sorting (default is 'string') // minimal list as a start -//$node_fixed_columns = array('hostname','node_id','slice_ids_whitelist','boot_state','last_contact'); +$node_fixed_columns = array('hostname','node_id','peer_id','slice_ids_whitelist', + 'run_level','boot_state','last_contact','node_type'); // create a VisibleTags object : basically the list of tag columns to show -//$visibletags = new VisibleTags ($api, 'node'); -//$visiblecolumns = $visibletags->column_names(); -//$node_columns=array_merge($node_fixed_columns,$visiblecolumns); +$visibletags = new VisibleTags ($api, 'node'); +$visiblecolumns = $visibletags->column_names(); +$node_columns=array_merge($node_fixed_columns,$visiblecolumns); +// optimizing calls to GetNodes +//$all_nodes=$api->GetNodes(NULL,$node_columns); +//$slice_nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),$node_columns); +//$potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),$node_columns); -/* TEST PlekitColumns */ +//NEW CODE FOR ENABLING COLUMN CONFIGURATION //prepare fix and configurable columns @@ -402,133 +427,321 @@ $fix_columns = array(); $fix_columns[]=array('tagname'=>'hostname', 'header'=>'hostname', 'type'=>'string', 'title'=>'The name of the node'); $fix_columns[]=array('tagname'=>'peer_id', 'header'=>'AU', 'type'=>'string', 'title'=>'Authority'); $fix_columns[]=array('tagname'=>'run_level', 'header'=>'ST', 'type'=>'string', 'title'=>'Status'); +$fix_columns[]=array('tagname'=>'node_type', 'header'=>'RES', 'type'=>'string', 'title'=>'Reservable'); +// columns that correspond to the visible tags for nodes (*node/ui*) $visibletags = new VisibleTags ($api, 'node'); $visibletags->columns(); $tag_columns = $visibletags->headers(); -$extra_columns = array(); -$extra_columns[]=array('tagname'=>'site_id', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'description'=>'Site name'); +// extra columns that are not tags (for the moment not sorted correctly) -//$configurable_columns = array_merge($tag_columns, $extra_columns); -//usort ($configurable_columns, create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);')); +$extra_columns = array(); +//$extra_columns[]=array('tagname'=>'site_id', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'description'=>'Site name'); +//get user's column configuration $first_time_configuration = 'false'; -$default_configuration = "hostname:f|ST:f|AU:f|Rw|AST"; +$default_configuration = "hostname:f|ST:f|AU:f|RES:f"; $column_configuration = ""; - -$DescTags=$api->GetSliceTags (array('slice_id'=>$slice['slice_id'])); -for ($i=0; $iGetPersonTags (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("
person column configuration = ".$column_configuration); + +$sliceconf_exists = false; if ($column_configuration == "") { - $first_time_configuration = 'true'; - $column_configuration = $default_configuration; + $column_configuration = $slice_id.";"; + $sliceconf_exists = true; +} +else { + $slice_conf = explode(";",$column_configuration); + for ($i=0; $iGOT CONFIGURATION: ".$column_configuration); +if ($sliceconf_exists == false) + $column_configuration = $column_configuration.";".$slice_id.";"; + +//print("
slice configuration = ".$slice_column_configuration); -//$test_configuration = "hostname:f|AU:f|ST:f|Rw|AST"; -//print("

Parsing configuration ".$test_configuration); +//instantiate the column configuration class, which prepares the headers array +if ($slice_column_configuration == "") + $full_configuration = $default_configuration; +else + $full_configuration = $default_configuration."|".$slice_column_configuration; -$ConfigureColumns =new PlekitColumns($column_configuration, $fix_columns, $tag_columns, $extra_columns); +$ConfigureColumns =new PlekitColumns($full_configuration, $fix_columns, $tag_columns, $extra_columns); -$node_requested_data = $ConfigureColumns->node_tags(); -$nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),$node_requested_data); -$potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),$node_requested_data); +$node_columns = $ConfigureColumns->node_tags(); +//print_r($node_columns); +$all_nodes=$api->GetNodes(NULL,$node_columns); -//$nodes = array(); -//$potential_nodes = array(); +//print("
person show configuration = ".$show_configuration); -//print("

RESULTS for ".print_r(array('~node_id'=>$slice['node_ids']))); -//print_r($nodes); +$show_conf = explode(";",$show_configuration); +for ($i=0; $islice show configuration = ".$slice_show_configuration); -$toggle=new PlekitToggle ('my-slice-nodes',"$count nodes", +$slice_nodes=array(); +$potential_nodes=array(); +$reservable_nodes=array(); +foreach ($all_nodes as $node) { + if (in_array($node['node_id'],$slice['node_ids'])) { + $slice_nodes[]=$node; + if ($node['node_type']=='reservable') $reservable_nodes[]=$node; + } else { + $potential_nodes[]=$node; + } +} +if ($profiling) plc_debug_prof('5: nodes',count($slice_nodes)); +//////////////////// +// outline the number of reservable nodes +$nodes_message=count_english($slice_nodes,"node"); +if (count($reservable_nodes)) $nodes_message .= " (" . count($reservable_nodes) . " reservable)"; +$toggle=new PlekitToggle ('my-slice-nodes',$nodes_message, array('bubble'=> 'Manage nodes attached to this slice', 'visible'=>get_arg('show_nodes',false))); $toggle->start(); +////////// show a notice to people having attached a reservable node +if (count($reservable_nodes) && $privileges) { + $mark=reservable_mark(); + print << +
+You have attached one or more reservable nodes to your slice. +Reservable nodes show up with the '$mark' mark. +Your slivers will be available only during timeslots +where you have obtained leases. +You can manage your leases in the tab below. +
+Please note that as of August 2010 this feature is experimental. +Feedback is appreciated at devel@planet-lab.org +
hide message +
+

+EOF; +} + +//////////////////// reservable nodes area +$count=count($reservable_nodes); +if ($count && $privileges) { + // having reservable nodes in white lists looks a bit off scope for now... + $toggle_nodes=new PlekitToggle('my-slice-nodes-reserve', + "Leases - " . count($reservable_nodes) . " reservable node(s)", + array('visible'=>get_arg('show_nodes_resa',false))); + $toggle_nodes->start(); + $grain=$api->GetLeaseGranularity(); + if ($profiling) plc_debug_prof('6 granul',$grain); + // where to start from, expressed as an offset in hours from now + $resa_offset=$_GET['resa_offset']; + if ( ! $resa_offset ) $resa_offset=0; + $rough_start=time()+$resa_offset*3600; + // xxx should be configurable + $resa_slots=$_GET['resa_slots']; + if ( ! $resa_slots ) $resa_slots = 36; + // for now, show the next 72 hours, or 72 grains, which ever is smaller + $duration=$resa_slots*$grain; + $steps=$duration/$grain; + $start=intval($rough_start/$grain)*$grain; + $end=$rough_start+$duration; + $lease_columns=array('lease_id','name','t_from','t_until','hostname','name'); + $leases=$api->GetLeases(array(']t_until'=>$rough_start,'[t_from'=>$end,'-SORT'=>'t_from'),$lease_columns); + if ($profiling) plc_debug_prof('7 leases',count($leases)); + // hash nodes -> leases + $host_hash=array(); + foreach ($leases as $lease) { + $hostname=$lease['hostname']; + if ( ! $host_hash[$hostname] ) { + $host_hash[$hostname]=array(); + } + // resync within the table + $lease['nfrom']=($lease['t_from']-$start)/$grain; + $lease['nuntil']=($lease['t_until']-$start)/$grain; + $host_hash[$hostname] []= $lease; + } + # leases_data is the name used by leases.js to locate this table + echo ""; + # pass (slice_id,slicename) as the [0,0] coordinate as thead>tr>td + echo ""; + # the timeslot headers read (timestamp,label) + $day_names=array('Su','M','Tu','W','Th','F','Sa'); + for ($i=0; $i<$steps; $i++) { + $timestamp=($start+$i*$grain); + $day=$day_names[intval(strftime("%w",$timestamp))]; + $label=$day . strftime(" %H:%M",$timestamp); + // expose in each header cell the full timestamp, and how to display it - use & as a separator*/ + echo ""; + } + echo ""; + // todo - sort on hostnames + function sort_hostname ($a,$b) { return ($a['hostname']<$b['hostname'])?-1:1;} + usort($reservable_nodes,sort_hostname); + foreach ($reservable_nodes as $node) { + echo ""; + $hostname=$node['hostname']; + $leases=$host_hash[$hostname]; + $counter=0; + while ($counter<$steps) { + if ($leases && ($leases[0]['nfrom']<=$counter)) { + $lease=array_shift($leases); + /* nicer display, merge two consecutive leases for the same slice + avoid doing that for now, as it might makes things confusing */ + /* while ($leases && ($leases[0]['name']==$lease['name']) && ($leases[0]['nfrom']==$lease['nuntil'])) { + $lease['nuntil']=$leases[0]['nuntil']; + array_shift($leases); + }*/ + $duration=$lease['nuntil']-$counter; + echo ""; + $counter=$lease['nuntil']; + } else { + echo ""; + $counter+=1; + } + } + echo ""; + } + echo "
" . $slice['slice_id'] . '&' . $slice['name'] . "" . implode("&",array($timestamp,$label)) . "
". $node['hostname'] . "" . $lease['lease_id'] . '&' . $lease['name'] . "
\n"; -$toggle_nodes=new PlekitToggle('my-slice-nodes-configuration', - "Node table column configuration", - array('visible'=>'1')); + // the general layout for the scheduler + echo <<< EOF +
-$toggle_nodes->start(); +
+ + +
+EOF; + $toggle_nodes->end(); + } -//usort ($table_headers, create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);')); -//print("

HEADERS TO SHOW

"); -//print_r($headersToShow); +//////////////////// node configuration panel +$toggle_nodes=new PlekitToggle('my-slice-nodes-configuration', + "Node table layout", + array('visible'=>'1')); +$toggle_nodes->start(); + +//usort ($table_headers, create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);')); //print("

TABLE HEADERS

"); //print_r($table_headers); print("

"); print(""); -print(""); -print(""); +print(""); +print(""); +print(""); +print(""); +print("
"); +print(""); print(""); -//print(""); - -$ConfigureColumns->javascript_vars(); $ConfigureColumns->configuration_panel_html(true); -print("
"); +$ConfigureColumns->javascript_init(); $toggle_nodes->end(); -////////// nodes currently in - -$count=count($nodes); +//////////////////// nodes currently in $toggle_nodes=new PlekitToggle('my-slice-nodes-current', - "$count nodes currently in $name", + count_english($slice_nodes,"node") . " currently in $name", array('visible'=>get_arg('show_nodes_current',!$privileges))); - $toggle_nodes->start(); +$headers=array(); +$notes=array(); +//$notes=array_merge($notes,$visibletags->notes()); +$notes [] = "For information about the different columns please see the node table layout tab above"; + +/* +$headers['peer']='string'; +$headers['hostname']='string'; +$short="-S-"; $long=Node::status_footnote(); $type='string'; + $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long"; +$short=reservable_mark(); $long=reservable_legend(); $type='string'; + $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long"; +// the extra tags, configured for the UI +$headers=array_merge($headers,$visibletags->headers()); + +if ($privileges) $headers[plc_delete_icon()]="none"; +*/ + $edit_header = array(); if ($privileges) $edit_header[plc_delete_icon()]="none"; +$headers = array_merge($ConfigureColumns->get_headers(),$edit_header); -$table_options = array('search_width'=>15, - 'pagesize'=>20); -//$table=new PlekitTable2('nodes',$headers,'1',$table_options); -//$table=new PlekitTable2('nodes_pairwise',array_merge($ConfigureColumns->plekit_columns_get_headers(),$edit_header),NULL,$headersToShow, $table_option); -//$headersToShow = $ConfigureColumns->plekit_columns_visible(); +//print("

HEADERS

"); +//print_r($headers); -$table=new PlekitTable2('nodes',array_merge($ConfigureColumns->get_headers(),$edit_header),NULL,NULL, $table_option); +$table_options = array('notes'=>$notes, + 'search_width'=>15, + 'pagesize'=>20, + 'configurable'=>true); + +$table=new PlekitTable('nodes',$headers,NULL,$table_options); $form=new PlekitForm(l_actions(),array('slice_id'=>$slice['slice_id'])); $form->start(); $table->start(); -if ($nodes) foreach ($nodes as $node) { +if ($slice_nodes) foreach ($slice_nodes as $node) { $table->row_start(); - $table->cell($node['node_id'], array('display'=>'none')); - $table->cell(l_node_obj($node)); +$table->cell($node['node_id'], array('display'=>'none')); + $table->cell(l_node_obj($node)); $peers->cell($table,$node['peer_id']); $run_level=$node['run_level']; list($label,$class) = Node::status_label_class_($node); - $table->cell ($label,array('name'=>'ST', 'class'=>$class, 'display'=>'table-cell')); - - -$ConfigureColumns->cells($table, $node); - + $table->cell ($label,array('class'=>$class)); + $table->cell( ($node['node_type']=='reservable')?reservable_mark():"" ); + //foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]); + $ConfigureColumns->cells($table, $node); if ($privileges) $table->cell ($form->checkbox_html('node_ids[]',$node['node_id'])); $table->row_end(); @@ -547,7 +760,7 @@ if ($privileges) { $table->end(); $toggle_nodes->end(); -////////// nodes to add +//////////////////// nodes to add if ($privileges) { $new_potential_nodes = array(); if ($potential_nodes) foreach ($potential_nodes as $node) { @@ -560,37 +773,52 @@ if ($privileges) { $count=count($potential_nodes); $toggle_nodes=new PlekitToggle('my-slice-nodes-add', - "$count more nodes available", + count_english($potential_nodes,"more node") . " available", array('visible'=>get_arg('show_nodes_add',false))); $toggle_nodes->start(); - if ( ! $potential_nodes ) { - // xxx improve style - echo "

No node to add

"; - } else { + if ( $potential_nodes ) { + $headers=array(); + $notes=array(); + - $edit_header = array(); - if ($privileges) $edit_header['+']="none"; +/* + $headers['peer']='string'; + $headers['hostname']='string'; + $short="-S-"; $long=Node::status_footnote(); $type='string'; + $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long"; + $short=reservable_mark(); $long=reservable_legend(); $type='string'; + $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long"; + // the extra tags, configured for the UI + $headers=array_merge($headers,$visibletags->headers()); + $headers['+']="none"; +*/ + + $add_header = array(); + $add_header['+']="none"; + $headers = array_merge($ConfigureColumns->get_headers(),$add_header); + + //$notes=array_merge($notes,$visibletags->notes()); + $notes [] = "For information about the different columns please see the node table layout tab above"; - //$table=new PlekitTable2('add_nodes',$headers,'1', $table_options); - $table=new PlekitTable2('add_nodes',array_merge($ConfigureColumns->get_headers(), $edit_header),NULL,$headersToShow, $table_options); + $table=new PlekitTable('add_nodes',$headers,NULL, $table_options); $form=new PlekitForm(l_actions(), array('slice_id'=>$slice['slice_id'])); $form->start(); $table->start(); - if ($potential_nodes) foreach ($potential_nodes as $node) { $table->row_start(); - $table->cell($node['node_id'], array('display'=>'none')); - $table->cell(l_node_obj($node)); +$table->cell($node['node_id'], array('display'=>'none')); - $peers->cell($table,$node['peer_id']); - $run_level=$node['run_level']; - list($label,$class) = Node::status_label_class_($node); - $table->cell ($label,array('name'=>'ST', 'class'=>$class, 'display'=>'table-cell')); + $table->cell(l_node_obj($node)); + $peers->cell($table,$node['peer_id']); + list($label,$class) = Node::status_label_class_($node); + $table->cell ($label,array('class'=>$class)); + $table->cell( ($node['node_type']=='reservable')?reservable_mark():"" ); -$ConfigureColumns->cells($table, $node); + //foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]); + $ConfigureColumns->cells($table, $node); $table->cell ($form->checkbox_html('node_ids[]',$node['node_id'])); $table->row_end(); @@ -606,11 +834,15 @@ $ConfigureColumns->cells($table, $node); } $toggle_nodes->end(); } + $toggle->end(); +// very wide values get abbreviated +$tag_value_threshold=24; //////////////////////////////////////////////////////////// Tags //if ( $local_peer ) { $tags=$api->GetSliceTags (array('slice_id'=>$slice_id)); + if ($profiling) plc_debug_prof('8 slice tags',count($tags)); function get_tagname ($tag) { return $tag['tagname'];} $tagnames = array_map ("get_tagname",$tags); @@ -627,7 +859,7 @@ $toggle->end(); if ($tags_privileges) $headers[plc_delete_icon()]="none"; $table_options=array("notes_area"=>false,"pagesize_area"=>false,"search_width"=>10); - $table=new PlekitTable2("slice_tags",$headers,'0',NULL,$table_options); + $table=new PlekitTable("slice_tags",$headers,'0',$table_options); $form=new PlekitForm(l_actions(), array('slice_id'=>$slice['slice_id'])); $form->start(); @@ -636,23 +868,26 @@ $toggle->end(); foreach ($tags as $tag) { $node_name = "ALL"; if ($tag['node_id']) { - $nodes = $api->GetNodes(array('node_id'=>$tag['node_id'])); - if($nodes) { - $node = $nodes[0]; + $tag_nodes = $api->GetNodes(array('node_id'=>$tag['node_id'])); + if ($profiling) plc_debug_prof('9 node for slice tag',count($tag_nodes)); + if($tag_nodes) { + $node = $tag_nodes[0]; $node_name = $node['hostname']; } } $nodegroup_name="n/a"; if ($tag['nodegroup_id']) { - $nodegroup=$api->GetNodeGroups(array('nodegroup_id'=>$tag['nodegroup_id'])); + $nodegroups=$api->GetNodeGroups(array('nodegroup_id'=>$tag['nodegroup_id'])); + if ($profiling) plc_debug_prof('10 nodegroup for slice tag',$nodegroup); if ($nodegroup) { - $nodegroup = $nodegroup[0]; + $nodegroup = $nodegroups[0]; $nodegroup_name = $nodegroup['groupname']; } } $table->row_start(); $table->cell(l_tag_obj($tag)); - $table->cell($tag['value']); + // very wide values get abbreviated + $table->cell(truncate_and_popup($tag['value'],$tag_value_threshold)); $table->cell($node_name); $table->cell($nodegroup_name); if ($tags_privileges) $table->cell ($form->checkbox_html('slice_tag_ids[]',$tag['slice_tag_id'])); @@ -671,18 +906,19 @@ $toggle->end(); return array("display"=>$tag['tagname'],"value"=>$tag['tag_type_id']); } $all_tags= $api->GetTagTypes( array ("category"=>"slice*","-SORT"=>"+tagname"), array("tagname","tag_type_id")); + if ($profiling) plc_debug_prof('11 tagtypes',count($all_tags)); $selector_tag=array_map("tag_selector",$all_tags); function node_selector($node) { return array("display"=>$node["hostname"],"value"=>$node['node_id']); } - $all_nodes = $api->GetNodes( array ("node_id" => $slice['node_ids']), array("hostname","node_id")); - $selector_node=array_map("node_selector",$all_nodes); + $selector_node=array_map("node_selector",$slice_nodes); function nodegroup_selector($ng) { return array("display"=>$ng["groupname"],"value"=>$ng['nodegroup_id']); } $all_nodegroups = $api->GetNodeGroups( array("groupname"=>"*"), array("groupname","nodegroup_id")); + if ($profiling) plc_debug_prof('13 nodegroups',count($all_nodegroups)); $selector_nodegroup=array_map("nodegroup_selector",$all_nodegroups); $table->cell($form->select_html("tag_type_id",$selector_tag,array('label'=>"Choose Tag"))); @@ -706,257 +942,9 @@ if ($local_peer ) { $peers->block_end($peer_id); +if ($profiling) plc_debug_prof_end(); + // Print footer include 'plc_footer.php'; ?> - - - diff --git a/plekit/icons/ajax-loader.gif b/plekit/icons/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..c69e937232b24ea30f01c68bbd2ebc798dcecfcb GIT binary patch literal 2608 zcmdVcdr(tX9tZGC9yiG~=H_*Q-0%n(kWqP*D#hw{AQu8;1%gl-Hrf&{2?48KX;hHy z3Ze*zEz4t3XdUFyLbNPUYlA`|B}P=N1fqtL1*}S;87#|-W9v<#G;ul(e%d3)N(^9c$d2Dz{7}?ErjNd;{EMKkCsk21~b9Gvg zDo<7L=3Z5HNbVlZUcm1eg#o#CZCJU`3IYHwM->zCd?uYrF3vKFeM}v?f+%s?E>ly|3W25ry9#NNbTx-}0ON58dTrs^ix{_1O0Wh~SVSBlH)Ajn zPn^Gbjz}PCtN@#keR&hK&Dhl-b$kZ8^S)x#dh0{7X=X%CCJk7P1PSO>T&S8I4{#Lg zb5#)o=;!ZP*1nM{cI4@(x7o27*SA()NHmrn67aN@Pmi~(i_SnrjYnwh36aG%!@i0d zqbvfa44f|?OG4ntP|nbjhEl1)Yp6ZN@yjy zy4==QmLy%t;ps3R?~f2KfTTI|2?q8dFd6^z5GF+Xa&Y)sjG)hxit80pPcOP zJ z*LW{SyGHD%hUotV+W%I}fBLAIx!8|7#}$;clKQ+{&FjDqGQ2ZNx(lYM3*%~}ILnao zM`aui55~ZFJlu^!5rdA9Q_7H68H_;##u{x(Yn-vSfIRCb^Nqsg zGRS!Egm>h+o<}LeV4&CLReo9FrDjDvs}8?JwC)#Qs|ie=r?~xUh)&*d`Fx>FG}%X# zNdtDHBKhLPC0wpooFDAQKL%*6T|ULH$=wX!NhcasgD3d;-d$I6yRK3yN+E~C1335_iLOt+*9uvSZ`>*KA}vm}08wRq=>5l|t*Na&jR z-C1&C`nkEk#sB|@yyt-#fXngP04My zm7u$Q%EJbHp`>~`5W&L{W!6`y&}LMS;jfUpgO~7TLVMRZ9IC)IZp0A${`yp0{&wco z#1nx@XMkhqeK%7?RE7JdLr1^nwFfaJ0Q&Lv?WNJ%9}VSJsNY2+UYs2%EU0J~ayFXv zi*?7KCXQHkD)O6!0Q%4N+HTODHxJ{kQSuQX$l-rSwkwh(zMkdfzxyGwl@yHC)C4p< z&n2%8#M?)Q@mgHL1ot8`SFdSEj9ye|jHy+U8#@HoUExG=@AVkRAe_qYm4EpzK6L*& zh`)26?V#f4#_h^P9G^%>h2-H3)$QP zQovu6J9qDvsxqweDdNNa!Lb?L4_UF{tLX_nN7r0U_vF14YKcGR-*Gl} zx3oG)bzf|65dBxD-;2ZCp??K;+TuQ9onnK?==5hzbkb^r_g>z4#D8mcv8(+XdoszA zCx-qhdgxMNMotj}SiL_6V(tLcsK7(M(r(%u<}QrVfOvyK6_;~NOTlPGfX@M7S5YQF z&*$(ylJMHJt^_aQeu{C6NaTE$G3HNN@_SnN8YcaKn%`)F@~L1x+ah7-gEJPpc6w%3 zyX}r+Qk$4RHZzfH){e~F*qJ{d*L8a6n4;U?+{de0-t)mal#TVxe)3F}^UBh+zd T)6_**#cgp_+?JL9(ew3BlNF>u literal 0 HcmV?d00001 diff --git a/plekit/php/columns.php b/plekit/php/columns.php index 987d9be..d16b128 100644 --- a/plekit/php/columns.php +++ b/plekit/php/columns.php @@ -64,11 +64,19 @@ $this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=> } foreach ($this->tag_columns as $column) { -$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['tagname'], 'description'=>$column['title'], 'label'=>$this->removeDuration($column['header']),'visible'=>false); + +//print("
".$column['header'].":".$column['headerId'].":".$column['tagname']); + +if ($column['headerId'] != "") + $headerId = $column['headerId']; +else + $headerId = $column['header']; + +$this->all_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false); } foreach ($this->extra_columns as $column) { -$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['tagname'], 'description'=>$column['title'], 'label'=>$this->removeDuration($column['header']),'visible'=>false); +$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false); } return $this->all_headers; @@ -82,6 +90,20 @@ return $this->all_headers; } +function get_selected_period($label) { + +if ($this->all_headers[$label."w"]['visible']) + return "w"; +else if ($this->all_headers[$label."m"]['visible']) + return "m"; +else if ($this->all_headers[$label."y"]['visible']) + return "y"; +else if ($this->all_headers[$label]['visible']) + return ""; + +return ""; +} + function node_tags() { $fetched_tags = array('node_id'); @@ -101,7 +123,7 @@ function print_headers() { foreach ($this->all_headers as $h) { - $headers.="
".$h['header'].":".$h['label'].":".$h['tagname']; + $headers.="
".$h['header'].":".$h['label'].":".$h['tagname'].":".$h['visible']; } return $headers; } @@ -122,11 +144,11 @@ function headerIsVisible($header_name) { $headersToShow = $this->visible_headers; +if (in_array($header_name, $headersToShow)) + return true; - if ($this->inTypeC($header_name."w") || $this->inTypeC($header_name."m") || $this->inTypeC($header_name."y")) - return (in_array($header_name."w", $headersToShow) || in_array($header_name."m", $headersToShow) || in_array($header_name."y", $headersToShow)); - else - return in_array($header_name, $headersToShow); +if ($this->inTypeC($header_name."w")) + return (in_array($header_name."w", $headersToShow) || in_array($header_name."m", $headersToShow) || in_array($header_name."y", $headersToShow)); } @@ -267,11 +289,13 @@ function checkThreshold($value, $threshold, $hh) { function cells($table, $node) { +$this->fetch_data($node); foreach ($this->all_headers as $h) { +if (!$h['fixed']) { -if (!$h['fixed'] && $h['visible']) +if ($h['visible'] != "") { if ($this->inTypeC($h['header'])) { @@ -304,9 +328,9 @@ else $table->cell($value,array('name'=>$h['header'], 'display'=>'table-cell')); } } -else +else $table->cell("??", array('name'=>$h['header'], 'display'=>'none')); - +} } } @@ -319,68 +343,106 @@ HTML */ -function javascript_vars() { +function javascript_init() { print(""); -$all_columns_string = ""; -foreach ($this->all_headers as $h) - $all_columns_string.= $h['header'].","; - print(""); -print("var column_table = new Array();"); -print ("var column_index=0;"); -print("var column_table2 = new Array();"); -print("var column_headers = new Array();"); -print("var columns_to_fetch = new Array();"); -//document.onkeyup = scrollList('test'); +} + + + +function quickselect_html() { + +//return '

This link uses the onclick event handler.
Open popup

'; + + +$quickselection = ""; +$quickselection.=" "; + +return $quickselection; + +} + + +function quickselect_popup_html() { + +print('
'); +print ("
"); +print(" "); } @@ -393,14 +455,14 @@ else $table_width = 350; print(""); -print(""); +print(""); if ($showDescription) print(""); print(""); @@ -440,12 +517,14 @@ if ($showDescription) print("
            
"); } -print(""); +//print(""); +//print(""); +//print(""); +//print(" "); +//print(" "); if ($showDescription) print(""); @@ -453,6 +532,8 @@ if ($showDescription) print("
Add/delete columns
Add/remove columnsColumn description and configuration
"); - print('
'); + print('
'); print (""); $prev_label=""; $optionclass = "out"; @@ -417,19 +479,34 @@ print ("
"); if ($this->headerIsVisible($h['label'])) { $selected = "checked=true"; + $fetch = "true"; //print("header ".$h['label']." checked!"); } else { $selected = ""; + $fetch = "false"; } + print(""); + if ($prev_label == $h['label']) continue; $prev_label = $h['label']; - - print (""); + $period = $this->get_selected_period($h['label']); + +// + print (""); } print("
".$h['label']." ".$h['title']." 
+ + +
+ + + + + +
".$h['label']." ".$h['title']."   
"); +print("
"); //print(""); //print(""); -print(""); -print(" "); -print(" 
"); } + + function column_filter () { echo <<< EOF diff --git a/plekit/php/logSorting.php b/plekit/php/logSorting.php new file mode 100644 index 0000000..27e7ff5 --- /dev/null +++ b/plekit/php/logSorting.php @@ -0,0 +1,25 @@ + diff --git a/plekit/php/table2.php b/plekit/php/table2.php index fdc9a89..d37acb8 100644 --- a/plekit/php/table2.php +++ b/plekit/php/table2.php @@ -1,14 +1,9 @@ @@ -43,7 +38,7 @@ drupal_set_html_head(' // - notes : an array of additional notes // - debug: enables debug callbacks (prints out on console.log) -class PlekitTable2 { +class PlekitTable { // mandatory var $table_id; var $headers; @@ -61,13 +56,12 @@ class PlekitTable2 { var $max_pages; // the max number of pages to display in the paginator var $notes; // an array of additional notes var $debug; // set to true for enabling various log messages on console.log - var $headersToShow; - + var $configurable; // boolen (whether the column configuration option is set or not) // internal var $has_tfoot; - function PlekitTable2 ($table_id,$headers,$sort_column,$headersToShow=NULL,$options=NULL) { + function PlekitTable ($table_id,$headers,$sort_column,$options=NULL) { $this->table_id = $table_id; $this->headers = $headers; $this->sort_column = $sort_column; @@ -84,15 +78,12 @@ class PlekitTable2 { $this->max_pages = 10; $this->notes = array(); $this->debug = false; + $this->configurable = true; + $this->set_options ($options); - //$this->headersToShow=array(); - $this->headersToShow = $headersToShow; + // internal $this->has_tfoot=false; - -//print_r ($this->headersToShow); - - } function set_options ($options) { @@ -110,6 +101,7 @@ class PlekitTable2 { if (array_key_exists('max_pages',$options)) $this->max_pages=$options['max_pages']; if (array_key_exists('notes',$options)) $this->notes=array_merge($this->notes,$options['notes']); if (array_key_exists('debug',$options)) $this->debug=$options['debug']; + if (array_key_exists('configurable',$options)) $this->configurable=$options['configurable']; } public function columns () { @@ -150,29 +142,30 @@ class PlekitTable2 { print " $this->caption "; print ""; +//a hidden column to store the node_id (used for the dynamic update of column data but not sure if +//it is necessary) +if ($this->configurable) + print ("nodeid\n"); - -//panos: hidden column for the node_id -print ("nid\n"); -////DON'T FORGET! - - foreach ($this->headers as $hkey => $colspec) { - //print $label; + foreach ($this->headers as $label => $colspec) { // which form is being used if (is_array($colspec)) { $type=$colspec['type']; - $title=$colspec['title']; -//panos some additional attributes - $visible=$colspec['visible']; - $header = $colspec['header']; - $label=$colspec['label']; + $title=ucfirst($colspec['title']); + if ($this->configurable) { + $visible=$colspec['visible']; + $header = $colspec['header']; + $tlabel=$colspec['label']; + } } else { // simple/legacy form $type=$colspec; $title=NULL; - $visible = true; - $label=$hkey; - $header=$hkey; + if ($this->configurable) { + $visible = true; + $tlabel=$label; + $header=$hkey; + } } switch ($type) { case "none" : @@ -186,10 +179,13 @@ print ("nid\ } $title_part=$title ? "title=\"$title\"" : ""; - - if ($visible) print ("".$label."\n"); - else print ("".$label."\n"); - + if ($this->configurable) { + if ($visible) print ("".$tlabel."\n"); + else print ("".$tlabel."\n"); + } + else + print ("$label\n"); + //print ("$label\n"); } print ""; @@ -268,25 +264,25 @@ EOF; //////////////////////////////////////// function notes_area_html () { -// $search_notes = -// array("Enter & or | in the search area to switch between AND and OR search modes"); -// $sort_notes = -// array ("Hold down the shift key to select multiple columns to sort"); + $search_notes = + array("Enter & or | in the search area to switch between AND and OR search modes"); + $sort_notes = + array ("Hold down the shift key to select multiple columns to sort"); if ($this->notes) $notes=$this->notes; else $notes=array(); -// $notes=array_merge($notes,$sort_notes); -// if ($this->search_area) -// $notes=array_merge($notes,$search_notes); + $notes=array_merge($notes,$sort_notes); + if ($this->search_area) + $notes=array_merge($notes,$search_notes); if (! $notes) return ""; $result = ""; -// $result .= "

Notes\n"; -// foreach ($notes as $note) -// $result .= "

$note
"; - // $result .= "

"; + $result .= "

Notes\n"; + foreach ($notes as $note) + $result .= "
$note\n"; + $result .= "

"; return $result; } @@ -319,9 +315,9 @@ EOF; $option=$options['columns'];if ($option) $html .= " colspan='$option'"; $option=$options['hfill']; if ($option) $html .= " colspan='" . $this->columns() . "'"; $option=$options['align']; if ($option) $html .= " style='text-align:$option'"; - $option=$options['color']; if ($option) $html .= " style='color:$option'"; + $option=$options['color']; if ($option) $html .= " style='color:$option'"; $option=$options['display']; if ($option) $html .= " style='display: $option'"; - $option=$options['name']; if ($option) $html .= " name='$option'"; + $option=$options['name']; if ($option) $html .= " name='$option'"; $html .= ">$text"; return $html; } diff --git a/plekit/php/updateConf.php b/plekit/php/updateConfiguration.php similarity index 69% rename from plekit/php/updateConf.php rename to plekit/php/updateConfiguration.php index 4722688..39de8ea 100644 --- a/plekit/php/updateConf.php +++ b/plekit/php/updateConfiguration.php @@ -14,15 +14,15 @@ require_once 'plc_drupal.php'; require_once 'plc_functions.php'; $value=$_GET["value"]; +$person_id=intval($_GET["person_id"]); $slice_id=intval($_GET["slice_id"]); -$tagN=$_GET["tagName"]; +$tag_id=intval($_GET["tag_id"]); -$fields= array( "$tagN"=>$value); -$api->UpdateSlice( $slice_id , $fields ); +$api->UpdatePersonTag( $tag_id, $value ); $myFile = "/var/log/myslice-log"; $fh = fopen($myFile, 'a') or die("can't open file"); -$stringData = "\n".date('Ymd-H:i')."|".$slice_id.":".$value; +$stringData = "\n".date('Ymd-H:i')."|".$person_id.":".$slice_id.":".$value; fwrite($fh, $stringData); fclose($fh); diff --git a/plekit/table/columns.js b/plekit/table/columns.js index 115fc7c..d956477 100644 --- a/plekit/table/columns.js +++ b/plekit/table/columns.js @@ -1,9 +1,259 @@ -/* $Id: table.js 13009 2009-04-10 10:49:28Z baris $ */ +/* $Id: column.js Panos $ */ var filtered_color = "grey"; var normal_color = "black"; +//Descriptions overriding the default ones set in Accessors_site.py and configuration + +var sourceComon = 'CoMon'; +var sourceTophat = 'TopHat'; +var sourceTophatAPI = 'TopHat API'; +var sourceMySlice = 'MySlice'; +var sourceCymru = 'Team Cymru'; +var sourceMyPLC = 'MyPLC API'; +var sourceManiacs = 'MANIACS'; +var sourceMaxmind = 'MaxMind'; +var sourceMonitor = 'Monitor'; +var selectReferenceNode ='Select reference node: '; +var addButton = ''; +var deleteButton = ''; + +var descHOSTNAME = "test"; + +var titleA = 'Architecture name'; +var detailA = 'The node architecture.'; +var sourceA = 'Source: '+sourceMyPLC; +var valuesA = 'Values: x86_64, i386'; +var descA = ''+titleA+'

'+detailA+'

'+valuesA+'

'+sourceA; + +var titlef = 'Operating system'; +var detailf = 'Fedora or CentOS distribution to use for node or slivers.'; +var sourcef = 'Source: '+sourceMyPLC; +var descf = ''+titlef+'

'+detailf+'

'+sourcef; + +var titleAU = 'Authority'; +var detailAU = 'The authority of the global PlanetLab federation that the site of the node belongs to.'; +var valuesAU = 'Values: PLC (PlanetLab Central), PLE (PlanetLab Europe)'; +var sourceAU = 'Source: '+sourceMyPLC; +var descAU = ''+titleAU+'

'+detailAU+'

'+valuesAU+'

'+sourceAU; + +var titleAS = 'Autonomous system ID'; +var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')'; +var valuesAS = 'Unit: Integer between 0 and 65535'; +var descAS = ''+titleAS+'

'+valuesAS+'

' + sourceAS; + +var titleAST = 'Autonomous system type'; +var sourceAST = 'Source: '+sourceManiacs; +var valuesAST = 'Values: t1 (tier-1), t2 (tier-2), edu (university), comp (company), nic (network information centre -- old name for a domain name registry operator), ix (IXP), n/a'; +var descAST = ''+titleAST+'

'+valuesAST+'

'+sourceAST; + +var titleASN = 'Autonomous system name'; +var sourceASN = 'Source: '+sourceTophat; +var descASN = ''+titleASN+'

'+sourceASN; + +var selectPeriodBU = 'Select period: '; +var titleBU = 'Bandwidth utilization '; +var sourceBU = 'Source: '+sourceComon+' (via '+sourceMySlice+')'; +var valuesBU ='Unit: Kbps'; +var detailBU = 'The average transmited bandwidh over the selected period. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.' +var descBU = ''+titleBU+'

'+detailBU+'

'+selectPeriodBU+'

'+valuesBU+'

'+sourceBU; + +var titleBW= 'Bandwidth limit'; +var sourceBW = 'Source: '+sourceComon; +var valuesBW = 'Unit: Kbps'; +var detailBW = 'The bandwidth limit is a cap on the total outbound bandwidth usage of a node. It is set by the site administrator (PI). For more details see Bandwidth Limits (planet-lab.org).'; +var descBW = ''+titleBW+'

'+detailBW+'

'+valuesBW+'

'+sourceBW; + +var titleCC = 'Number of CPU cores'; +var sourceCC = 'Source: '+sourceComon; +var valuesCC = 'Current PlanetLab hardware requirements: 4 cores min.
(Older nodes may have fewer cores).'; +var descCC = ''+titleCC+'

'+valuesCC+'

'+sourceCC; + +var titleCN = 'Number of CPUs'; +var sourceCN = 'Source: '+sourceComon; +var valuesCN = 'Current PlanetLab hardware requirements: 1 (if quad core) or 2 (if dual core)'; +var descCN = ''+titleCN+'

'+valuesCN+'

'+sourceCN; + +var titleCR = 'CPU clock rate'; +var sourceCR = 'Source: '+sourceComon; +var valuesCR = 'Unit: GHz

Current PlanetLab hardware requirements: 2.4 GHz'; +var descCR = ''+titleCR+'

'+valuesCR+'

'+sourceCR; + +var selectPeriodCF = 'Select period: '; +var titleCF = 'Free CPU'; +var sourceCF = 'Source: '+sourceComon+' (via '+sourceMySlice+')'; +var valuesCF = 'Unit: %'; +var detailCF = ' The average CPU percentage that gets allocated to a test slice named burb that is periodically run by CoMon.'; +var descCF = ''+titleCF+'

'+detailCF+'

'+selectPeriodCF+'

'+valuesCF+'

'+sourceCF; + +var titleDS = 'Disk size'; +var sourceDS = 'Source: '+sourceComon; +var valuesDS = 'Unit: GB

Current PlanetLab hardware requirements: 500 GB'; +var descDS = ''+titleDS+'

'+valuesDS+'

'+sourceDS; + +var titleDU = 'Current disk utilization'; +var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')'; +var valuesDU = 'Unit: GB'; +var detailDU = ' The amount of disk space currently consumed (checked daily).'; +var descDU = ''+titleDU+'

'+detailDU+'

'+valuesDU+'

'+sourceDU; + +var titleHC = 'Hop count (pairwise)'; +var sourceHC = 'Source: '+sourceTophat; +var detailHC = 'TopHat conducts traceroutes every five minutes in a full mesh between all PlanetLab nodes. The hop count is the length of the traceroute from the node to the reference node, based upon the most recently reported traceroute.'; +var descHC = ''+titleHC+'

'+detailHC+'

'+selectReferenceNode+'

'+sourceHC; + +var titleIP = 'IP address'; +var sourceIP = 'Source: '+sourceTophat; +var descIP = ''+titleIP+'

'+sourceIP; + +var selectPeriodL = 'Select period: '; +var titleL= 'Load '; +var sourceL = 'Source: '+sourceComon; +var valuesL = 'Unit: 5-minute load'; +var detailL = 'The average 5-minute load (as reported by the Unix uptime command) over the selected period.'; +//var descL = ''+titleL+'

'+detailL+'

'+selectPeriodL+'

'+valuesL+'

'+sourceL; +var descL = ''+titleL+'

'+detailL+'

'+valuesL+'

'+sourceL; + +var titleLON= 'Longitude'; +var sourceLON = 'Source: '+sourceTophat; +var descLON = ''+titleLON+'

'+sourceLON; + +var titleLAT= 'Latitude'; +var sourceLAT = 'Source: '+sourceTophat; +var descLAT = ''+titleLAT+'

'+sourceLAT; + +var titleLCN= 'Location (Country)'; +var sourceLCN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')'; +var detailLCN = 'Based on the latitude and longitude information.'; +var descLCN = ''+titleLCN+'

'+detailLCN+'

'+sourceLCN; + +var titleLCT= 'Location (Continent)'; +var sourceLCT = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')'; +var detailLCT = 'Based on the latitude and longitude information.'; +var descLCT = ''+titleLCT+'

'+detailLCT+'

'+sourceLCT; + +var titleLCY= 'Location (City)'; +var sourceLCY = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')'; +var detailLCY = 'Based on the latitude and longitude information.'; +var descLCY = ''+titleLCY+'

'+detailLCY+'

'+sourceLCY; + +var titleLPR= 'Location precision radius'; +var sourceLPR = 'Source: '+sourceTophat; +var valuesLPR = 'Unit: float'; +var detailLPR = 'The radius of the circle corresponding to the error in precision of the geolocalization estimate.'; +var descLPR = ''+titleLPR+'

'+detailLPR+'

'+valuesLPR+'

'+sourceLPR; + +var titleLRN= 'Location (Region)'; +var sourceLRN = 'Source: '+sourceMaxmind+' (via '+sourceTophat+')'; +var detailLRN = 'Based on the latitude and longitude information.'; +var descLRN = ''+titleLRN+'

'+detailLRN+'

'+sourceLRN; + +var titleMS= 'Memory size'; +var sourceMS = 'Source: '+sourceComon; +var valuesMS = 'Unit: GB

Current PlanetLab hardware requirements: 4 GB.'; +var descMS = ''+titleMS+'

'+valuesMS+'

'+sourceMS; + +var selectPeriodMU = 'Select period: '; +var titleMU = 'Memory utilization'; +var sourceMU = 'Source: '+sourceComon; +var valuesMU = '

Unit: %'; +var detailMU = 'The average active memory utilization as reported by CoMon.'; +var descMU = ''+titleMU+'

'+detailMU+'

'+selectPeriodMU+'

'+valuesMU+'

'+sourceMU; + +var titleNEC= 'Network information (ETOMIC)'; +var sourceNEC = 'Source: '+sourceTophat; +var valuesNEC = 'Values: yes/no'; +var detailNEC = 'The existence of a colocated ETOMIC box. When an ETOMIC box is present, you have the possibility to conduct high-precision measurements through the '+sourceTophatAPI+'.'; +var descNEC = ''+titleNEC+'

'+detailNEC+'

'+valuesNEC+'

'+sourceNEC; + +var titleNSN= 'Network information (SONoMA)'; +var sourceNSN = 'Source: '+sourceTophat; +var valuesNSN = 'Values: yes/no'; +var detailNSN = 'The existence of a SONoMA agent. When an SONoMA is present, you have the possibility to have access to high-precision measurements through the '+sourceTophatAPI+'.'; +var descNSN = ''+titleNSN+'

'+detailNSN+'

'+valuesNSN+'

'+sourceNSN; + +var titleNTH= 'Network information (TopHat)'; +var sourceNTH = 'Source: '+sourceTophat; +var valuesNTH = 'Values: yes/no'; +var detailNTH = 'The existence of a colocated TDMI (TopHat Dedicated Measurement Infrastructure) agent. When a TDMI agent is present, you have access to a wide variety of network topology measurements through the '+sourceTophatAPI+'.'; +var descNTH = ''+titleNTH+'

'+detailNTH+'

'+valuesNTH+'

'+sourceNTH; + +var titleNDS= 'Network information (DIMES)'; +var sourceNDS = 'Source: '+sourceTophat; +var valuesNDS = 'Values: yes/no'; +var detailNDS = 'The existence of a colocated DIMES agent. When a DIMES agent is present, you have access to DIMES measurements through the '+sourceTophatAPI+'.'; +var descNDS = ''+titleNDS+'

'+detailNDS+'

'+valuesNDS+'

'+sourceNDS; + +var titleNSF= 'Network information (spoof)'; +var sourceNSF = 'Source: '+sourceTophat; +var valuesNSF = '

Values: yes/no'; +var detailNSF = ' Whether the node can send packets successfully (or not) with a spoofed IP source address.'; +var descNSF = ''+titleNSF+'

'+detailNSF+'

'+valuesNSF+'

'+sourceNSF; + +var titleNSR= 'Network information (source route)'; +var sourceNSR = 'Source: '+sourceTophat; +var valuesNSR = '

Values: yes/no'; +var detailNSR = ' Whether the node can send packets packets using the IP source route option. See herefor more info.'; +var descNSR = ''+titleNSR+'

'+detailNSR+'

'+valuesNSR+'

'+sourceNSR; + +var titleNTP= 'Network information (timestamp)'; +var sourceNTP = 'Source: '+sourceTophat; +var valuesNTP = '

Values: yes/no'; +var detailNTP = ' Whether the node can send packets packets using the IP timestamp option. See herefor more info.'; +var descNTP = ''+titleNTP+'

'+detailNTP+'

'+valuesNTP+'

'+sourceNTP; + +var titleNRR= 'Network information (record route)'; +var sourceNRR = 'Source: '+sourceTophat; +var valuesNRR = '

Values: yes/no'; +var detailNRR = ' Whether the node can send packets packets using the IP record route option. See herefor more info.'; +var descNRR = ''+titleNRR+'

'+detailNRR+'

'+valuesNRR+'

'+sourceNRR; + +var titleOS = 'Operating system'; +var sourceOS = 'Source: '+sourceMyPLC; +var valuesOS = 'Values: Fedora, Cent/OS, other, n/a'; +var descOS = ''+titleOS+'

'+valuesOS+'

'+sourceOS; + +var selectPeriodR = 'Select period: '; +var titleR = 'Reliability'; +var sourceR = 'Source: '+sourceComon+' (via '+sourceMySlice+')'; +var detailR = 'CoMon queries nodes every 5 minutes, for 255 queries per day. The average reliability is the percentage of queries over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.'; +var valuesR = 'Unit: %'; +var descR = ''+titleR+'

'+detailR+'

'+selectPeriodR+'

'+valuesR+'

'+sourceR; +//var descR = ''+titleR+'

'+detailR+'

'+valuesR+'

'+sourceR; + +var titleRES = 'Reservation capabilities'; +var sourceRES = 'Source: '+sourceMyPLC; +//var valuesRES = 'Values: yes/no'; +var valuesRES = 'Values: -R- (if yes)'; +var detailRES = ' Whether the node can be reserved for a certain duration.
Your slivers will be available only during timeslots where you have obtained leases (see tab above)
.

Please note that as of August 2010 this feature is experimental. Feedback is appreciated at devel@planet-lab.org'; +var descRES = ''+titleRES+'

'+detailRES+'

'+valuesRES+'

'+sourceRES; + +var selectPeriodS = 'Select period: '; +var titleS = 'Active slices'; +var sourceS = 'Source: '+sourceComon+' (via '+sourceMySlice+')'; +var valuesS = 'Unit: %'; +var detailS = 'Average number of active slices over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.'; +var descS = ''+titleS+'

'+detailS+'

'+selectPeriodS+'

'+valuesS+'

'+sourceS; + +var titleSN = 'Site name'; +var sourceSN = 'Source: '+sourceMyPLC; +var descSN = ''+titleSN+'

'+sourceSN; + +var selectPeriodSSH = 'Select period: '; +var titleSSH = 'Average SSH response delay'; +var valuesSSH = 'Unit: %'; +var detailSSH = 'The average response delay of the node to SSH logins over the selected period for which CoMon reports a value. The period is the most recent for which data is available, with CoMon data being collected by MySlice daily.'; +var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')'; +var descSSH = ''+titleSSH+'

'+detailSSH+'

'+selectPeriodSSH+'

'+valuesSSH+'

'+sourceSSH; + +var titleST = 'Status'; +var sourceST = 'Source: '+sourceMonitor; +var valuesST = 'Values: online (up and running), good (up and running recently), offline (unreachable today), down (node unreachable for more than one day), failboot (reachable, but only by administrators for debugging purposes).'; +var descST = ''+titleST+'

'+valuesST+'

'+sourceST; + + +//Categorization of columns in different types, useful for filtering function inTypeA(header_name) { var typeA = ['ST','SN','RES','OS','NRR','NTP','NSR','NSF','NDS','NTH','NEC','LRN','LCY','LPR','LCN','LAT','LON','IP','ASN','AST']; @@ -25,172 +275,190 @@ function inTypeD(header_name) { return typeD.indexOf(header_name); } + +//Debugging function debugfilter(s) { document.getElementById('debug').innerHTML+=s; } -function scrollList(tableid) { -debugfilter("here"); - -if (event.keyCode == 40) - debugfilter("down"); -else if (event.keyCode == 38) - debugfilter("up"); - -} +//Called when a column is selected. It displays the detailed description +//on the right panel function highlightOption(divid) { -//debugfilter("highlighting option "+divid); + //debugfilter("highlighting option "+divid); -for (var kk in column_headers) { + var columns = document.getElementsByName('columnlist'); + for(var j = 0; j < columns.length; j++) + columns[j].className = 'out'; -if (document.getElementById(kk)) - document.getElementById(kk).className = 'out'; -} + document.getElementById(divid).className = 'selected'; -document.getElementById(divid).className = 'selected'; + showDescription(divid); -showDescription(divid); +//panos: to IMPROVE + if (document.getElementById('selectperiod'+divid)) + document.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value; } +//Displays the detailed column description + function showDescription(h) { //debugfilter("showing description "+h); +//Checks if the detailed description div exists if (document.getElementById('selectdescr')) { + //Checks if there is a detailed description defined if (window['desc'+h]) document.getElementById('selectdescr').innerHTML = ""+window['desc'+h]; - else if (column_table[h] && column_table[h]['description']) - document.getElementById('selectdescr').innerHTML = column_table[h]['description']; + //else if (document.getElementById('fdesc'+h)) + //document.getElementById('selectdescr').innerHTML = document.getElementById('fdesc'+h).value; else - document.getElementById('selectdescr').innerHTML = "No description provided"; + document.getElementById('selectdescr').innerHTML = "No detailed description provided"; } } +//Overrides the titles of the columns as they are shown in the column selection panel. +//If no overriding variable exists the tag's description is used function overrideTitles() { - //debugfilter("

overriding..."); + var columns = document.getElementsByName('columnlist'); - for (var kk in column_headers) { - - //debugfilter("here "+kk); - - if (document.getElementById(kk) && window['title'+kk]) - document.getElementById('htitle'+kk).innerHTML = window['title'+kk]; + for(var j = 0; j < columns.length; j++) + { + var kk = columns[j].id; + if (window['title'+kk]) + document.getElementById('htitle'+kk).innerHTML = window['title'+kk]; } - } +//When the checkbox is clicked. Adds/removes column respectively function changeCheckStatus(column) { + if (document.getElementById('selectdescr')) + showDescription(document.getElementById(column).value); -if (document.getElementById('selectdescr')) -{ -showDescription(document.getElementById(column).value); - -if (document.getElementById(column).checked) - addColumn(document.getElementById(column).value); -else - deleteColumn(document.getElementById(column).value); + if (document.getElementById(column).checked) + addColumn(document.getElementById(column).value, true); + else + deleteColumn(document.getElementById(column).value); } -} +//This function is used when the alternative "quick" selection list is used +function changeSelectStatus(column) { -function updatePeriod(h) { - deleteColumn2(h, h+'w'); - deleteColumn2(h, h+'m'); - deleteColumn2(h, h+'y'); - addColumn(h); -} + var optionClass = ""; + var selected_index = document.getElementById('quicklist').selectedIndex; -function filterByType(selectedtype) { + if (document.getElementById('quicklist')) + { -var notselectedyet = true; + optionClass = document.getElementById('quicklist').options[selected_index].className; -for (var kk in column_headers) { + if (optionClass == "in") + { + deleteColumn(document.getElementById('quicklist').value); + document.getElementById('quicklist').options[selected_index].className = "out"; + } + else + { + addColumn(document.getElementById('quicklist').value, true); + document.getElementById('quicklist').options[selected_index].className = "in"; + } + } +} - if (document.getElementById(kk)) +//When the period of an already selected column is changed +function updatePeriod(h, new_period) { + + var old_period = document.getElementById('period'+h).value; + document.getElementById('period'+h).value=new_period; + + //debugfilter(h+''+old_period+'-'+h+''+new_period); + if (document.getElementById('check'+h).checked) { - if (window['type'+kk] == selectedtype) - { - document.getElementById(kk).className = 'in'; - if (notselectedyet) - highlightOption(kk); - notselectedyet = false; - } - else - document.getElementById(kk).className = 'out'; + deleteColumnCells(h+''+old_period); + addColumnCells(h+''+new_period); + addColumnAjax(h, h+''+new_period); + + replaceColumnConfiguration(h+''+old_period,h+''+new_period); } } -} - /* RESET/SAVE CONFIGURATION */ +function getHTTPObject() +{ + if (typeof XMLHttpRequest != 'undefined') + { return new XMLHttpRequest(); } -function resetColumns() { + try + { return new ActiveXObject("Msxml2.XMLHTTP"); } + catch (e) + { + try { return new ActiveXObject("Microsoft.XMLHTTP"); } + catch (e) {} + } + return false; +} - for (var kk in column_table) { - if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false) - deleteColumn(kk); - else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true) - addColumn(kk); - } +function closeShowReservable() +{ + var slice_id = document.getElementById('slice_id').value; + var person_id = document.getElementById('person_id').value; + var tag_id = document.getElementById('show_tag_id').value; + document.getElementById('note_reservable_div').style.display = "none"; + + var url = "/plekit/php/updateConfiguration.php?value="+slice_id+";reservable:no&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id; + + var req = getHTTPObject(); + req.open('GET', url, true); + req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + req.onreadystatechange = + function() { + if (req.readyState == 4) + { debugfilter(req.responseText); } + } + req.send(null); } -function resetCols(which_conf) { - var target_configuration = "|"+document.getElementById(which_conf).value+"|"; - - //debugfilter("

Target configuration = "+target_configuration); +function updateColumnConfiguration(slice_id, value, reload) +{ + var person_id = document.getElementById('person_id').value; + var tag_id = document.getElementById('conf_tag_id').value; + var full_column_configuration = document.getElementById('full_column_configuration').value; - for (var kk in column_table) { - //debugfilter("in "+kk+" "); + //debugfilter("
OLD = "+full_column_configuration); + //debugfilter("
value = "+value); + + var old_columns = full_column_configuration.split(";"); + var new_columns = new Array(); - if (target_configuration.indexOf("|"+kk+"|")>=0) - { - if (document.getElementById('check'+kk)) - if (document.getElementById('check'+kk).checked == false) - { - debugfilter("

Adding "+kk); - addColumn(kk); - } - } + for (var column_index = 0; column_index < old_columns.length ; column_index++) { + new_columns.push(old_columns[column_index]); + if (old_columns[column_index] != slice_id) + new_columns.push(old_columns[++column_index]); else { - if (document.getElementById('check'+kk)) - if (document.getElementById('check'+kk).checked == true) - { - debugfilter("

Deleting "+kk); - deleteColumn(kk); - } + column_index++; + new_columns.push(value); } } -} - -function saveConfiguration(which_conf) -{ - var slice_id = document.getElementById('slice_id').value; - - var target_configuration = document.getElementById(which_conf).value; - debugfilter("saving configuration "+target_configuration); - updateColumnConfiguration(slice_id, target_configuration); -} - -function updateColumnConfiguration(slice_id, value) -{ + var new_configuration = new_columns.join(";"); + //debugfilter("
NEW = "+new_configuration); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari @@ -205,49 +473,57 @@ function updateColumnConfiguration(slice_id, value) if (xmlhttp.readyState==4) // && xmlhttp.status==200) { //value=xmlhttp.responseText; - //debugfilter(value); - if (document.getElementById('column_configuration')) + //debugfilter(value+"-----"+new_configuration); document.getElementById('column_configuration').value=value; + document.getElementById('full_column_configuration').value=new_configuration; + + if (reload) + window.location.reload(true); } } - xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&tagName=Configuration",true); + + xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true); + //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true); xmlhttp.send(); } +function logSortingAction(slice_id, value) +{ + if (value.indexOf("column-1")!=-1) + return; -function resetConfiguration(which_conf) -{ - var slice_id = document.getElementById('slice_id').value; - var target_configuration = document.getElementById(which_conf).value; + var req = getHTTPObject(); + var url = "/plekit/php/logSorting.php?value="+value+"&slice_id="+slice_id; + + req.open('GET', url, true); + req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + req.onreadystatechange = + function() { + if (req.readyState == 4) + { debugfilter(req.responseText); } + } + req.send(null); +} - debugfilter("reseting configuration "+target_configuration); +function sortCompleteCallback(tableid) { - if (window.XMLHttpRequest) - {// code for IE7+, Firefox, Chrome, Opera, Safari - xmlhttp=new XMLHttpRequest(); - } - else - {// code for IE6, IE5 - xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); - } - xmlhttp.onreadystatechange=function() - { - if (xmlhttp.readyState==4) // && xmlhttp.status==200) - { - //value=xmlhttp.responseText; - //debugfilter(value); - window.location.reload(true); - } - } - xmlhttp.open("GET","/plekit/php/updateConf.php?value="+target_configuration+"&slice_id="+slice_id+"&tagName=Configuration",true); + var slice_id = document.getElementById('slice_id').value; - xmlhttp.send(); + var ths = document.getElementById(tableid).getElementsByTagName("th"); + for(var i = 0, th; th = ths[i]; i++) { + if (th.className.indexOf("Sort") != -1) + { + var column = th.className.substr(th.className.indexOf("column"),th.className.indexOf("column")+1); + var sortdirection = th.className.substr(th.className.indexOf("Sort")-8,th.className.indexOf("Sort")); + logSortingAction(slice_id, tableid+"|"+column+"|"+sortdirection); + } + } } -function addColumnToConfiguration(column) { +function addColumnToConfiguration(column) { var old_configuration = document.getElementById('column_configuration').value; var slice_id = document.getElementById('slice_id').value; @@ -261,10 +537,49 @@ function addColumnToConfiguration(column) { //debugfilter("new configuration = "+new_configuration); - updateColumnConfiguration(slice_id, new_configuration); + updateColumnConfiguration(slice_id, new_configuration, false); } +function deleteColumnFromConfiguration(column) { + + var old_configuration = document.getElementById('column_configuration').value; + var slice_id = document.getElementById('slice_id').value; + + var old_columns = old_configuration.split("|"); + var new_columns = new Array(); + + for (var column_index = 0; column_index < old_columns.length ; column_index++) { + var conf = old_columns[column_index].split(':'); + if (conf[0] != column) + new_columns.push(old_columns[column_index]); + } + + var new_configuration = new_columns.join("|"); + updateColumnConfiguration(slice_id, new_configuration, false); + +} + +function replaceColumnConfiguration(column_old, column_new) { + + var old_configuration = document.getElementById('column_configuration').value; + var slice_id = document.getElementById('slice_id').value; + + var old_columns = old_configuration.split("|"); + var new_columns = new Array(); + + for (var column_index = 0; column_index < old_columns.length ; column_index++) { + var conf = old_columns[column_index].split(':'); + if (conf[0] != column_old) + new_columns.push(old_columns[column_index]); + else + new_columns.push(column_new); + } + + var new_configuration = new_columns.join("|"); + + updateColumnConfiguration(slice_id, new_configuration); +} /* @@ -273,23 +588,11 @@ ADD/REMOVE COLUMNS */ -function getHTTPObject() -{ - if (typeof XMLHttpRequest != 'undefined') - { return new XMLHttpRequest(); } - try - { return new ActiveXObject("Msxml2.XMLHTTP"); } - catch (e) - { - try { return new ActiveXObject("Microsoft.XMLHTTP"); } - catch (e) {} - } - return false; -} +function load_data(column, header, url) { -function load_html(column, url) { + //debugfilter("
loading "+url); var req = getHTTPObject(); var res; req.open('GET', url, true); @@ -297,15 +600,15 @@ function load_html(column, url) { req.onreadystatechange = function() { if (req.readyState == 4) - { updateColumnData(column, req.responseText); } + { updateColumnData(column, header, req.responseText); } } req.send(null); } -function updateColumnData(column,data) { +function updateColumnData(column, header, data) { -var headers = column.split("|"); +var headers = header.split("|"); var data_table = data.split("|"); //debugfilter("

headers[0] = "+headers[0]); @@ -345,13 +648,20 @@ var data_table = data.split("|"); var tr=rows[row_index]; for (var column_index=0; column_index < tr.cells.length; column_index++) { - //debugfilter("

node id = "+tr.cells[0].innerHTML); + //debugfilter("

node id = "+tr.cells[0].innerHTML+" - "+tr.cells[column_index].getAttribute('name')); + if (tr.cells[column_index].getAttribute('name')) + { var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name')); if (found_index != -1) + //debugfilter(tr.cells[0].innerHTML+"-"+found_index); tr.cells[column_index].innerHTML = data_array1[tr.cells[0].innerHTML][found_index]; + } } } + fdTableSort.init(table_id1); + tablePaginater.init(table_id1); + //potential nodes if (data_table[node_index] == '---potential---') { @@ -386,35 +696,36 @@ if (data_table[node_index] == '---potential---') var tr=rows2[row_index]; for (var column_index=0; column_index < tr.cells.length; column_index++) { + if (tr.cells[column_index].getAttribute('name')) + { var found_index = headers.indexOf(tr.cells[column_index].getAttribute('name')); if (found_index != -1) tr.cells[column_index].innerHTML = data_array2[tr.cells[0].innerHTML][found_index]; + } } } -} + //fdTableSort.removeTableCache(table_id2); + fdTableSort.init(table_id2); + tablePaginater.init(table_id2); - document.getElementById('loadingDiv').innerHTML = "" } +document.getElementById('loading'+column).innerHTML = ""; +} - -function addColumnCells(column,header) { - - //debugfilter("adding cells now: "+column+":"+header); - column_table[header]['visible']=true; +function addColumnCells(header) { var cells = document.getElementsByName(header); - //debugfilter("got cells -"+cells+"- for "+header); for(var j = 0; j < cells.length; j++) cells[j].style.display = "table-cell"; } -function addColumnSamples(column) { +function addSampleCells(column) { var cellsheader = document.getElementsByName("confheader"+column); for(var j = 0; j < cellsheader.length; j++) @@ -422,69 +733,179 @@ function addColumnSamples(column) { } -function addColumnAjax(column) { +function addColumnAjax(column, header) { - var selectedperiod=""; + //var t = document.getElementById('check'+column).name; + var t = document.getElementById('tagname'+header).value; + var slice_id = document.getElementById('slice_id').value; - if (document.getElementById('selectperiod'+column)) - selectedperiod = document.getElementById('selectperiod'+column).value; + var selectedperiod = document.getElementById('period'+column).value; - var header = column+""+selectedperiod; + var fetched = document.getElementById('fetched'+column).value; + var to_load = false; - addColumnCells(column, header); + //debugfilter("
adding "+column+","+header+','+fetched+','+t); - var t = column_table[header]['tagname']; - var slice_id = document.getElementById('slice_id').value; - document.getElementById('loadingDiv').innerHTML = "LOADING ..."; - var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t; - load_html(header, url); + if (fetched.indexOf("false")!=-1) + { + to_load = true; + document.getElementById('fetched'+column).value = ','+selectedperiod+',true'; + } + else if (fetched.indexOf(','+selectedperiod+',')==-1) + { + to_load = true; + document.getElementById('fetched'+column).value = ','+selectedperiod+''+fetched; + } - addColumnToConfiguration(header); + if (to_load) + { + document.getElementById('loading'+column).innerHTML = ""; + var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t; + load_data(column, header, url); + } } -function addColumn2(column) { + +function addColumn(column, fetch) { var selectedperiod=""; + var header=column; + + if (inTypeC(column)!=-1) + { + column = column.substring(0,column.length-1); + } - if (document.getElementById('selectperiod'+column)) - selectedperiod = document.getElementById('selectperiod'+column).value; + selectedperiod = document.getElementById('period'+column).value; + header = column+""+selectedperiod; - var header = column+""+selectedperiod; + //debugfilter("adding column "+column+" and header "+header); - addColumnCells(column,header); + addColumnCells(header); - addColumnToConfiguration(column); + if (fetch) + addColumnAjax(column, header); - checkDataToFetch(); + addColumnToConfiguration(header); + } -function addColumn(column) { + +function deleteColumnCells(header) { + + var cells = document.getElementsByName(header); + for(var j = 0; j < cells.length; j++) + cells[j].style.display = "none"; + +} + + + +function deleteColumn(column) { var selectedperiod=""; var header=column; - //debugfilter("adding column "+column+" and header "+header); + selectedperiod = document.getElementById('period'+column).value; + header = column+""+selectedperiod; - if (inTypeC(column)!=-1) - { - column = column.substring(0,column.length-1); + //debugfilter("deleting "+column+","+header); + + deleteColumnCells(header); + + deleteColumnFromConfiguration(header); + + //document.getElementById('check'+column).checked = false; +} + + +/* + +EXTRA + +//to be used for scrolling the column list with down/up arrows + +function scrollList(tableid) { + +debugfilter("here"); + +if (event.keyCode == 40) + debugfilter("down"); +else if (event.keyCode == 38) + debugfilter("up"); + +} + +function resetColumns() { + + for (var kk in column_table) { + + if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false) + deleteColumn(kk); + else if (column_table[kk]['visible'] == false && column_table[kk]['fetch'] == true) + addColumn(kk, true); } - else if (document.getElementById('selectperiod'+column)) - { - selectedperiod = document.getElementById('selectperiod'+column).value; - header = column+""+selectedperiod; + +} + +function resetCols(which_conf) { + + var target_configuration = "|"+document.getElementById(which_conf).value+"|"; + + //debugfilter("

Target configuration = "+target_configuration); + + for (var kk in column_table) { + //debugfilter("in "+kk+" "); + + if (target_configuration.indexOf("|"+kk+"|")>=0) + { + if (document.getElementById('check'+kk)) + if (document.getElementById('check'+kk).checked == false) + { + debugfilter("

Adding "+kk); + addColumn(kk, true); + } + } + else + { + if (document.getElementById('check'+kk)) + if (document.getElementById('check'+kk).checked == true) + { + debugfilter("

Deleting "+kk); + deleteColumn(kk); + } + } } +} - //debugfilter("adding "+column+","+header); +function filterByType(selectedtype) { - addColumnCells(column, header); +var notselectedyet = true; - addColumnToConfiguration(header); +for (var kk in column_headers) { + + if (document.getElementById(kk)) + { + if (window['type'+kk] == selectedtype) + { + document.getElementById(kk).className = 'in'; + if (notselectedyet) + highlightOption(kk); + notselectedyet = false; + } + else + document.getElementById(kk).className = 'out'; + } +} +} + + +function deleteColumnSample() { + var cellsheader = document.getElementsByName("confheader"+column); + for(var j = 0; j < cellsheader.length; j++) + cellsheader[j].style.display = "none"; - column_table[header]['visible'] = true; - - checkDataToFetch(); } function checkDataToFetch() { @@ -538,85 +959,9 @@ if (column_table[kk]['visible'] == true && column_table[kk]['fetch'] == false) var slice_id = document.getElementById('slice_id').value; document.getElementById('loadingDiv').innerHTML = "    Loading data. Please wait ..."; var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+tagnames; - load_html(headers, url); -} - -function deleteColumnCells(column, header) { - - column_table[header]['visible']=false; - - var cells = document.getElementsByName(header); - for(var j = 0; j < cells.length; j++) - cells[j].style.display = "none"; - -} - -function deleteColumnSample() { - var cellsheader = document.getElementsByName("confheader"+column); - for(var j = 0; j < cellsheader.length; j++) - cellsheader[j].style.display = "none"; - + load_data(headers, url); } -function deleteColumnFromConfiguration(column) { - - - var old_configuration = document.getElementById('column_configuration').value; - var slice_id = document.getElementById('slice_id').value; - - var old_columns = old_configuration.split("|"); - var new_columns = new Array(); - - for (var column_index = 0; column_index < old_columns.length ; column_index++) { - var conf = old_columns[column_index].split(':'); - if (conf[0] != column) - new_columns.push(old_columns[column_index]); - } - - var new_configuration = new_columns.join("|"); - updateColumnConfiguration(slice_id, new_configuration); - - checkDataToFetch(); -} - -function deleteColumn2(column, header) { - - deleteColumnCells(column,header); - - deleteColumnFromConfiguration(column); - - column_table[header]['visible'] = false; - document.getElementById('check'+column).checked = false; -} - -function deleteColumn(column) { - - var selectedperiod=""; - var header=column; - - if (inTypeC(column)!=-1) - { - column = column.substring(0,column.length-1); - } - else if (document.getElementById('selectperiod'+column)) - { - selectedperiod = document.getElementById('selectperiod'+column).value; - header = column+""+selectedperiod; - } - - //debugfilter("deleting "+column+","+header); - - deleteColumnCells(column,header); - - deleteColumnFromConfiguration(header); - - column_table[header]['visible'] = false; - - //document.getElementById('check'+column).checked = false; -} - - - /* -- 2.43.0