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;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Provision a node');
|
2010-07-14 20:11:07 +00:00
|
|
|
$('#content').append(infoBar);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
// Create provision form
|
2010-09-11 13:06:07 +00:00
|
|
|
provForm = $('<div class="form"></div>');
|
2010-06-16 18:21:58 +00:00
|
|
|
provForm.append(infoBar);
|
|
|
|
|
|
|
|
// 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-10-06 19:22:10 +00:00
|
|
|
var hwList =$('<ol>Select a platform to provision on:</ol>');
|
2010-08-03 14:16:24 +00:00
|
|
|
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" checked/>ipmi</li>');
|
|
|
|
var blade = $('<li><input type="radio" name="hw" value="blade"/>blade</li>');
|
|
|
|
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>hmc</li>');
|
|
|
|
var ivm = $('<li><input type="radio" name="hw" value="ivm"/>ivm</li>');
|
|
|
|
var fsp = $('<li><input type="radio" name="hw" value="fsp"/>fsp</li>');
|
|
|
|
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>zvm</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(ivm);
|
|
|
|
hwList.append(fsp);
|
|
|
|
hwList.append(zvm);
|
|
|
|
provForm.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-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;
|
|
|
|
switch(hw) {
|
|
|
|
case "blade":
|
2010-07-23 18:47:54 +00:00
|
|
|
plugin = new bladePlugin();
|
2010-07-22 19:56:09 +00:00
|
|
|
break;
|
|
|
|
case "fsp":
|
2010-07-23 18:47:54 +00:00
|
|
|
plugin = new fspPlugin();
|
2010-07-22 19:56:09 +00:00
|
|
|
break;
|
|
|
|
case "hmc":
|
2010-07-23 18:47:54 +00:00
|
|
|
plugin = new hmcPlugin();
|
2010-07-22 19:56:09 +00:00
|
|
|
break;
|
|
|
|
case "ipmi":
|
2010-07-23 18:47:54 +00:00
|
|
|
plugin = new ipmiPlugin();
|
2010-07-22 19:56:09 +00:00
|
|
|
break;
|
|
|
|
case "ivm":
|
2010-07-23 18:47:54 +00:00
|
|
|
plugin = new ivmPlugin();
|
2010-07-22 19:56:09 +00:00
|
|
|
break;
|
|
|
|
case "zvm":
|
2010-07-23 18:47:54 +00:00
|
|
|
plugin = new zvmPlugin();
|
2010-07-22 19:56:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-07-15 22:57:48 +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
|
|
|
});
|
|
|
|
provForm.append(okBtn);
|
|
|
|
|
2010-08-03 14:58:08 +00:00
|
|
|
tab.add('provisionTab', 'Provision', provForm, false);
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|