add status summary on nodes page

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10443 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
xq2005 2011-09-05 09:43:28 +00:00
parent 82a39b6179
commit cbcbda4e4c
3 changed files with 28 additions and 6 deletions

View File

@ -234,8 +234,8 @@ body {
}
.summarypie {
width: 370px;
height: 280px;
width: 260px;
height: 220px;
}
#summaryTab td{
@ -750,6 +750,7 @@ table a:hover {
font-size: 10px;
background: url(../images/nodes/bpa.jpg);
border-width: 2px;
text-align: left;
}
.fspDiv2 {

View File

@ -113,6 +113,7 @@ function loadNodesPage() {
function loadPieSummary(groupname){
var summaryTable = '<table style="border: 0px none;">' +
'<tr>' +
'<td><div id="statuspie" class="summarypie"></div></td>' +
'<td><div id="ospie" class="summarypie"></div></td>' +
'<td><div id="archpie" class="summarypie"></div></td>' +
'</tr>' +

View File

@ -52,7 +52,7 @@ sub process_request {
'updatevpd' => \&web_updatevpd,
'createimage' => \&web_createimage,
'provision' => \&web_provision,
'summary' => \&web_summay,
'summary' => \&web_summary,
'gangliashow' => \&web_gangliaShow,
'gangliacurrent' => \&web_gangliaLatest,
'rinstall' => \&web_rinstall
@ -1769,16 +1769,18 @@ sub web_infomsg {
return;
}
sub web_summay{
sub web_summary{
my ( $request, $callback, $sub_req ) = @_;
my $groupName = $request->{arg}->[1];
my @nodes;
my $nodetypeTab;
my $nodelistTab;
my $attrs;
my %oshash;
my %archhash;
my %provhash;
my %typehash;
my %statushash;
my $retHash = {};
my $temp;
#$groupName is undefined, use all nodes
@ -1795,6 +1797,11 @@ sub web_summay{
return;
}
$nodelistTab = xCAT::Table->new('nodelist');
unless($nodelistTab){
return;
}
$attrs = $nodetypeTab->getNodesAttribs(\@nodes, ['os','arch','provmethod','nodetype']);
unless($attrs){
return;
@ -1807,13 +1814,25 @@ sub web_summay{
web_attrcount($value->[0]->{'nodetype'},, \%typehash);
}
#os
$attrs = $nodelistTab->getNodesAttribs(\@nodes, ['status']);
while(my ($key, $value) = each(%{$attrs})){
web_attrcount($value->[0]->{'status'}, \%statushash);
}
#status
$temp = '';
while(my ($key, $value) = each(%statushash)){
$temp .= ($key . ':' . $value . ';');
}
$temp = substr($temp, 0, -1);
push(@{$retHash->{'data'}}, 'Status=' . $temp);
#os
$temp = '';
while(my ($key, $value) = each(%oshash)){
$temp .= ($key . ':' . $value . ';');
}
$temp = substr($temp, 0, -1);
push(@{$retHash->{'data'}}, 'OS=' . $temp);
push(@{$retHash->{'data'}}, 'Operating System=' . $temp);
#arch
$temp = '';
@ -1838,6 +1857,7 @@ sub web_summay{
}
$temp = substr($temp, 0, -1);
push(@{$retHash->{'data'}}, 'Node Type=' . $temp);
#return data
$callback->($retHash);
}