/**
* Load update page
*/
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 the user's last choice and input)
*
* @param data Data returned from HTTP request
*/
function showRepository(data) {
var develRepository = "";
var stableRepository = "";
var show = "";
// Get the corresponding repository by OS Type
if (data.rsp == "aix") {
// No repository exists for AIX on Sourceforge!
develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
} else {
develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
}
var repoList = $('');
// Display the Devel Repository, remember user's last selection
show = show + "
";
show = show + "Development: " + develRepository + "
";
repoList.append(show);
// Display the Stable Repository, remember user's last selection
show = "
";
show = show + "Stable: " + stableRepository + "
";
repoList.append(show);
// Display the Input Repository, remember user's last selection
if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1)
&& ($.cookie('xcatrepository') != 2)) {
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
*/
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 (rpms[temp].indexOf("not") != -1) {
continue;
}
// Show the version in table
show += "