From 8b5dd1b4c9362fa57b343dcad0c4b7c817b5bc46 Mon Sep 17 00:00:00 2001 From: mxi1 Date: Tue, 9 Jun 2009 05:09:08 +0000 Subject: [PATCH] -ping tab is added; ping tab need the support of web.pm; git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3536 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-web/machines/groups.js | 5 ++- xCAT-web/machines/groups.php | 6 ++-- xCAT-web/machines/noderangetree.js | 3 ++ xCAT-web/machines/ping.php | 57 +++++++++++++++++++++++++++--- xCAT-web/machines/rpower.php | 24 +++++++++---- xCAT-web/machines/rvitals.php | 2 +- 6 files changed, 83 insertions(+), 14 deletions(-) diff --git a/xCAT-web/machines/groups.js b/xCAT-web/machines/groups.js index 2aedf687b..e5ca80f6c 100644 --- a/xCAT-web/machines/groups.js +++ b/xCAT-web/machines/groups.js @@ -7,7 +7,10 @@ $(document).ready(function(){ if (ui.tab.href.search('#rvitals-tab$') > -1) { loadVitalsTab($(ui.panel)); } if (ui.tab.href.search('#rpower-tab$') > -1) { loadRpowerTab($(ui.panel)); - } + } + if (ui.tab.href.search('#ping-tab$') > -1) { + loadPingTab($(ui.panel)); + } }}); // ends the properties passed to tabs() }); diff --git a/xCAT-web/machines/groups.php b/xCAT-web/machines/groups.php index d58ef1bca..ab68a67f6 100644 --- a/xCAT-web/machines/groups.php +++ b/xCAT-web/machines/groups.php @@ -7,7 +7,7 @@ require_once "$TOPDIR/lib/functions.php"; if (isAIX()) { $aixDisabled = 'disabled'; } insertHeader('xCAT Groups and Nodes', array("$TOPDIR/jq/jsTree/tree_component.css",'groups.css','attributes.css',"$TOPDIR/manage/dsh.css"), - array("$TOPDIR/jq/jsTree/css.js","$TOPDIR/jq/jsTree/jquery.listen.js","$TOPDIR/jq/jsTree/tree_component.js","$TOPDIR/jq/jquery.cookie.js",'noderangetree.js','groups.js','attributes.js','rvitals.js','rpower.js'), + array("$TOPDIR/jq/jsTree/css.js","$TOPDIR/jq/jsTree/jquery.listen.js","$TOPDIR/jq/jsTree/tree_component.js","$TOPDIR/jq/jquery.cookie.js",'noderangetree.js','groups.js','attributes.js','rvitals.js','rpower.js','ping.js'), array('machines','groups')); echo "
\n"; @@ -21,9 +21,10 @@ $tabs = array('Attributes' => '#attributes-tab', 'Run Cmd' => '../manage/dsh.php?intab=1', 'Rvitals' => '#rvitals-tab', 'Rpower' => '#rpower-tab', + 'Ping' => '#ping-tab', ); $tabsDisabled = array(//'Rpower' => 'rpower.php', - 'Ping' => 'ping.php', + //'Ping' => 'ping.php', 'Copy' => 'copyfiles.php', 'SP Config' => 'spconfig.php', 'Diagnose' => 'diagnode.php', @@ -43,6 +44,7 @@ echo "\n"; echo "
\n"; echo "
\n"; echo "
\n"; +echo "
\n"; echo "
\n"; diff --git a/xCAT-web/machines/noderangetree.js b/xCAT-web/machines/noderangetree.js index a56090cac..9eeca4e50 100644 --- a/xCAT-web/machines/noderangetree.js +++ b/xCAT-web/machines/noderangetree.js @@ -22,6 +22,9 @@ function updatenoderange() { if (index == 3) { loadRpowerTab($('#rpower-tab')); } + if (index == 4) { + loadPingTab($('#ping-tab')); + } } diff --git a/xCAT-web/machines/ping.php b/xCAT-web/machines/ping.php index 414bf0e0e..4542033cb 100644 --- a/xCAT-web/machines/ping.php +++ b/xCAT-web/machines/ping.php @@ -5,13 +5,62 @@ require_once "$TOPDIR/lib/functions.php"; //echo "\n"; //echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +//use the attributes.css for help +echo "\n"; -echo "
\n"; +echo << +body {font-size: 8pt; } + +CSS1; + +//Get the noderange +$noderange = @$_REQUEST['noderange']; +if(empty($noderange)) { echo "

Select one or more groups or nodes for ping.

\n"; exit; } + +//pping is one local command, which doesn't use xcat client/server protocol; +$xml = docmd('webrun',$noderange,array("pping $noderange",));#The default pping option is NULL + +if(getXmlErrors($xml,$errors)) { echo "

ping failed: ", implode(' ',$errors), "

\n"; exit; } + +//show the result of "pping" +//TODO +echo "

\n"; +echo << + +Node Name +Ping Status + +TAB1; +foreach ($xml->children() as $response) foreach ($response->children() as $o) { + $nodename=$o->name; + if(empty($nodename)) { + continue; + } + $contents = $o->data->contents; + //echo "$nodename: $contents
\n"; + echo "\n"; + echo "$nodename"; + echo "$contents"; + echo "\n"; + + //echo "$nodename: $contents
\n"; +} +echo << +TAB2; +echo "

\n"; + +//echo "\n"; //insertButtons(array('label' => 'Show Attributes', 'id' => 'attrButton', 'onclick' => '')); -echo "\n"; +//echo "\n"; // -insertNotDoneYet(); -?> \ No newline at end of file +//insertNotDoneYet(); +?> diff --git a/xCAT-web/machines/rpower.php b/xCAT-web/machines/rpower.php index 414305806..48518c341 100644 --- a/xCAT-web/machines/rpower.php +++ b/xCAT-web/machines/rpower.php @@ -5,7 +5,7 @@ require_once "$TOPDIR/lib/functions.php"; //echo "\n"; //echo "\n"; - +echo "\n"; //get the noderange $noderange = @$_REQUEST['noderange']; @@ -24,6 +24,13 @@ if (getXmlErrors($xml,$errors)) { //echo "

debug
";print_r($xml);echo "
debug end

\n"; echo '
'; echo "

"; +echo << + +Node Name +Rpower Status + +TAB1; foreach ($xml->children() as $response) foreach ($response->children() as $o) { $nodename = (string)$o->name; if(empty($nodename)) { @@ -33,15 +40,20 @@ foreach ($xml->children() as $response) foreach ($response->children() as $o) { $contents = (string)$data->contents; $desc = (string)$data->desc; - echo "$nodename: $contents
\n"; + echo "\n"; + echo "$nodename"; + echo "$contents"; + echo "\n"; + + //echo "$nodename: $contents
\n"; } + +echo << +TAB2; echo "

\n"; echo "
\n"; -//echo '
'; -//echo "

Rpower Actions

"; -//echo "
\n"; - //echo "
\n"; //insertButtons(array('label' => 'Show Attributes', 'id' => 'attrButton', 'onclick' => '')); diff --git a/xCAT-web/machines/rvitals.php b/xCAT-web/machines/rvitals.php index 595dd616f..6f4cd4162 100644 --- a/xCAT-web/machines/rvitals.php +++ b/xCAT-web/machines/rvitals.php @@ -27,7 +27,7 @@ foreach ($xml->children() as $response) foreach ($response->children() as $o) { $desc = (string)$data->desc; //echo "

"; print_r($data); echo "

\n"; echo "$nodename: $desc: $contents
\n"; - } +} echo "

\n";