6 require_once 'plc_login.php';
8 // Get session and API handles
9 require_once 'plc_session.php';
13 require_once 'plc_drupal.php';
14 include 'plc_header.php';
17 require_once 'plc_functions.php';
18 require_once 'linetabs.php';
19 require_once 'table.php';
20 require_once 'details.php';
21 require_once 'toggle.php';
23 // --------------------
24 // recognized URL arguments
25 $nodegroup_id=intval($_GET['id']);
26 if ( ! $nodegroup_id ) { plc_error('Malformed URL - id not set'); return; }
29 // Get all columns as we focus on only one entry
30 $nodegroups= $api->GetNodeGroups( array($nodegroup_id));
32 if (empty($nodegroups)) {
33 drupal_set_message ("NodeGroup " . $nodegroup_id . " not found");
37 $nodegroup=$nodegroups[0];
38 $node_ids=$nodegroup['node_ids'];
39 $tagname=$nodegroup['tagname'];
41 # fetch corresponding nodes
42 $node_columns = array("hostname","node_id");
44 $nodes = $api->GetNodes( $node_ids, $node_columns);
49 $tabs []= tab_nodegroups();
50 $tabs []= tab_nodes_local();
52 drupal_set_title("Details for node group " . $nodegroup['groupname']);
53 plekit_linetabs($tabs);
55 $toggle=new PlekitToggle('details','Details');
57 $details=new PlekitDetails(plc_is_admin());
59 $details->form_start(l_actions(),array("action"=>"update-nodegroup", "nodegroup_id"=>$nodegroup_id));
60 $details->th_td ("Node group name",$nodegroup['groupname'],'groupname');
61 // can't change the target tag
62 $details->th_td ("Based on tag",href(l_tag($nodegroup['tag_type_id']),$tagname));
63 $details->th_td("Matching value",$nodegroup['value'],'value');
64 $details->th_td("# nodes",count($nodegroup['node_ids']));
65 $details->tr_submit("submit","Update Nodegroup");
71 // xxx : add & delete buttons would make sense here too
72 $toggle=new PlekitToggle('nodes',"Nodes");
75 $headers["Hostname"]="string";
77 $table = new PlekitTable("nodegroup_nodes",$headers,0,array('search_width'=>15));
79 if ($nodes) foreach ($nodes as $node) {
81 $table->cell ( href (l_node ($node['node_id']),$node['hostname']));
88 //plekit_linetabs ($tabs,"bottom");
91 include 'plc_footer.php';