From 149a9e7a2c64e2fd0c5b253a9ef62b08b51f3fea Mon Sep 17 00:00:00 2001 From: mxi1 Date: Wed, 29 Jul 2009 06:07:58 +0000 Subject: [PATCH] Follow Vallard's advice, I moved all the codes to the new file" lib/monitor_display.php"; now, the file "monitor.php" only contains and jQuery code. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3893 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/lib/monitor_display.php | 101 ++++++++++++++++++++++++++++++++ xCAT-UI/monitor/monlist.php | 78 ++++++------------------ xCAT-UI/monitor/stat_mon.php | 11 +++- 3 files changed, 130 insertions(+), 60 deletions(-) create mode 100644 xCAT-UI/lib/monitor_display.php diff --git a/xCAT-UI/lib/monitor_display.php b/xCAT-UI/lib/monitor_display.php new file mode 100644 index 000000000..1863890c9 --- /dev/null +++ b/xCAT-UI/lib/monitor_display.php @@ -0,0 +1,101 @@ + code related with monitor interface is put here. + */ +function displayMapper_mon($mapper) +{ + //display the Mapper for monitoring interface; + //the argument $mapper is an array + //$mapper = { + // "home" => "main.php", + // "Monitor" => "monitor/monlist.php", + //}; + echo "
"; + echo ""; + foreach ($mapper as $key => $value) { + echo "$key"; + echo "/"; + } + echo "
"; +} + +#displayMonitorLists() will generate all the monitoring plug-ins, +#the user can select the plug-ins he wants to operate on, +#and press the "Next" button; + function displayMonitorLists() { + #The command "monls -a" is used to get the monitoring plug-ins list + $xml = docmd("monls"," ", array('-a')); + if(getXmlErrors($xml,$errors)) { + echo "

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

"; + exit; + } + #then, parse the xml data + $ooe = 0; + $line = 0; + foreach($xml->children() as $response) foreach($response->children() as $data) { + list($name, $stat, $nodemonstatus) = preg_split("/\s+/", $data); + $ooe = $ooe%2; + echo ""; + echo ""; + echo "$name"; + echo "$stat"; + if(isset($nodemonstatus)) { echo "Yes";}else {echo "No";} + echo " "; + $ooe++; + $line++; + //echo "$name$stat$name"; + } + return 0; + } + +function displayTips($tips) +{ + //to tell the user how to operate on the current web page + //the argument $tips is an array like this: + //{ + // "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 '
'; + return 0; +} + +function displayDialog($id, $title) +{ + //add one new
to display jQuery dialog; + echo "
"; + return 0; +} + +function displayMonTable() +{ + //create one table to display the monitoring plugins' list + echo '
'; + echo << + + + + Plug-in Name + Status + Node Status Monitoring + + +TOS1; + echo ''; + displayMonitorLists(); + echo "
"; + return 0; +} + +function displayStatus() +{ + //tell the user that the current interface is not done yet... + echo "

This interface is still under development -use accordingly.

"; +} +?> diff --git a/xCAT-UI/monitor/monlist.php b/xCAT-UI/monitor/monlist.php index 5906fa196..82e003df8 100644 --- a/xCAT-UI/monitor/monlist.php +++ b/xCAT-UI/monitor/monlist.php @@ -3,35 +3,8 @@ 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"; -#displayMonitorLists() will generate all the monitoring plug-ins, -#the user can select the plug-ins he wants to operate on, -#and press the "Next" button; - function displayMonitorLists() { - #The command "monls -a" is used to get the monitoring plug-ins list - $xml = docmd("monls"," ", array('-a')); - if(getXmlErrors($xml,$errors)) { - echo "

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

"; - exit; - } - #then, parse the xml data - $ooe = 0; - $line = 0; - foreach($xml->children() as $response) foreach($response->children() as $data) { - list($name, $stat, $nodemonstatus) = preg_split("/\s+/", $data); - $ooe = $ooe%2; - echo ""; - echo ""; - echo "$name"; - echo "$stat"; - if(isset($nodemonstatus)) { echo "Yes";}else {echo "No";} - echo " "; - $ooe++; - $line++; - //echo "$name$stat$name"; - } - return 0; - } ?> -
- - home / - Monitor - -
-
-
    -

    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
  • -
-
-
- - - - - - - - - - - - -
Plug-in NameStatusNode Status Monitoring
-
-
-
+'main.php', 'monitor'=>'monitor/monlist.php')); -
'Next', 'id'=> 'next', 'onclick' => 'loadMainPage("monitor/stat_mon.php")'))?>
+displayTips(array("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")); + +displayMonTable(); + +displayDialog("dialog", "Plug-in Description"); +insertButtons(array('label' => 'Next', 'id'=> 'next', 'onclick'=>'clickNext()')); +?> diff --git a/xCAT-UI/monitor/stat_mon.php b/xCAT-UI/monitor/stat_mon.php index 1f469e7f8..734e7f777 100644 --- a/xCAT-UI/monitor/stat_mon.php +++ b/xCAT-UI/monitor/stat_mon.php @@ -3,5 +3,14 @@ * This web page is for "Node status Monitoring" and "Application Status Monitioring", * The user can enable/disable "Node/Application Status Monitoring" from this page. */ -echo "

This page is under development.

"; +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"; + + +displayStatus(); + ?>