From cbcbda4e4c44cc2034c5975e9fea11de9c874514 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 5 Sep 2011 09:43:28 +0000 Subject: [PATCH] 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 --- xCAT-UI/css/style.css | 5 +++-- xCAT-UI/js/nodes/nodes.js | 1 + xCAT-server/lib/xcat/plugins/web.pm | 28 ++++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css index d1117c89b..65c11cbad 100644 --- a/xCAT-UI/css/style.css +++ b/xCAT-UI/css/style.css @@ -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 { diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index eaa6c50d2..17e73e21a 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -113,6 +113,7 @@ function loadNodesPage() { function loadPieSummary(groupname){ var summaryTable = '' + '' + + '' + '' + '' + '' + diff --git a/xCAT-server/lib/xcat/plugins/web.pm b/xCAT-server/lib/xcat/plugins/web.pm index 11a32f22b..acf10a62e 100644 --- a/xCAT-server/lib/xcat/plugins/web.pm +++ b/xCAT-server/lib/xcat/plugins/web.pm @@ -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); }