/**
* 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 repository to use and the RPMs to update, then click 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("Error getting RPMs!");
return;
}
rpms = data.rsp.split(/\n/);
// no rpm installed, return
if (1 > rpms.length) {
$('#rpm fieldset').append("No RPMs 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 += "