2010-06-16 18:21:58 +00:00
|
|
|
/**
|
|
|
|
* Global variables
|
|
|
|
*/
|
|
|
|
var provisionTabs; // Provision tabs
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the provision tab
|
|
|
|
*
|
|
|
|
* @param obj
|
|
|
|
* Tab object
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function setProvisionTab(obj) {
|
|
|
|
provisionTabs = obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the provision tab
|
|
|
|
*
|
|
|
|
* @param Nothing
|
|
|
|
* @return Tab object
|
|
|
|
*/
|
|
|
|
function getProvisionTab() {
|
|
|
|
return provisionTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load provision page
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function loadProvisionPage() {
|
|
|
|
// If the page is loaded
|
2010-07-14 20:11:07 +00:00
|
|
|
if ($('#content').children().length) {
|
2010-06-16 18:21:58 +00:00
|
|
|
// Do not load again
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-02-23 08:34:23 +00:00
|
|
|
// Get OS image names
|
|
|
|
if (!$.cookie('imagenames')){
|
|
|
|
$.ajax( {
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'tabdump',
|
|
|
|
tgt : '',
|
|
|
|
args : 'osimage',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
|
|
|
|
success : setOSImageCookies
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get groups
|
|
|
|
if (!$.cookie('groups')){
|
|
|
|
$.ajax( {
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'extnoderange',
|
|
|
|
tgt : '/.*',
|
|
|
|
args : 'subgroups',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
|
|
|
|
success : setGroupsCookies
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
// Create info bar
|
2010-12-03 22:09:36 +00:00
|
|
|
var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.');
|
2010-12-01 01:54:05 +00:00
|
|
|
|
|
|
|
// Create provision page
|
|
|
|
var provPg = $('<div class="form"></div>');
|
|
|
|
provPg.append(infoBar);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
// Create provision tab
|
|
|
|
var tab = new Tab();
|
|
|
|
setProvisionTab(tab);
|
|
|
|
tab.init();
|
2010-07-14 20:11:07 +00:00
|
|
|
$('#content').append(tab.object());
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2010-08-03 14:16:24 +00:00
|
|
|
// Create radio buttons for platforms
|
2010-12-03 22:09:36 +00:00
|
|
|
var hwList = $('<ol>Platforms available:</ol>');
|
2011-02-24 19:49:11 +00:00
|
|
|
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" checked/>iDataPlex</li>');
|
|
|
|
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
|
|
|
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
|
|
|
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>System z</li>');
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2010-08-03 14:16:24 +00:00
|
|
|
hwList.append(ipmi);
|
|
|
|
hwList.append(blade);
|
|
|
|
hwList.append(hmc);
|
|
|
|
hwList.append(zvm);
|
2010-12-01 01:54:05 +00:00
|
|
|
provPg.append(hwList);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ok
|
|
|
|
*/
|
|
|
|
var okBtn = createButton('Ok');
|
|
|
|
okBtn.bind('click', function(event) {
|
|
|
|
// Get hardware that was selected
|
2010-08-03 14:16:24 +00:00
|
|
|
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
2011-08-24 10:30:30 +00:00
|
|
|
var newTabId = hw + 'ProvisionTab';
|
|
|
|
|
|
|
|
if ($('#' + newTabId).size() > 0){
|
|
|
|
tab.select(newTabId);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
var tabtitle = '';
|
|
|
|
|
|
|
|
// Create an instance of the plugin
|
|
|
|
var plugin;
|
|
|
|
switch (hw) {
|
|
|
|
case "blade":
|
|
|
|
plugin = new bladePlugin();
|
|
|
|
tabtitle = 'Blade';
|
|
|
|
break;
|
|
|
|
case "hmc":
|
|
|
|
plugin = new hmcPlugin();
|
|
|
|
tabtitle = 'System P';
|
|
|
|
break;
|
|
|
|
case "ipmi":
|
|
|
|
plugin = new ipmiPlugin();
|
|
|
|
tabtitle = 'System X';
|
|
|
|
break;
|
|
|
|
case "zvm":
|
|
|
|
plugin = new zvmPlugin();
|
2011-08-24 15:13:30 +00:00
|
|
|
tabtitle = 'zVM';
|
2011-08-24 10:30:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Select tab
|
|
|
|
tab.add(newTabId, tabtitle, '', true);
|
|
|
|
tab.select(newTabId);
|
|
|
|
plugin.loadProvisionPage(newTabId);
|
|
|
|
}
|
2010-06-16 18:21:58 +00:00
|
|
|
});
|
2010-12-01 01:54:05 +00:00
|
|
|
provPg.append(okBtn);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2010-12-01 01:54:05 +00:00
|
|
|
// Add provision tab
|
|
|
|
tab.add('provisionTab', 'Provision', provPg, false);
|
|
|
|
|
|
|
|
// Add image tab
|
|
|
|
var loader = $('<center></center>').append(createLoader(''));
|
|
|
|
tab.add('imagesTab', 'Images', loader, false);
|
|
|
|
loadImagesPage();
|
2011-08-24 10:30:30 +00:00
|
|
|
|
|
|
|
//should open the quick provision tab
|
|
|
|
if (window.location.search){
|
|
|
|
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
|
|
|
tab.select('quickProvisionTab');
|
|
|
|
|
|
|
|
var provForm = $('<div class="form"></div>');
|
|
|
|
$('#quickProvisionTab').append(provForm);
|
|
|
|
createProvision('quick', provForm);
|
|
|
|
}
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|