diff --git a/xCAT-UI/js/monitor/xcatmon.js b/xCAT-UI/js/monitor/xcatmon.js index 61bff5438..f12f0447d 100644 --- a/xCAT-UI/js/monitor/xcatmon.js +++ b/xCAT-UI/js/monitor/xcatmon.js @@ -338,6 +338,7 @@ function loadXcatMonSetting(data){ var tableName="monsetting"; var tmp; var tmp1; + var closeBtn=createButton("close"); // get the contain of the rows for (var i =0; i< dRows.length;i++){ @@ -414,8 +415,16 @@ function loadXcatMonSetting(data){ //tmp=otherCont.length; //tmp1=newCont; setDatatable(XcatmonTableId,dTable); - + // create the save dialog + var dialogSave=$('
saving the configuration
'); + dialogSave.append(createLoader()); + addBar.append(dialogSave); + // open the dialog..modal is true + $("#saveDialog").dialog({modal: true}); + // hide the cross... + $('.ui-dialog-titlebar-close').hide(); + // pot the table name and the contain to the tabRestore.php $.ajax({ type : 'POST', @@ -426,10 +435,18 @@ function loadXcatMonSetting(data){ cont : newCont }, success : function (data){ - alert('changes saved'); + // empty the dialog.add the close button + $("#saveDialog").empty().append('

The Configure has saved!

'); + $("#saveDialog").append(closeBtn); } }); + // close button function + closeBtn.bind('click',function(event){ + $("#saveDialog").dialog("distroy"); + $("#saveDialog").remove(); + + }); // clear the newCont newCont=null; diff --git a/xCAT-server/lib/xcat/plugins/web.pm b/xCAT-server/lib/xcat/plugins/web.pm index 75b8cce65..edf49a455 100644 --- a/xCAT-server/lib/xcat/plugins/web.pm +++ b/xCAT-server/lib/xcat/plugins/web.pm @@ -55,12 +55,8 @@ sub process_request { 'gangliacheck' => \&web_gangliacheck, 'mkcondition' => \&web_mkcondition, 'monls' => \&web_monls, - 'writeframe' => \&web_writeframe, - 'writecec' => \&web_writecec, - 'writehmc' => \&web_writehmc, 'discover' => \&web_discover, 'updatevpd' => \&web_updatevpd, - 'updatesite' => \&web_updatesite #'xdsh' => \&web_xdsh, #THIS list needs to be updated ); @@ -983,244 +979,6 @@ sub web_monls(){ $ret = substr($ret, 0, length($ret) - 1); $callback->({data=>$ret}); } -sub web_opentables{ - my %tableHash; - my $tempNameArray = shift @_; - foreach my $tableName (@$tempNameArray){ - $tableHash{$tableName} = xCAT::Table->new($tableName); - if (!($tableHash{$tableName})){ - web_closetables(\%tableHash); - return undef; - } - } - return \%tableHash; -} - -sub web_closetables{ - my $tempHash = shift @_; - foreach my $tab (keys %$tempHash){ - if ($tempHash->{$tab}){ - $tempHash->{$tab}->close(); - } - } -} - -sub web_writegroup{ - my($groupType, $groupName, $condition) = @_; - my $ngtab = xCAT::Table->new('nodegroup', -autocommit=>0); - if (!$ngtab) { - return; - } - - if('static' eq $groupType){ - $ngtab->setAttribs({groupname => $groupName}, {grouptype => 'static', members => 'static'}); - } - else{ - foreach my $t(@$groupName){ - $ngtab->setAttribs({groupname => "${t}nodes"}, {grouptype => 'dynamic', members => 'dynamic', wherevals => "$condition$t" }); - } - } - - $ngtab->commit(); - $ngtab->close(); -} -#------------------------------------------------------- - -=head3 web_writehmc - - Description : work for cluster setup wizard, write hmc into nodelist, ppc, site table - Arguments : hmcnamerange - Returns : Nothing - -=cut - -#------------------------------------------------------- -sub web_writehmc{ - my ( $request, $callback, $sub_req ) = @_; - my $hmcNameRange = $request->{arg}->[1]; - - #connect all used tables; - my $tablePoint = web_opentables(['nodelist', 'ppc', 'site']); - if (!$tablePoint){ - $callback->({data=>'Error: Connect tables failed!'}); - return; - } - - my @names = xCAT::NodeRange::noderange($hmcNameRange, 0); - if (scalar(@names) < 1){ - $callback->({data=>'Error: node range input error!'}); - web_closetables($tablePoint); - return; - } - - web_writegroup('static', 'hmc', ''); - for my $tempName (@names){ - $tablePoint->{'nodelist'}->setNodeAttribs($tempName, {groups => 'hmc,all'}); - $tablePoint->{'ppc'}->setNodeAttribs($tempName, {nodetype => 'hmc'}); - } - - $tablePoint->{'site'}->setAttribs({key => 'ea_primary_hmc'}, {value => $names[0]}); - if (scalar(@names) > 2){ - $tablePoint->{'site'}->setAttribs({key => 'ea_backup_hmc'}, {value => $names[1]}); - } - - web_closetables($tablePoint); - $callback->({data=>'Success: Write all HMCs into xCAT database!'}); -} -#------------------------------------------------------- - -=head3 web_writeframe - - Description : work for cluster setup wizard, write frame into nodelist, ppc, nodehm table - the command is "webrun writeframe framename hmc/dfm hmcname framenumperhmc" - Arguments : nodegroupname, management method(hmc or dfm) - Returns : Nothing - -=cut - -#------------------------------------------------------- -sub web_writeframe{ - my ( $request, $callback, $sub_req ) = @_; - my $frameNameRange = $request->{arg}->[1]; - my $hmcFlag = $request->{arg}->[2]; - my $framenumperhmc; - my @hmcNames; - my $tempname = ''; - my $id = 0; - my $index = 0; - - if ('hmc' eq $hmcFlag){ - my $hmcName = $request->{arg}->[3]; - $framenumperhmc = $request->{arg}->[4] + 0; - unless ($framenumperhmc){ - $callback->({data=>'Error: frame number per hmc is error!'}); - return; - } - @hmcNames = xCAT::NodeRange::noderange($hmcName, 0); - } - - #open nodelist, ppc and nodehm table for update or add - my $tablePoint = web_opentables(['nodelist', 'ppc', 'nodehm']); - unless ($tablePoint){ - $callback->({data=>'Error: Connect tables failed!'}); - return; - } - - web_writegroup('static', 'frame', ''); - - my %nodelistHash; - my %nodehmHash; - my %ppcHash; - - #expand the node range and set attributes in database. - my @frameNames = xCAT::NodeRange::noderange($frameNameRange, 0); - foreach $tempname (@frameNames){ - #find it's id - if ($tempname =~ /\S+?(\d+)$/){ - $id = $1; - } - else{ - $id++; - } - $ppcHash{$tempname}{'id'} = $id; - $ppcHash{$tempname}{'nodetype'} = 'frame'; - - if ('hmc' eq $hmcFlag){ - $nodehmHash{$tempname}{'mgt'} = 'hmc'; - $ppcHash{$tempname}{'hcp'} = $hmcNames[int($index / $framenumperhmc)]; - } - else{ - $nodehmHash{$tempname}{'mgt'} = 'bpa'; - $ppcHash{$tempname}{'hcp'} = $tempname; - } - $nodelistHash{$tempname}{'groups'} = 'frame,all'; - $index++; - } - - $tablePoint->{'nodelist'}->setNodesAttribs(\%nodelistHash); - $tablePoint->{'ppc'}->setNodesAttribs(\%ppcHash); - $tablePoint->{'nodehm'}->setNodesAttribs(\%nodehmHash); - - web_closetables($tablePoint); - $callback->({data=>'Success: Write all Frames into xCAT database!'}); -} - -#------------------------------------------------------- - -=head3 web_writecec - - Description : work for cluster setup wizard, write cec into nodelist, ppc, nodehm table - command is "webrun writecec frameNameRange hmc/dfm cecNameRange cecnumperframe" - Arguments : nodegroupname, management method(hmc or dfm), cecname, cecnumperframe - Returns : Nothing - -=cut - -#------------------------------------------------------- -sub web_writecec{ - my ( $request, $callback, $sub_req ) = @_; - my $frameNameRange = $request->{arg}->[1]; - my $hmcFlag = $request->{arg}->[2]; - my $cecNameRange = $request->{arg}->[3]; - my $cecnumperframe = $request->{arg}->[4];; - my @frameNames = xCAT::NodeRange::noderange($frameNameRange, 0); - my @cecNames = xCAT::NodeRange::noderange($cecNameRange, 0); - my $tempname = ''; - my $index = 0; - - unless ($cecnumperframe){ - $callback->({data=>'Error: cec number per frame is error!'}); - return; - } - - #open nodelist, ppc and nodehm table for update or add - my $tablePoint = web_opentables(['nodelist', 'ppc', 'nodehm', 'nodepos']); - unless ($tablePoint){ - $callback->({data=>'Error: Connect tables failed!'}); - return; - } - - web_writegroup('static', 'cec', ''); - web_writegroup('dynamic', \@cecNames, 'parent=='); - - my %ppcHash; - my %nodelistHash; - my %nodehmHash; - my %nodeposHash; - - foreach $tempname (@cecNames){ - my $tempFrameid = int($index / $cecnumperframe) + 1; - my $tempCageid = 5 + ($index % $cecnumperframe) * 2; - my $parentName = $frameNames[$tempFrameid]; - $nodelistHash{$tempname}{'groups'} = 'cec,all'; - if ('hmc' eq $hmcFlag){ - $nodehmHash{$tempname}{'mgt'} = 'hmc'; - my $parentHcp = $tablePoint->getNodeAttribs($parentName, ['hcp']); - if ($parentHcp && $parentHcp->{'hcp'}){ - $ppcHash{$tempname}{'hcp'} = $parentHcp->{'hcp'}; - } - } - else{ - $nodehmHash{$tempname}{'mgt'} = 'cec'; - $ppcHash{$tempname}{'hcp'} = $tempname; - } - - $ppcHash{$tempname}{'id'} = $tempCageid; - $ppcHash{$tempname}{'parent'} = $parentName; - - $nodeposHash{$tempname} = {'rack' => $tempFrameid, 'u' =>$tempCageid}; - - $index++; - } - - $tablePoint->{'nodelist'}->setNodesAttribs(\%nodelistHash); - $tablePoint->{'ppc'}->setNodesAttribs(\%ppcHash); - $tablePoint->{'nodehm'}->setNodesAttribs(\%nodehmHash); - $tablePoint->{'nodepos'}->setNodesAttribs(\%nodeposHash); - - web_closetables($tablePoint); - $callback->({data=>'Success: Write all CECs into xCAT database!'}); -} sub web_discover{ my ( $request, $callback, $sub_req ) = @_; @@ -1269,20 +1027,4 @@ sub web_updatevpd{ $vpdtab->close(); } -sub web_updatesite{ - my ( $request, $callback, $sub_req ) = @_; - my @valuePair = split(/:/, $request->{arg}->[1]); - - my $sitetab = xCAT::Table->new('site'); - unless($sitetab){ - return; - } - - foreach my $temp (@valuePair){ - my @keyvalue = split(/,/, $temp); - $sitetab->setAttribs({key => @keyvalue[0]}, {value => @keyvalue[1] }); - } - - $sitetab->close(); -} 1; \ No newline at end of file