// Common functions
require_once 'plc_functions.php';
+require_once 'plc_peers.php';
require_once 'plc_minitabs.php';
require_once 'plc_tables.php';
$tabs['My nodes'] = array('url'=>l_nodes(),
'values'=>array('site_id'=>plc_my_site_id()),
'bubble'=>'Lists nodes on site ' . $mysite_id);
+$tabs['Local nodes'] = array ('url'=>l_nodes_peer('local'),
+ 'bubble' => 'Nodes local to this peer');
// --------------------
-$peer_filter=array();
$node_filter=array();
//////////////////
// fetch nodes
-$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id');
+$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id', "arch");
// server-side filtering - set pattern in $_GET for filtering on hostname
if ($pattern) {
$node_filter['hostname']=$pattern;
}
// server-side selection on peerscope
-list ( $peer_filter, $peer_label) = plc_peer_info($api,$_GET['peerscope']);
-$node_filter=array_merge($node_filter,$peer_filter);
+$peerscope=new PeerScope($api,$_GET['peerscope']);
+$node_filter=array_merge($node_filter,$peerscope->filter());
+$title .= ' - ' . $peerscope->label();
if ($site_id) {
$sites=$api->GetSites(array($site_id),array("name","login_base"));
"Hostname"=>"string",
"IP"=>"IPAddress",
"Type"=>"string",
+ "Arch"=>"string",
"?"=>"string",
- "Int"=>"int",
- "Float"=>"float");
+ );
# initial sort on hostnames
-plc_table_start("nodes",$headers,4);
+$table=new PlcTable ("nodes",$headers,4);
+$table->start();
-$peer_hash = plc_peer_global_hash ($api);
+$peers = new Peers ($api);
// write rows
-$fake1=1; $fake2=3.14; $fake_i=0;
foreach ($nodes as $node) {
$hostname=$node['hostname'];
$node_id=$node['node_id'];
$node_id=$node['node_id'];
$ip=$interface_hash[$node['node_id']]['ip'];
$interface_id=$interface_hash[$node['node_id']]['interface_id'];
- $shortname = plc_peer_shortname ($peer_hash,$node['peer_id']);
+ $peer_id=$node['peer_id'];
+ $shortname = $peers->shortname($peer_id);
$node_type = $node['node_type'];
- plc_table_row_start($hostname);
- plc_table_cell ($shortname);
- plc_table_cell (topdomain($hostname));
- plc_table_cell (l_site_t($site_id,$login_base));
- plc_table_cell ($node['boot_state']);
- plc_table_cell (l_node_t($node_id,$hostname));
- plc_table_cell (l_interface_t($interface_id,$ip));
- plc_table_cell ($node_type);
- plc_table_cell (node_status($node));
- plc_table_cell ($fake1);
- plc_table_cell ($fake2);
- plc_table_row_end();
+ $table->row_start();
+ $table->cell ($peers->link($peer_id,$shortname));
+ $table->cell (topdomain($hostname));
+ $table->cell (l_site_t($site_id,$login_base));
+ $table->cell ($node['boot_state']);
+ $table->cell (l_node_t($node_id,$hostname));
+ $table->cell (l_interface_t($interface_id,$ip));
+ $table->cell ($node_type);
+ $table->cell ($node['arch']);
+ $table->cell (node_status($node));
+ $table->row_end();
- if ($fake_i % 5 == 0) $fake1 += 3;
- if ($fake_i % 3 == 0) $fake2 +=5; else $fake2 -= $fake_i;
- $fake_i += 1;
}
-plc_table_end("nodes");
+$table->end();
// Print footer
include 'plc_footer.php';