// (.) type is passed to the javascript table, for sorting (default is 'string')
// minimal list as a start
-$node_fixed_columns = array('hostname','node_id','peer_id','slice_ids_whitelist',
+$node_fixed_columns = array('hostname','node_id','peer_id','slice_ids_whitelist', 'site_id',
'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();
// optimizing calls to GetNodes
//$all_nodes=$api->GetNodes(NULL,$node_columns);
// extra columns that are not tags (for the moment not sorted correctly)
$extra_columns = array();
-//$extra_columns[]=array('tagname'=>'site_id', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'description'=>'Site name');
+$extra_columns[]=array('tagname'=>'sitename', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'fetched'=>true);
+$extra_columns[]=array('tagname'=>'domain', 'header'=>'DN', 'type'=>'string', 'title'=>'Toplevel domain name', 'fetched'=>true);
+$extra_columns[]=array('tagname'=>'ipaddress', 'header'=>'IP', 'type'=>'string', 'title'=>'IP Address', 'fetched'=>true);
//get user's column configuration
$sliceconf_exists = false;
if ($column_configuration == "")
{
- $column_configuration = $slice_id.";";
+ $column_configuration = $slice_id.";default";
$sliceconf_exists = true;
}
else {
}
if ($sliceconf_exists == false)
- $column_configuration = $column_configuration.";".$slice_id.";";
+ $column_configuration = $column_configuration.";".$slice_id.";default";
//print("<br>slice configuration = ".$slice_column_configuration);
$ConfigureColumns =new PlekitColumns($full_configuration, $fix_columns, $tag_columns, $extra_columns);
-$node_columns = $ConfigureColumns->node_tags();
+$visiblecolumns = $ConfigureColumns->node_tags();
+
+$node_columns=array_merge($node_fixed_columns,$visiblecolumns);
//print_r($node_columns);
$all_nodes=$api->GetNodes(NULL,$node_columns);
$toggle_nodes->end();
+$all_sites=$api->GetSites(NULL, array('site_id','login_base'));
+$site_hash=array();
+foreach ($all_sites as $site) $site_hash[$site['site_id']]=$site['login_base'];
+
+$interface_columns=array('ip','node_id','interface_id');
+$interface_filter=array('is_primary'=>TRUE);
+$interfaces=$api->GetInterfaces($interface_filter,$interface_columns);
+
+$interface_hash=array();
+foreach ($interfaces as $interface) $interface_hash[$interface['node_id']]=$interface;
+
+
+
+
//////////////////// nodes currently in
$toggle_nodes=new PlekitToggle('my-slice-nodes-current',
$headers=array();
$notes=array();
//$notes=array_merge($notes,$visibletags->notes());
-$notes [] = "For information about the different columns please see the <b>node table layout</b> tab above";
+$notes [] = "For information about the different columns please see the <b>node table layout</b> tab above or <b>mouse over</b> the column headers";
/*
$headers['peer']='string';
$table->cell ($label,array('class'=>$class));
$table->cell( ($node['node_type']=='reservable')?reservable_mark():"" );
+ $hostname=$node['hostname'];
+ $ip=$interface_hash[$node['node_id']]['ip'];
+ $interface_id=$interface_hash[$node['node_id']]['interface_id'];
+
+//extra columns
+$node['domain'] = topdomain($hostname);
+$node['sitename'] = l_site_t($node['site_id'],$site_hash[$node['site_id']]);
+$node['ipaddress'] = l_interface_t($interface_id,$ip);
+
+
//foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]);
$ConfigureColumns->cells($table, $node);
$headers = array_merge($ConfigureColumns->get_headers(),$add_header);
//$notes=array_merge($notes,$visibletags->notes());
- $notes [] = "For information about the different columns please see the <b>node table layout</b> tab above";
+$notes [] = "For information about the different columns please see the <b>node table layout</b> tab above or <b>mouse over</b> the column headers";
$table=new PlekitTable('add_nodes',$headers,NULL, $table_options);
$form=new PlekitForm(l_actions(),
$table->cell ($label,array('class'=>$class));
$table->cell( ($node['node_type']=='reservable')?reservable_mark():"" );
+ //extra columns
+ $hostname=$node['hostname'];
+ $ip=$interface_hash[$node['node_id']]['ip'];
+ $interface_id=$interface_hash[$node['node_id']]['interface_id'];
+ $node['domain'] = topdomain($hostname);
+ $node['sitename'] = l_site_t($node['site_id'],$site_hash[$node['site_id']]);
+ $node['ipaddress'] = l_interface_t($interface_id,$ip);
+
//foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]);
$ConfigureColumns->cells($table, $node);