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 status bar, hide on load
|
|
|
|
var statBarId = 'ProvisionStatusBar';
|
2010-07-29 17:32:24 +00:00
|
|
|
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>').hide();
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
provForm = $('<div class="provision"></div>');
|
|
|
|
provForm.append(statBar);
|
|
|
|
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-07-29 17:32:24 +00:00
|
|
|
// Create drop down menu for platforms
|
2010-06-16 18:21:58 +00:00
|
|
|
var div = $('<div></div>');
|
|
|
|
provForm.append(div);
|
|
|
|
|
2010-07-26 18:34:29 +00:00
|
|
|
var label = $('<span>Select a platform to provision:</span>');
|
2010-06-16 18:21:58 +00:00
|
|
|
var hw = $('<select></select>');
|
|
|
|
var ipmi = $('<option value="ipmi">ipmi</option>');
|
|
|
|
var blade = $('<option value="blade">blade</option>');
|
|
|
|
var hmc = $('<option value="hmc">hmc</option>');
|
|
|
|
var ivm = $('<option value="ivm">ivm</option>');
|
|
|
|
var fsp = $('<option value="fsp">fsp</option>');
|
|
|
|
var zvm = $('<option value="zvm">zvm</option>');
|
|
|
|
|
|
|
|
hw.append(ipmi);
|
|
|
|
hw.append(blade);
|
|
|
|
hw.append(hmc);
|
|
|
|
hw.append(ivm);
|
|
|
|
hw.append(fsp);
|
|
|
|
hw.append(zvm);
|
|
|
|
div.append(label);
|
|
|
|
div.append(hw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ok
|
|
|
|
*/
|
|
|
|
var okBtn = createButton('Ok');
|
|
|
|
okBtn.bind('click', function(event) {
|
|
|
|
// Get hardware that was selected
|
|
|
|
var hw = $(this).parent().find('select').val();
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
tab.add(newTabId, hw, '');
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
tab.add('provisionTab', 'Provision', provForm);
|
|
|
|
}
|