/**
* Load update page
*
* @return Nothing
*/
function loadUpdatePage() {
var repositoryDiv = $('
');
var rpmDiv = $('');
var statusDiv = createStatusBar("update");
statusDiv.hide();
$('#updateTab').append(repositoryDiv);
$('#updateTab').append(rpmDiv);
$('#updateTab').append(statusDiv);
var infoBar = createInfoBar('Select the Rpm and Repository, then press Update');
repositoryDiv.append(infoBar);
repositoryDiv.append("");
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'ostype'
},
success : showRepository
});
rpmDiv.append("");
$.ajax({
url: 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
},
success : showRpmInfo
});
}
/**
* Show the Rpm Repository, it can use user's last choice and input
*
* @return Nothing
*/
function showRepository(data) {
var DevelRepository = "";
var StableRepository = "";
var Show = "";
//get the corresponding repository by OS Type
if ("aix" == data.rsp)
{
DevelRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
StableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
}
else
{
DevelRepository = "http://xcat.sourceforge.net/yum/devel/xcat-core/";
StableRepository = "http://xcat.sourceforge.net/yum/xcat-core/";
}
//dispaly the Devel Repository, remember user's last selection
Show = Show + "";
Show = Show + DevelRepository + "(Devel) ";
$('#repository fieldset').append(Show);
//dispaly the Stable Repository, remember user's last selection
Show = "";
Show = Show + StableRepository + "(Stable) ";
$('#repository fieldset').append(Show);
//dispaly the Input Repository, remember user's last selection
if (($.cookie('xcatrepository'))
&& (1 != $.cookie('xcatrepository'))
&& (2 != $.cookie('xcatrepository')))
{
Show = "Other:";
Show += "";
}
else
{
Show = "Other:";
Show += "";
}
$('#repository fieldset').append(Show);
}
function showRpmInfo(data)
{
var Rpms = null;
var Show = "";
var RpmNames = new Array("xCAT-client","perl-xCAT","xCAT-server","xCAT","xCAT-rmc","xCAT-UI");
var temp = 0;
if(null == data.rsp)
{
$('#rpm fieldset').append("Get Rpm Info Error!");
return;
}
Rpms = data.rsp.split(/\n/);
//no rpm installed, return
if (1 > Rpms.length)
{
$('#rpm fieldset').append("No Rpm installed!");
return;
}
//clear the old data
$('#rpm fieldset').children().remove();
$('#rpm fieldset').append("");
Show = "
";
Show += "
";
Show += "
";
Show += "
Package Name
Version
";
Show += "
";
for (temp = 0; temp < Rpms.length; temp++)
{
//empty line continue
if ("" == Rpms[temp])
{
continue;
}
//the rpm is not installed, continue
if (-1 != Rpms[temp].indexOf("not"))
{
continue;
}
//show the version in table
Show += "