diff --git a/xCAT-UI/js/loading.js b/xCAT-UI/js/loading.js index e54093343..78d065467 100644 --- a/xCAT-UI/js/loading.js +++ b/xCAT-UI/js/loading.js @@ -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 diff --git a/xCAT-UI/js/xcat.js b/xCAT-UI/js/xcat.js index 1700ceccb..a9b778918 100644 --- a/xCAT-UI/js/xcat.js +++ b/xCAT-UI/js/xcat.js @@ -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'); diff --git a/xCAT-UI/lib/monitor_display.php b/xCAT-UI/lib/monitor_display.php index f094a3339..4d251f06b 100644 --- a/xCAT-UI/lib/monitor_display.php +++ b/xCAT-UI/lib/monitor_display.php @@ -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 '
'; + echo ''; return 0; } @@ -75,7 +75,7 @@ function displayDialog($id, $title) function displayMonTable() { //create one table to display the monitoring plugins' list - echo '
'; + echo '
'; echo << @@ -124,14 +124,14 @@ function display_stat_mon_table($args) echo << -Node Status Application Monitoring +Node Status Monitoring TOS2; insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")")); echo ''; echo ''; echo ''; - echo 'Application Status Application Monitoring'; + echo 'Application Status Monitoring'; echo ''; insertbuttons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'')); echo ''; @@ -144,4 +144,78 @@ function displayStatus() //tell the user that the current interface is not done yet... echo "

This interface is still under development -use accordingly.

"; } + +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 << +$(init_ositree()); + +
+EOS3; +} + +function displayAssociation() +{ + echo '
'; +echo <<Available Condition/Response Associations + + + + + + + + + +TOS5; + //$xml = docmd("webrun", "", array("lscondresp")); + //if(getXmlErrors($xml,$errors)) { + //echo "

",implode(' ', $errors), "

"; + //exit; + //} + //get all the condition&response associations for RMC +echo << + + + + + + + + + + + + + +
ConditionResponseNodeState
NodeReachability_HUpdatexCATNodeStatushv8plus01.ppd.pok.ibm.comNot active
NodeReachabilityUpdatexCATNodeStatushv8plus01.ppd.pok.ibm.comNot active
+
+TOS6; + return 0; +} + +function displayCond($noderange) +{ + //the user selects one node/noderange from the #ositree div + echo '
'; + echo 'Available Conditions'; + + echo '
'; + return 0; +} + +function displayResp() +{ + echo '
'; + echo 'Available Response'; + echo '
'; + return 0; +} + ?> diff --git a/xCAT-UI/monitor/control_node_stat.php b/xCAT-UI/monitor/control_node_stat.php index 721711e87..8a36de6c5 100644 --- a/xCAT-UI/monitor/control_node_stat.php +++ b/xCAT-UI/monitor/control_node_stat.php @@ -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 "

",implode(' ', $errors), "

"; -// exit; -// } -// -//}else if($action == 'disable') { -// //chtab name=$name monitoring.nodestatmon='' -// $xml=docmd("chtab",' ', array("name=$name","monitoring.nodestatmon=\'\'")); -// if(getXmlErrors($xml,$errors)) { -// echo "

",implode(' ', $errors), "

"; -// 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 "

",implode(' ', $errors), "

"; + 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 "

",implode(' ', $errors), "

"; + exit; + } +} echo "successful"; ?> diff --git a/xCAT-UI/monitor/monstart.php b/xCAT-UI/monitor/monstart.php new file mode 100644 index 000000000..25c3e5eeb --- /dev/null +++ b/xCAT-UI/monitor/monstart.php @@ -0,0 +1,19 @@ + diff --git a/xCAT-UI/monitor/osi_source.php b/xCAT-UI/monitor/osi_source.php new file mode 100644 index 000000000..c3bdb95f8 --- /dev/null +++ b/xCAT-UI/monitor/osi_source.php @@ -0,0 +1,45 @@ +",implode(' ', $errors), "

"; + 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 << diff --git a/xCAT-UI/monitor/rmc_event_define.php b/xCAT-UI/monitor/rmc_event_define.php new file mode 100644 index 000000000..e678c9108 --- /dev/null +++ b/xCAT-UI/monitor/rmc_event_define.php @@ -0,0 +1,41 @@ + + +'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(); +?> + +
+ + +
+ +'Next', id=>'next', 'onclick'=>'')); + +?> diff --git a/xCAT-UI/monitor/stat_mon.php b/xCAT-UI/monitor/stat_mon.php index 80d3313b9..2b1cf2954 100644 --- a/xCAT-UI/monitor/stat_mon.php +++ b/xCAT-UI/monitor/stat_mon.php @@ -13,34 +13,6 @@ require_once "$TOPDIR/lib/monitor_display.php"; //get the name of the selected plug-in $name = $_REQUEST['name']; -?> - - -'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()')); ?>