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();
|
2010-11-17 18:53:40 +00:00
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
// Generate new tab ID
|
|
|
|
var instance = 0;
|
|
|
|
var newTabId = hw + 'ProvisionTab' + instance;
|
|
|
|
while ($('#' + newTabId).length) {
|
|
|
|
// If one already exists, generate another one
|
|
|
|
instance = instance + 1;
|
|
|
|
newTabId = hw + 'ProvisionTab' + instance;
|
|
|
|
}
|
|
|
|
|
2010-08-03 14:58:08 +00:00
|
|
|
tab.add(newTabId, hw, '', true);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Create an instance of the plugin
|
|
|
|
var plugin;
|
2010-11-17 18:53:40 +00:00
|
|
|
switch (hw) {
|
|
|
|
case "blade":
|
|
|
|
plugin = new bladePlugin();
|
|
|
|
break;
|
|
|
|
case "hmc":
|
|
|
|
plugin = new hmcPlugin();
|
|
|
|
break;
|
|
|
|
case "ipmi":
|
|
|
|
plugin = new ipmiPlugin();
|
|
|
|
break;
|
|
|
|
case "zvm":
|
|
|
|
plugin = new zvmPlugin();
|
|
|
|
break;
|
2010-07-22 19:56:09 +00:00
|
|
|
}
|
2010-11-17 18:53:40 +00:00
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
// Select tab
|
|
|
|
tab.select(newTabId);
|
2010-07-22 19:56:09 +00:00
|
|
|
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();
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|