/**
* Load update page
*
* @return Nothing
*/
function loadUpdatePage() {
var repositoryDiv = $('
');
var rpmDiv = $('');
var statusDiv = createStatusBar("update");
statusDiv.hide();
$('#updateTab').append(statusDiv);
$('#updateTab').append(' ');
$('#updateTab').append(repositoryDiv);
$('#updateTab').append(rpmDiv);
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
*
* @param data
* Data returned from HTTP request
* @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/";
}
var repoList = $('');
// display the Devel Repository, remember user's last selection
Show = Show + "
";
Show = Show + DevelRepository + "(Devel)
";
repoList.append(Show);
// display the Stable Repository, remember user's last selection
Show = "
";
Show = Show + StableRepository + "(Stable)
";
repoList.append(Show);
// display the Input Repository, remember user's last selection
if (($.cookie('xcatrepository')) && (1 != $.cookie('xcatrepository')) && (2 != $.cookie('xcatrepository'))) {
Show = "
Other: ";
Show += "";
} else {
Show = "
Other: ";
Show += "";
}
repoList.append(Show);
$('#repository fieldset').append(repoList);
}
/**
* Show all xCAT RPMs
*
* @param data
* Data returned from HTTP request
* @return Nothing
*/
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 += "