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 '
Tips:
'; foreach ($tips as $tip) { echo "This interface is still under development -use accordingly.
Condition | +Response | +Node | +State | +
NodeReachability_H | +UpdatexCATNodeStatus | +hv8plus01.ppd.pok.ibm.com | +Not active | +
NodeReachability | +UpdatexCATNodeStatus | +hv8plus01.ppd.pok.ibm.com | +Not active | +
",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 <<