diff --git a/xCAT-web/images/blade-front-blue.jpg b/xCAT-web/images/blade-front-blue.jpg index b7972542c..e12f15825 100644 Binary files a/xCAT-web/images/blade-front-blue.jpg and b/xCAT-web/images/blade-front-blue.jpg differ diff --git a/xCAT-web/images/blade-front-green.jpg b/xCAT-web/images/blade-front-green.jpg index 945ac8927..776a20138 100644 Binary files a/xCAT-web/images/blade-front-green.jpg and b/xCAT-web/images/blade-front-green.jpg differ diff --git a/xCAT-web/images/blade-front-red.jpg b/xCAT-web/images/blade-front-red.jpg index d0af03eae..49bd300fd 100644 Binary files a/xCAT-web/images/blade-front-red.jpg and b/xCAT-web/images/blade-front-red.jpg differ diff --git a/xCAT-web/images/blade-front-yellow.jpg b/xCAT-web/images/blade-front-yellow.jpg index be0a9c5db..82eab3272 100644 Binary files a/xCAT-web/images/blade-front-yellow.jpg and b/xCAT-web/images/blade-front-yellow.jpg differ diff --git a/xCAT-web/lib/GroupNodeTable.class.php b/xCAT-web/lib/GroupNodeTable.class.php index cbdb694f6..b20299f54 100644 --- a/xCAT-web/lib/GroupNodeTable.class.php +++ b/xCAT-web/lib/GroupNodeTable.class.php @@ -57,7 +57,7 @@ EOS; * @param String nodeGroup The group. */ function insertGroupTableRow($nodeGroupName, $status) { -$img_string = getStatusImage(GroupNodeTable::determineStatus($status)); +$img_string = getStatusImage(mapStatus($status)); //echo ''; echo ''; @@ -120,18 +120,5 @@ function getNodeTableRow($nodeName, $attrs) { return $html; } -/** - * @param String nodestatStr The status of the node as output by the nodestat command - * @return "good", "bad", "warning", or "unknown" - */ -function determineStatus($statStr) { - $status = NULL; - if ($statStr == "alive" || $statStr == "ready" || $statStr == "pbs" || $statStr == "sshd") { $status = "good"; } - else if ($statStr == "noping") { $status = "bad"; } - else if ($statStr == "ping") { $status = "warning"; } - else { $status = "unknown"; } - return $status; -} - } // end the class ?> diff --git a/xCAT-web/lib/functions.php b/xCAT-web/lib/functions.php index c9882dffd..27f1e48d4 100644 --- a/xCAT-web/lib/functions.php +++ b/xCAT-web/lib/functions.php @@ -55,8 +55,8 @@ echo "\n"; echo << - - + + EOS; @@ -64,7 +64,7 @@ EOS; insertMenus($currents); -echo "\n"; +echo "\n"; //echo "\n"; // end the top div } // end insertHeader @@ -132,7 +132,7 @@ $MENU = array( 'manpages' => array('label' => 'Man Pages', 'url' => getDocURL('manpage')), 'maillist' => array('label' => 'Mail List', 'url' => getDocURL('web','mailinglist')), 'wiki' => array('label' => 'Wiki', 'url' => getDocURL('web','wiki')), - 'suggest' => array('label' => 'Suggestions', 'url' => "$TOPDIR/support/suggest.php"), + 'suggest' => array('label' => 'Suggest', 'url' => "$TOPDIR/support/suggest.php"), 'about' => array('label' => 'About', 'url' => "$TOPDIR/support/about.php"), ) ), @@ -145,7 +145,7 @@ $MENU = array( function insertMenus($currents) { global $TOPDIR; global $MENU; - echo "\n"; + echo "
\n"; insertMenuRow($currents[0], 1, $MENU); @@ -160,13 +160,15 @@ function insertMenus($currents) { function insertMenuRow($current, $isTop, $items) { global $TOPDIR; //$img = "$TOPDIR/images/h3bg_new.gif"; - $menuRowClass = $isTop ? '' : 'class=MenuRowBottom'; - $menuItemClass = $isTop ? 'class=MenuItemTop' : ''; - $currentClass = $isTop ? 'class=CurrentMenuItemTop' : ''; + //$menuRowClass = $isTop ? '' : 'class=MenuRowBottom'; + $menuItemClass = $isTop ? '' : 'class=MenuItemBottom'; + //$currentClass = $isTop ? 'class=CurrentMenuItemTop' : ''; //echo "\n"; //echo "
\n"; - echo "
  • $label

  • "; + //echo "
  • $label

  • "; + //echo "
  • $label

  • "; + //echo "

    $label

    "; + echo "$label"; } else { //echo "\n"; - echo "
  • $label
  • "; + //echo "
  • $label
  • "; + echo "$label"; } } //echo "\n"; //echo "\n"; - echo "\n\n"; + //echo "\n\n"; + echo "\n\n"; } @@ -471,76 +478,125 @@ function getDocURL($book, $section = NULL) { } +$HWTypeInfo = array ( + 'x335' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8676' ), + 'x336' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8837' ), + 'x306' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8836' ), + 'x306m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8849,8491' ), + 'x3550' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7978' ), + 'e325' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8835' ), + 'e326' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8848' ), + 'e326m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7969' ), + 'e327' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'' ), + 'x3250' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'4190,4194' ), + 'x3350' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'4192,4193,hmc' ), # just guessed about hmc + 'x3450' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7948' ), + 'x3455' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7940,ipmi,xseries,default' ), + 'x3550' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7978' ), + + 'x340' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8656' ), + 'x342' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8669' ), + 'x345' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8670' ), + 'x346' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8840' ), + 'x3650' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'7979' ), + 'x3655' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'7943' ), + + 'x360' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8686' ), + 'x365' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8862' ), + 'x366' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8863' ), + 'x445' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), + 'x450' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), + 'x455' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), + 'x460' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), + + 'x3755' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>4, 'aliases'=>'7163,8877' ), + 'x3850' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>4, 'aliases'=>'7141,7233' ), + 'x3950' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>4, 'aliases'=>'' ), # 7141,7233 + + 'hs20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8678,8843,7981,blade' ), # removed 8832 because it is older and it made this entry to wide in the drop down boxes + 'hs12' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8014,8028' ), + 'hs21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'7995,8853' ), + 'js20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8842' ), + 'js12' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'799860X' ), + 'js21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8844,7998J21' ), + 'js22' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'799861X' ), + 'qs21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'0792' ), + 'qs22' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'0793' ), + 'ls20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8850' ), + 'ls21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'7971' ), + 'ls22' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'7901' ), + 'hs40' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'8839' ), + 'ls41' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'7972' ), + 'ls42' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'7902' ), + + # POWER 4 servers + 'p610' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7028' ), + 'p615' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'7029' ), + 'p630' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'' ), # 7026 + 'p640' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7026' ), + 'p650' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>8, 'aliases'=>'7038' ), + 'p655' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7039' ), + 'p670' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'' ), # 7040 + 'p690' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7040' ), + + # OpenPOWER servers + 'p710' => array ( 'image'=>'342.gif', 'rackimage'=>'x335-front', 'u'=>2, 'aliases'=>'9123' ), + 'p720' => array ( 'image'=>'520.gif', 'rackimage'=>'x345-front', 'u'=>4, 'aliases'=>'9124' ), + + # POWER 5 servers + 'p5-505' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'' ), # 9115 + 'p5-505Q' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'9115' ), + + 'p5-510' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9110' ), + 'p5-510Q' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'' ), # 9110 + 'p5-575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9118' ), + + 'p5-520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9111' ), + 'p5-520Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9131' ), + 'p5-550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9113' ), + 'p5-550Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9133' ), + 'p5-560' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9116' ), + 'p5-560Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'' ), # 9116 + 'p5-570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'' ), # 9117 + + 'p5-590' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'' ), # 9119 + 'p5-595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'' ), # 9119 + + # POWER 6 servers + '520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8203' ), + '550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8204' ), + '570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9117' ), + '575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9125' ), + '595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ), + ); + + //----------------------------------------------------------------------------- // This returns important display info about each type of hardware, so we can easily add new hw types. -function getHWTypeInfo($hwtype, $attr) { - //todo: get the aliases to be keys in this hash too - $hwhash = array ( - 'x335' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8676' ), - 'x336' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8837' ), - 'x306' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8836' ), - 'x306m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8849,8491' ), - 'x3550' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7978' ), - 'e325' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8835' ), - 'e326' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8848' ), - 'e326m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7969' ), - 'e327' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'' ), +function getHWTypeInfo($hwtype, $attr=NULL) { +global $HWTypeInfo; - 'x340' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8656' ), - 'x342' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8669' ), - 'x345' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8670' ), - 'x346' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8840' ), - 'x3650' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'7979' ), +// Get the aliases defined as keys, if we have not done that yet +if (!array_key_exists('9119',$HWTypeInfo)) { + $keys = array_keys($HWTypeInfo); // make a copy of the keys, because we will be adding some in the loop below + foreach ($keys as $key) { + $value = $HWTypeInfo[$key]; + if (array_key_exists('aliases',$value) && !empty($value['aliases'])) { + $aliases = explode(',', $value['aliases']); + foreach ($aliases as $a) { + if (array_key_exists($a,$HWTypeInfo)) { msg('W', "Internal warning: Duplicate alias in HWTypeInfo array: $a"); } + else { $HWTypeInfo[$a] = $value; } + } + } + } +} - 'x360' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8686' ), - 'x365' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8862' ), - 'x366' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8863' ), - 'x3850' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8863' ), - 'x445' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), - 'x450' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), - 'x455' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), - 'x460' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), - 'x3950' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ), - - 'hs20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8678,8843,7981' ), # removed 8832 because it is older and it made this entry to wide in the drop down boxes - 'js20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8842' ), - 'js21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8844' ), - 'ls20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8850' ), - 'hs40' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'8839' ), - - 'p5-505' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'9115' ), - 'p5-505Q' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'9115' ), - - 'p5-510' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9110' ), - 'p5-510Q' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9110' ), - 'p5-575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9118' ), - - 'p5-520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9111' ), - 'p5-520Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9131' ), - 'p5-550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9113' ), - 'p5-550Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9133' ), - 'p5-560' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9116' ), - 'p5-560Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9116' ), - 'p5-570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9117' ), - - 'p5-590' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ), - 'p5-595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ), - - 'p710' => array ( 'image'=>'342.gif', 'rackimage'=>'x335-front', 'u'=>2, 'aliases'=>'9123' ), - 'p720' => array ( 'image'=>'520.gif', 'rackimage'=>'x345-front', 'u'=>4, 'aliases'=>'9124' ), - - 'p610' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7028' ), - 'p615' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'7029' ), - 'p630' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'7026' ), - 'p640' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7026' ), - 'p650' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>8, 'aliases'=>'7038' ), - 'p655' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7039' ), - 'p670' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7040' ), - 'p690' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7040' ), - ); - $info = $hwhash[strtolower($hwtype)]; - if (isset($attr)) { return $info[$attr]; } - else { return $info; } +// Now return the info requested +$k = strtolower($hwtype); +if (!array_key_exists($k,$HWTypeInfo)) { return NULL; } +$info = $HWTypeInfo[$k]; +if (isset($attr)) { return $info[$attr]; } +else { return $info; } } @@ -549,19 +605,57 @@ function getHWTypeInfo($hwtype, $attr) { function getHWTypeImage($hwtype, $powermethod) { # 1st try to match the hw type $info = getHWTypeInfo($hwtype, 'image'); - if ($info) { return $info['image']; } + if (!empty($info)) { return $info; } # No matches yet. Use the power method to get a generic type. if (isset($powermethod)) { - $powermethod = strtolower($powermethod); - if ($powermethod == 'blade') { return getHWTypeInfo('hs20', 'image'); } - elseif ($powermethod == 'hmc') { return getHWTypeInfo('p5-520', 'image'); } - elseif ($powermethod == 'bmc') { return getHWTypeInfo('x335','image'); } - elseif ($powermethod == 'xseries') { return getHWTypeInfo('x335', 'image'); } + $info = getHWTypeInfo($powermethod, 'image'); + if (!empty($info)) { return $info; } } # As a last resort, return the most common node image - return getHWTypeInfo('x335', 'image'); + return getHWTypeInfo('default', 'image'); +} + + +//----------------------------------------------------------------------------- +// Map the many possible values of nodelist.status into one of four: good, bad, warning, unknown +//todo: update this list from Lings new status work +function mapStatus($statStr) { + $status = NULL; + if ($statStr == "alive" || $statStr == "ready" || $statStr == "pbs" || $statStr == "sshd") { $status = "good"; } + else if ($statStr == "noping" || $statStr=='unreachable') { $status = "bad"; } + else if ($statStr == "ping") { $status = "warning"; } + else { $status = "unknown"; } + return $status; +} + + +//----------------------------------------------------------------------------- +// For 2 status strings from nodestat or nodelist.status, return the "lowest" (worst). +// Use this function when trying to aggregate multiple status values into one. +//todo: update this list from Lings new status work +function minStatus($s1, $s2) { + $statnum = array( 'unknown' => 0, + 'unreachable' => 1, + 'noping' => 1, + 'ping' => 2, + 'snmp' => 3, + 'sshd' => 4, + 'pbs' => 5, + 'ready' => 6, + 'alive' => 6, + ); + + // if either value is empty, just return the other one + if (!isset($s1)) { return $s2; } + if (!isset($s2)) { return $s1; } + + // if either value does not map into the hash, then return unknown + if (!isset($statnum[$s1]) || !isset($statnum[$s2])) { return 'unknown'; } + + if ($statnum[$s1] < $statnum[$s2]) { return $s1; } + else { return $s2; } } @@ -599,13 +693,16 @@ function getNodes($noderange, $attrs) { //my ($hostname, $type, $osname, $distro, $version, $mode, $status, $conport, $hcp, $nodeid, $pmethod, $location, $comment) = split(/:\|:/, $na); //$nodes[] = array('hostname'=>"node$i.cluster.com", 'type'=>'x3655', 'osname'=>'Linux', 'distro'=>'RedHat', 'version'=>'4.5', 'status'=>1, 'conport'=>$i, 'hcp'=>"node$i-bmc.cluster.com", 'nodeid'=>'', 'pmethod'=>'bmc', 'location'=>"frame=1 u=$", 'comment'=>''); $nodes = array(); + if (empty($noderange)) { $nodrange = '/.*'; } //$xml = docmd('nodels',$noderange,implode(' ',$attrs)); $xml = docmd('nodels',$noderange,$attrs); - $output = $xml->xcatresponse->children(); // technically, we should iterate over the xcatresponses, because there can be more than one - foreach ($output as $o) { + //$output = $xml->xcatresponse->children(); // technically, we should iterate over the xcatresponses, because there can be more than one + //foreach ($output as $o) { + foreach ($xml->children() as $response) foreach ($response->children() as $o) { $nodename = (string)$o->name; $data = $o->data; $attrval = (string)$data->contents; + if (empty($attrval)) { continue; } $attrname = (string)$data->desc; //echo "

    $attrname = $attrval

    \n"; //echo "

    "; print_r($nodename); echo "

    \n"; diff --git a/xCAT-web/lib/style.css b/xCAT-web/lib/style.css index 62d1f7ee4..1d07940c2 100644 --- a/xCAT-web/lib/style.css +++ b/xCAT-web/lib/style.css @@ -3,10 +3,11 @@ /* background-color: #002432; */ } -.TopTop { background: #FFF url(../images/toptop.jpg) repeat-x top; } -.TopMiddle { background: #FFF url(../images/top2.jpg) repeat-x top; padding-top: 1px; } +.TopMiddle { background: #FFF url(../images/top2.jpg) repeat-x top; } /* +.TopTop { background: #FFF url(../images/toptop.jpg) repeat-x top; } + #top { margin: 0 auto 10px auto; padding: 0; @@ -29,91 +30,102 @@ */ #xcatImage { - /* float: left; */ - margin: 10px 8px 5px 0px; - /* height: 30px; todo: create a smaller icon instead of scaling this on the fly */ + margin: 3px 8px 5px 0px; } -.MenuRowBottom { /* this is to help with the white border around the current menu items */ - border-left: 2px solid white; - border-right: 2px solid white; + +/* The next 7 (or so) classes are for the menu at the top of each window. + See lib/functions.php insertMenus() for the code that uses these. */ + +.MenuTable { /* the table that holds all the menu items */ + padding-top: 2px; + font-family: Sans-Serif; + font-size: 8pt; + font-weight: bold; + margin: 0px; +} +.MenuTable TR { padding-top: 0px; } /* avoid the inheritance */ + +.CurrentMenuItem { /* the menu items that are currently selected */ + display: inline-block; /* display: block; */ + padding: 0 1em; /*2em;*/ + background: #0F5B7F; /*#116893;*/ /* #0B4360; #09334b; */ + color: white; /* #fafafa; */ + border-left: 1px solid #273942; + line-height: 2.15em; /*2.5em;*/ } -#mainNav { /* the UL that contains the LIs of one row of menu items */ - /* position: absolute; - float: left; */ +.MenuTable a { /* the non-current menu items */ + display: inline-block; /* display: block; */ + /* float: left; IE/Mac 5.2 Fix */ + padding: 0 1em; /*2em;*/ + text-decoration: none; + color: #a1a1a1; + border-left: 1px solid #273942; + cursor: pointer; + line-height: 2.15em; /*2.5em;*/ +} + +.MenuTable a:hover { /* when the mouse is over a non-current menu item */ + background: #0F5B7F; /*#116893;*/ /* #0B4360; #09334b; */ + color: white; /* #fafafa; */ +} + +.MenuItemBottom { /* the non-current LIs in the bottom row */ + /* border-bottom: 2px solid white; */ + background-color: #0F5B7F; /*#116893;*/ + } + +/* The rest of these menu-related styles are not used... + +#mainNav { the UL that contains the LIs of one row of menu items list-style: none; margin: 0px; padding: 0px; } -#mainNav li { /* each menu item */ - /* float: left; */ - /* Start: cross-browser inline-block */ - display: -moz-inline-stack; /* firefox specific */ - display: inline-block; /* the right way (standards compliant browsers) */ - zoom: 1; /* internet explorer specific */ - *display: inline; /* internet explorer specific */ - /* End: cross-browser inline-block */ - line-height: 2.15em; /*2.5em;*/ +#mainNav li { each menu item + Start cross-browser inline-block + display: -moz-inline-stack; firefox specific + display: inline-block; the right way (standards compliant browsers) + zoom: 1; internet explorer specific + *display: inline; internet explorer specific + End cross-browser inline-block + line-height: 2.15em; font-weight: bold; - /* border: 1px solid white; */ } -#mainNav p { /* the LIs that are currently selected */ - display: block; - padding: 0 2em; /*2em;*/ - margin: 0px; - background: #0B4360; /* #09334b; */ - color: #fafafa; +IE/Win 5.x Fix +* html #mainNav a { + width: 1px; } -.CurrentMenuItemTop { /* additional style for the current LI in the top menu row */ +#mainNav li a.active { not sure if this is needed + color: white; +} + +.MenuRowBottom { this is to help with the white border around the current menu items + border-left: 2px solid white; + border-right: 2px solid white; +} + +.CurrentMenuItemTop { additional style for the current LI in the top menu row border-left: 2px solid white; border-top: 2px solid white; border-right: 2px solid white; - /* border-bottom: 2px solid #09334b; */ + background-color: #0F5B7F; } -.MenuItemTop { /* the non-current LIs in the top row */ - /* border-top: 2px solid black; */ +.MenuItemTop { the non-current LIs in the top row border-bottom: 2px solid white; } -#mainNav a { /* the non-current menu items */ - display: block; - /* float: left; IE/Mac 5.2 Fix */ - padding: 0 2em; /*2em;*/ - text-decoration: none; - color: #a1a1a1; - border-left: 1px solid #273942; - cursor: pointer; -} - -/* IE/Win 5.x Fix -* html #mainNav a { - width: 1px; -} */ - -#mainNav a:hover { - background: #0B4360; /* #09334b; */ - color: #fafafa; -} - -/* body.home #mainNav a#home, body.tutorials #mainNav a#tutorials { background: #09334b; color: #fafafa; cursor: default; } -*/ -#mainNav li a.active { - color: #fafafa; - -} - -/* div#content { background-color : #fcfaeb; position: absolute; @@ -155,6 +167,8 @@ BODY { } IMG { vertical-align: middle; } +.ImgBaseline { vertical-align: baseline; } +.ImgTop { vertical-align: top; } INPUT {vertical-align : middle; font-size : 8pt; font-family : sans-serif; font-weight : bold;} SELECT {vertical-align : middle; font-size : 8pt; font-family : sans-serif; font-weight : bold;} TEXTAREA {vertical-align : middle; font-size : 8pt; font-family : sans-serif; font-weight : bold;} diff --git a/xCAT-web/machines/frames.css b/xCAT-web/machines/frames.css new file mode 100644 index 000000000..7c8c217f1 --- /dev/null +++ b/xCAT-web/machines/frames.css @@ -0,0 +1,19 @@ + +/* Styles specific to the frames.php page */ + +.AllRacksTable { padding-top: 10px; } + +.RackTable { + background-color: #303030; + border: 2px solid #303030; +} + +.RackTable TD { + white-space: nowrap; + font-size: 1px; +} + +.RackTable IMG { vertical-align: baseline; } + +.RackEmptyCell { background-color: #999999; } + diff --git a/xCAT-web/machines/frames.js b/xCAT-web/machines/frames.js new file mode 100644 index 000000000..2df405a57 --- /dev/null +++ b/xCAT-web/machines/frames.js @@ -0,0 +1,109 @@ +// Javascript functions needed by the frames (racks) page, mostly +// to handle the check boxes that are actually images. + +function imageCBClick(image, mode) +{ +if (mode==1 || (mode==2 && (image.checked === undefined || !image.checked))) { + image.src = '../images/checked-box.gif'; + image.checked = true; +} else { + image.src = '../images/unchecked-box.gif'; + image.checked = false; + var s=image.alt.split(/-/); + var rackCB = document.frameForm['selAll'+s[0]+'Checkbox']; + rackCB.checked = false; +} +} + + +function selectAll(element, rack) // element is the select all checkbox, rack is the rack # +{ + var sel = element.checked; + for (var i=0; i < document.images.length; i++) { + var image = document.images[i]; + if (image.src.search(/checked-box\.gif$/)>-1 && image.alt.search('^'+rack+'-')>-1) { imageCBClick(image,sel); } + } +} + +/* +function isNodeSelected(form) +{ +if (document.paramForm.rack.checked) { return (form.Nodes.value.length>0 || form.rackNodes.value.length>0); } +// we only continue here if it is the non-rack display +for(var i = 0; i < form.length; i++) + { + var e = form.elements[i]; + if (e.type == "checkbox" && e.name.search(/^node\d/) > -1 && e.checked) { return true; } + } +return false; +} + +function numNodesSelected(form) +{ +if (document.paramForm.rack.checked) { + if (form.Nodes.value.length>0) { return 2; } // just have to guess that the group or range has more than 1 + var val = form.rackNodes.value; + var matches = val.match(/,/g); + if (!matches) { return (val.length>0 ? 1 : 0); } + else { return matches.length + 1; } +} +// we only continue here if it is the non-rack display +var j = 0; +for(var i = 0; i < form.length; i++) + { + var e = form.elements[i]; + if (e.type == "checkbox" && e.name.search(/^node\d/) > -1 && e.checked) + { + if (++j == 2) { return j; } + } + } +return j; +} + +function gatherRackNodes(form) +{ + if (allSelected(form)) { + if (document.paramForm.nodeRange.value.length > 0) { form.Nodes.value = document.paramForm.nodeRange.value; } + else { form.Nodes.value = '+' + document.paramForm.nodegrps.value; } + form.rackNodes.value=''; + return; + } + else { form.Nodes.value=''; } + if (!document.paramForm.rack.checked) { form.rackNodes.value=''; return; } + + var nodes=''; + for (var i=0; i < document.images.length; i++) { + var image = document.images[i]; + if (image.checked) { var s=image.alt.split(/-/); nodes += s[1] + ','; } + } + form.rackNodes.value = nodes.replace(/,$/, ''); +} + +function allSelected(form) +{ +if (document.paramForm.rack.checked) { + for(var i = 0; i < form.length; i++) + { + var e = form.elements[i]; + if (e.type=="checkbox" && e.name.search(/^selAll\d+Checkbox/)>-1 && !e.checked) { return false; } + } + return true; +} +else { return form.selAllCheckbox.checked; } // non-rack display +} + +function frameFormSubmit(form) { +gatherRackNodes(form); +if (form.nodesNeeded === undefined || form.nodesNeeded == 2) { // need 1 or more nodes + if (isNodeSelected(form)) { return true; } + else { alert('Select one or more nodes before pressing an action button.'); return false; } +} +else if (form.nodesNeeded == 1) { // need exactly 1 node + if (numNodesSelected(form) == 1) { return true; } + else { alert('Exactly one node must be selected for this action.'); form.nodesNeeded=undefined; return false; } +} +else if (form.nodesNeeded == 0) { return true; } // 0 or more nodes is ok +else { return true; } +} +*/ + diff --git a/xCAT-web/machines/frames.php b/xCAT-web/machines/frames.php index ff4888994..99d3b5d51 100644 --- a/xCAT-web/machines/frames.php +++ b/xCAT-web/machines/frames.php @@ -2,353 +2,168 @@ /* session_start(); */ $TOPDIR = '..'; require_once "$TOPDIR/lib/functions.php"; -insertHeader('xCAT Frame Node List', NULL, NULL, array('machines','frames')); +insertHeader('xCAT Frames and Nodes', array('frames.css'), array('frames.js'), array('machines','frames')); if (isAIX()) { $aixDisabled = 'disabled'; } -insertNotDoneYet(); -echo ''; -/* This was copied from the csm web interface and can be used as the beginning code - for the frame view. - - -
    -

    -

    Node List on Management Server

    - -
    - - - - - - - - - - - -
    -

    Which Nodes:

    -
     Group:  or  Node Range:
    - Show Nodes in Racks (have to first set the physical location)
    -
    - - -
    - - - - - - - - - - - \n"; -echo "\n"; -echo "\n"; -$index =0; -?> - -

    Node
    Actions:

    - - - - -
    - - - - - - - -
    - - - - -
    - - - - - - - - -
    -
    - -
    Select All   NameHW TypeOSModeStatusHW Ctrl PtComment
    \n" ?> - - - - - - - -
    - -

    Tips:

    -
      -
    • Select 1 or more nodes & click on an action button.  Or choose - 1 of the main tasks on the left.  The Help link at the top left really does help.  It describes what all these buttons do. -
    • The Status colors:  green=reachable, red=not reachable, yellow=unknown/error, blue=node not managed. -
    • If too many nodes are displayed, use the Group or Node Range selections - to focus what is displayed. -
    • The Console/Settings link at the top left is the way to set preferences.  There is a verbose - option there to have this interface display the commands it is running. -
    • If you are running this over a phone line, we recommend using the Old Webmin theme (which is now the default) for faster loading.  Of course, the MSC Linux theme looks nicer.  (If you change the theme, you will have to navigate - back to this page in the Cluster category.) -
    • Did you know you can run as many browser windows with this interface as - you want?  This can be handy to view information from multiple pages of this interface - at the same time. -
    -

    CSM Version: $rpmVersions{'csm.server'}       CSM Web Interface Version: $rpmVersions{'xcsm.web'}

    -
    - - + ?> diff --git a/xCAT-web/machines/groups.php b/xCAT-web/machines/groups.php index 45ace52eb..f671e18f9 100644 --- a/xCAT-web/machines/groups.php +++ b/xCAT-web/machines/groups.php @@ -8,7 +8,7 @@ if (isAIX()) { $aixDisabled = 'disabled'; } require_once("$TOPDIR/lib/GroupNodeTable.class.php"); -insertHeader('Groups', array('groups.css'), +insertHeader('xCAT Groups and Nodes', array('groups.css'), array("$TOPDIR/lib/GroupNodeTableUpdater.js","$TOPDIR/js/prototype.js","$TOPDIR/js/scriptaculous.js?load=effects"), array('machines','groups')); @@ -100,7 +100,7 @@ function getGroupStatus() { preg_match('/^"([^"]*)"/', $rest, $status); if (count($status) < 2) { $status[1] = 'unknown'; } foreach ($grplist as $g) { - if (array_key_exists($g,$groups)) { $groups[$g] = minstat($groups[$g], $status[1]); } + if (array_key_exists($g,$groups)) { $groups[$g] = minStatus($groups[$g], $status[1]); } else { $groups[$g] = $status[1]; } } } @@ -109,28 +109,4 @@ function getGroupStatus() { } -//----------------------------------------------------------------------------- -// For 2 status strings from nodestat or nodelist.status, return the "lowest". -function minstat($s1, $s2) { - $statnum = array( 'unknown' => 0, - 'noping' => 1, - 'ping' => 2, - 'snmp' => 3, - 'sshd' => 4, - 'pbs' => 5, - 'ready' => 6, - ); - - // if either value is empty, just return the other one - if (!isset($s1)) { return $s2; } - if (!isset($s2)) { return $s1; } - - // if either value does not map into the hash, then return unknown - if (!isset($statnum[$s1]) || !isset($statnum[$s2])) { return 'unknown'; } - - if ($statnum[$s1] < $statnum[$s2]) { return $s1; } - else { return $s2; } -} - - ?> \ No newline at end of file