the webpages for "define rmc events" and "monstart" are added; and update the css and js code to main.css and xcat.js
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3947 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -105,10 +105,10 @@ var xStart = function(){ | ||||
|      myBar.addScript("hoverIntent.js");   | ||||
|      myBar.addScript("superfish.js");   | ||||
|      myBar.addScript("jquery-ui-all.min.js");   | ||||
|      myBar.addScript("xcat.js");   | ||||
|      myBar.addScript("xcat.js"); | ||||
|      myBar.addScript("xcatauth.js");   | ||||
|      myBar.addScript("config.js");   | ||||
|      myBar.addScript("jquery.tablesorter.js");   | ||||
|      myBar.addScript("jquery.tablesorter.js"); | ||||
|      myBar.run();   | ||||
| };   | ||||
| //Called on click reset button   | ||||
|   | ||||
| @@ -327,5 +327,59 @@ function changeProf(){ | ||||
| 	} // so yeah, all these }'s and )'s really suck.  I hope you never have to | ||||
| 		// debug this.  If you do, please make this code easier to read. | ||||
| } | ||||
|  | ||||
| //added for display the tree for | ||||
| function init_ositree(){ | ||||
|     //display all the nodes with OSI type | ||||
|     nrtree = new tree_component();  //-tree begin | ||||
|     nrtree.init($("#ositree"),{ | ||||
|         rules: { multiple: "Ctrl" }, | ||||
|         ui: { animation: 250 }, | ||||
|         data : { | ||||
|             type: "json", | ||||
|             async: "true", | ||||
|             url: "monitor/osi_source.php" | ||||
|         } | ||||
|     }); | ||||
| } | ||||
|  | ||||
| //node_stat_control() can enable/disable nodestatmon for the selected plugin | ||||
| function node_stat_control(plugin) | ||||
| { | ||||
|     //get the label of the button | ||||
|     var action = $("#node_stat span").text(); | ||||
|     if(action=='Enable') { | ||||
|         //enable node_stat_monitor | ||||
|         $.get("monitor/control_node_stat.php",{name:plugin, action:"enable"},function(data) { | ||||
|             if(data=='successful') { | ||||
|                 //change the label to "Disable" | ||||
|                 $("#node_stat span").text("Disable"); | ||||
|             } | ||||
|         }); | ||||
|     }else if(action=='Disable') { | ||||
|         //disable node_stat_monitor | ||||
|         $.get("monitor/control_node_stat.php",{name:plugin, action:"disable"},function(data) { | ||||
|             if(data=='successful') { | ||||
|                 //change the label to "enable" | ||||
|                 $("#node_stat span").text("Enable"); | ||||
|             } | ||||
|         }) | ||||
|         //then, change the label to "Enable"" | ||||
|     } | ||||
| } | ||||
|  | ||||
| function goto_next() | ||||
| { | ||||
|     var str = location.href; | ||||
|     var plugin=str.slice(str.indexOf("name")+5);//get the argument from "?name=xxxxx" | ||||
|     if(plugin == "rmcmon") { | ||||
|         loadMainPage("monitor/rmc_event_define.php"); | ||||
|     }else { | ||||
|         //TODO | ||||
|         //for the others, there's no web page to define evnets/performance now' | ||||
|         loadMainPage("monitor/monstart.php?name="+plugin); | ||||
|     } | ||||
| } | ||||
|  | ||||
| // load progress bar | ||||
| myBar.loaded('xcat.js'); | ||||
|   | ||||
| @@ -56,12 +56,12 @@ function displayTips($tips) | ||||
|     //  "Click the name of each plugin, you can get the plugin's description.", | ||||
|     //  "You can also select one plugin, then you can set node/application status monitoring for the selected plugin.", | ||||
|     //} | ||||
|     echo '<div><ul align="left" id="tips"><h3>Tips:</h3>'; | ||||
|     echo '<div id="tips"><p><b>Tips:</b></p>'; | ||||
|     foreach ($tips as $tip) { | ||||
|         echo "<li>$tip</li>"; | ||||
|         echo "\n"; | ||||
|     } | ||||
|     echo '</ul></div>'; | ||||
|     echo '</div>'; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| @@ -75,7 +75,7 @@ function displayDialog($id, $title) | ||||
| function displayMonTable() | ||||
| { | ||||
|     //create one table to display the monitoring plugins' list | ||||
|     echo '<div style="margin-right:30px;width:auto;margin-left:30px;">'; | ||||
|     echo '<div id="monlist_table">'; | ||||
|     echo <<<TOS1 | ||||
| <table id="tabTable" class="tabTable" cellspacing="1"> | ||||
|     <thead> | ||||
| @@ -124,14 +124,14 @@ function display_stat_mon_table($args) | ||||
| echo <<<TOS2 | ||||
| <table cellspacing="1" class="tabTable" id="tabTable"><tbody> | ||||
| <tr class="ListLine0"> | ||||
| <td>Node Status Application Monitoring</td> | ||||
| <td>Node Status Monitoring</td> | ||||
| <td> | ||||
| TOS2; | ||||
|     insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")")); | ||||
|     echo '</td>'; | ||||
|     echo '</tr>'; | ||||
|     echo '<tr class="ListLine1">'; | ||||
|     echo '<td>Application Status Application Monitoring</td>'; | ||||
|     echo '<td>Application Status Monitoring</td>'; | ||||
|     echo '<td>'; | ||||
|     insertbuttons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'')); | ||||
|     echo '</td>'; | ||||
| @@ -144,4 +144,78 @@ function displayStatus() | ||||
|     //tell the user that the current interface is not done yet... | ||||
|     echo "<div><p>This interface is still under development -use accordingly.</p></div>"; | ||||
| } | ||||
|  | ||||
| function displayOSITree() | ||||
| { | ||||
|     //display the node range tree, but only with the nodes with OSI type | ||||
|     //this follows the function displayNrTree(); | ||||
|     //it doesn't work on firefox!!! | ||||
| echo <<<EOS3 | ||||
| <script type="text/javascript"> | ||||
| $(init_ositree()); | ||||
| </script> | ||||
| <div id=ositree></div> | ||||
| EOS3; | ||||
| } | ||||
|  | ||||
| function displayAssociation() | ||||
| { | ||||
|     echo '<div id="association">'; | ||||
| echo <<<TOS5 | ||||
| <b>Available Condition/Response Associations</b> | ||||
| <table id="tabTable" class="tabTable" cellspacing="1"> | ||||
|     <thead> | ||||
|         <tr class="colHeaders"> | ||||
|             <td>Condition</td> | ||||
|             <td>Response</td> | ||||
|             <td>Node</td> | ||||
|             <td>State</td> | ||||
|         </tr> | ||||
|     </thead> | ||||
| TOS5; | ||||
|     //$xml = docmd("webrun", "", array("lscondresp")); | ||||
|     //if(getXmlErrors($xml,$errors)) { | ||||
|         //echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
|         //exit; | ||||
|     //} | ||||
|     //get all the condition&response associations for RMC | ||||
| echo <<<TOS6 | ||||
| <tbody> | ||||
| <tr class="ListLine0"> | ||||
| <td>NodeReachability_H</td> | ||||
| <td>UpdatexCATNodeStatus</td> | ||||
| <td>hv8plus01.ppd.pok.ibm.com</td> | ||||
| <td>Not active</td> | ||||
| </tr> | ||||
| <tr class="ListLine1"> | ||||
| <td>NodeReachability</td> | ||||
| <td>UpdatexCATNodeStatus</td> | ||||
| <td>hv8plus01.ppd.pok.ibm.com</td> | ||||
| <td>Not active</td> | ||||
| </tr> | ||||
| </tbody> | ||||
| </table> | ||||
| </div> | ||||
| TOS6; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| function displayCond($noderange) | ||||
| { | ||||
|     //the user selects one node/noderange from the #ositree div | ||||
|     echo '<div id="avail_cond">'; | ||||
|     echo '<b>Available Conditions</b>'; | ||||
|      | ||||
|     echo '</div>'; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| function displayResp() | ||||
| { | ||||
|     echo '<div id="avail_resp">'; | ||||
|     echo '<b>Available Response</b>'; | ||||
|     echo '</div>'; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| ?> | ||||
|   | ||||
| @@ -14,23 +14,25 @@ require_once "$TOPDIR/lib/monitor_display.php"; | ||||
| $name = $_REQUEST['name']; | ||||
| $action = $_REQUEST['action']; | ||||
|  | ||||
| //TODO: right now, we can't change the contents of the xcat tables through xcatd | ||||
| //if($action == 'enable') { | ||||
| //    //chtab name=$name monitoring.nodestatmon='yes' | ||||
| //    $xml=docmd("chtab",' ',array("name=$name","monitoring.nodestatmon=\'yes\'")); | ||||
| //    if(getXmlErrors($xml, $errors)) { | ||||
| //        echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
| //        exit; | ||||
| //    } | ||||
| // | ||||
| //}else if($action == 'disable') { | ||||
| //    //chtab name=$name monitoring.nodestatmon='' | ||||
| //    $xml=docmd("chtab",' ', array("name=$name","monitoring.nodestatmon=\'\'")); | ||||
| //    if(getXmlErrors($xml,$errors)) { | ||||
| //        echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
| //        exit; | ||||
| //    } | ||||
| //} | ||||
| //TODO: | ||||
| //right now, we can only go through "webrun" command to run the local command through xcatd | ||||
| //specially for enable/disable node status monitoring, what I can do is to edit the table "monitoring" | ||||
| //This method is not suitable! | ||||
| if($action == 'enable') { | ||||
|     //chtab name=$name monitoring.nodestatmon='yes' | ||||
|     $xml=docmd("webrun",'',array("chtab name=$name monitoring.nodestatmon=1")); | ||||
|     if(getXmlErrors($xml, $errors)) { | ||||
|         echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
|         exit; | ||||
|     } | ||||
| }else if($action == 'disable') { | ||||
|     //chtab name=$name monitoring.nodestatmon='' | ||||
|     $xml=docmd("webrun",'', array("chtab name=$name monitoring.nodestatmon=no")); | ||||
|     if(getXmlErrors($xml,$errors)) { | ||||
|         echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
|         exit; | ||||
|     } | ||||
| } | ||||
|  | ||||
| echo "successful"; | ||||
| ?> | ||||
|   | ||||
							
								
								
									
										19
									
								
								xCAT-UI/monitor/monstart.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								xCAT-UI/monitor/monstart.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?php | ||||
| /*  | ||||
|  * monstart.php | ||||
|  * to display the web page for the command "monstart" and the command "monstop" for the selected plugins | ||||
|  * the link looks like "monitor/monstart.php?name=rmcmon". | ||||
|  */ | ||||
| if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";} | ||||
|  | ||||
| require_once "$TOPDIR/lib/security.php"; | ||||
| require_once "$TOPDIR/lib/functions.php"; | ||||
| require_once "$TOPDIR/lib/display.php"; | ||||
| require_once "$TOPDIR/lib/monitor_display.php"; | ||||
|  | ||||
| $name = $_REQUEST['name']; | ||||
|  | ||||
| echo $name; | ||||
| return 0; | ||||
|  | ||||
| ?> | ||||
							
								
								
									
										45
									
								
								xCAT-UI/monitor/osi_source.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								xCAT-UI/monitor/osi_source.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| <?php | ||||
| /*  | ||||
|  * osi_source.php | ||||
|  * to provide the JSON-style data to the function init_ositree(); | ||||
|  */ | ||||
|  | ||||
| if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";} | ||||
|  | ||||
| require_once "$TOPDIR/lib/functions.php"; | ||||
| require_once "$TOPDIR/lib/security.php"; | ||||
| require_once "$TOPDIR/lib/display.php"; | ||||
| require_once "$TOPDIR/js/jsonwrapper.php"; | ||||
|  | ||||
| //get all the groups | ||||
| $xml=docmd("lsdef","",array("-t", "group")); | ||||
| if(getXmlErrors($xml,$errors)) { | ||||
|     echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
|     exit; | ||||
| } | ||||
| $groups = array(); | ||||
| $jdata = array(); | ||||
| foreach($xml->children() as $response) foreach($response->children() as $data) { | ||||
|     //all the groups are stored into $groups | ||||
|     //TODO | ||||
|     array_push($groups, $data); | ||||
| } | ||||
| //foreach($groups as $group) { | ||||
|     //$xml = docmd("lsdef","",array("-t", "node", "-w", "nodetype=~osi")) | ||||
| //} | ||||
| //print_r($groups); | ||||
|  | ||||
| //echo json_encode($jdata); | ||||
| echo <<<TOS3 | ||||
| [ | ||||
| {"data":"all","attributes":{ | ||||
|     "id":",all","rel":"group" | ||||
|     },"state":"closed" | ||||
| }, | ||||
| {"data":"another","attributes":{ | ||||
|     "id":",another","rel":"group" | ||||
|     },"state":"open" | ||||
| } | ||||
| ] | ||||
| TOS3; | ||||
| ?> | ||||
							
								
								
									
										41
									
								
								xCAT-UI/monitor/rmc_event_define.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								xCAT-UI/monitor/rmc_event_define.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| <?php | ||||
| /*  | ||||
|  * rmc_event_define.php | ||||
|  * to define the events for RMC | ||||
|  * the url is: monitor/rmc_event_define.php? | ||||
|  */ | ||||
| if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";} | ||||
|  | ||||
| require_once "$TOPDIR/lib/security.php"; | ||||
| require_once "$TOPDIR/lib/functions.php"; | ||||
| require_once "$TOPDIR/lib/display.php"; | ||||
| require_once "$TOPDIR/lib/monitor_display.php"; | ||||
|  | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <?php | ||||
| displayMapper_mon(array('home'=>'main.php', 'monitor'=>'monitor/monlist.php')); | ||||
|  | ||||
| displayTips(array( | ||||
|         "All the conditions and the responses are here;", | ||||
|         "Use \"mkcondition\" and \"mkresponse\" to create new conditions and new responses", | ||||
|         "Select the noderange, select the condition, and the response,", | ||||
|         "then, click \"Save\" to create condition/response associations." | ||||
|         )); | ||||
| displayOSITree(); | ||||
| ?> | ||||
|  | ||||
| <div id="condresp"> | ||||
|      | ||||
| <?php | ||||
| displayAssociation(); | ||||
| displayCond("hv8plus06"); | ||||
| displayResp(); | ||||
| ?> | ||||
| </div> | ||||
|  | ||||
| <?php | ||||
| insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>'')); | ||||
|  | ||||
| ?> | ||||
| @@ -13,34 +13,6 @@ require_once "$TOPDIR/lib/monitor_display.php"; | ||||
| //get the name of the selected plug-in | ||||
| $name = $_REQUEST['name']; | ||||
|  | ||||
| ?> | ||||
| <script type="text/javascript"> | ||||
| function node_stat_control(plugin) | ||||
| { | ||||
|     //get the label of the button | ||||
|     var action = $("#node_stat span").text(); | ||||
|     if(action=='Enable') { | ||||
|         //enable node_stat_monitor | ||||
|         $.get("monitor/control_node_stat.php",{name:plugin, action:"enable"},function(data) { | ||||
|             if(data=='successful') { | ||||
|                 //change the label to "Disable" | ||||
|                 $("#node_stat span").text("Disable"); | ||||
|             } | ||||
|         }); | ||||
|     }else if(action=='Disable') { | ||||
|         //disable node_stat_monitor | ||||
|         $.get("monitor/control_node_stat.php",{name:plugin, action:"disable"},function(data) { | ||||
|             if(data=='successful') { | ||||
|                 //change the label to "enable" | ||||
|                 $("#node_stat span").text("Enable"); | ||||
|             } | ||||
|         }) | ||||
|         //then, change the label to "Enable"" | ||||
|     } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <?php | ||||
| displayMapper_mon(array('home'=>'main.php', 'monitor'=>'monitor/monlist.php')); | ||||
| displayTips(array( | ||||
|     "Enable/disable Node/App Status Monitoring by clicking the button", | ||||
| @@ -70,5 +42,5 @@ display_stat_mon_table(array("$name"=> | ||||
|  | ||||
| displayStatus(); | ||||
|  | ||||
| insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>'')); | ||||
| insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>'goto_next()')); | ||||
| ?> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user