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
|
2011-09-09 21:56:30 +00:00
|
|
|
var tab = new Tab('provisionPageTabs');
|
2010-06-16 18:21:58 +00:00
|
|
|
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-11-24 04:18:38 +00:00
|
|
|
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
2011-11-03 02:21:11 +00:00
|
|
|
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
2011-12-19 05:03:27 +00:00
|
|
|
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
2011-11-24 04:18:38 +00:00
|
|
|
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
2011-02-24 19:49:11 +00:00
|
|
|
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>');
|
2011-12-19 05:03:27 +00:00
|
|
|
|
2011-11-03 02:21:11 +00:00
|
|
|
hwList.append(esx);
|
|
|
|
hwList.append(kvm);
|
2011-12-19 05:03:27 +00:00
|
|
|
hwList.append(zvm);
|
2010-08-03 14:16:24 +00:00
|
|
|
hwList.append(blade);
|
2011-12-19 05:03:27 +00:00
|
|
|
hwList.append(ipmi);
|
2010-08-03 14:16:24 +00:00
|
|
|
hwList.append(hmc);
|
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-11-24 04:18:38 +00:00
|
|
|
|
|
|
|
var inst = 0;
|
|
|
|
var newTabId = hw + 'ProvisionTab' + inst;
|
|
|
|
while ($('#' + newTabId).length) {
|
|
|
|
// If one already exists, generate another one
|
|
|
|
inst = inst + 1;
|
|
|
|
newTabId = hw + 'ProvisionTab' + inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create an instance of the plugin
|
|
|
|
var title = '';
|
|
|
|
var plugin;
|
|
|
|
switch (hw) {
|
|
|
|
case "kvm":
|
|
|
|
plugin = new kvmPlugin();
|
|
|
|
title = 'KVM';
|
|
|
|
break;
|
|
|
|
case "esx":
|
|
|
|
plugin = new esxPlugin();
|
|
|
|
title = 'ESX';
|
|
|
|
break;
|
|
|
|
case "blade":
|
|
|
|
plugin = new bladePlugin();
|
|
|
|
title = 'BladeCenter';
|
|
|
|
break;
|
|
|
|
case "hmc":
|
|
|
|
plugin = new hmcPlugin();
|
|
|
|
title = 'System p';
|
|
|
|
break;
|
|
|
|
case "ipmi":
|
|
|
|
plugin = new ipmiPlugin();
|
|
|
|
title = 'iDataPlex';
|
|
|
|
break;
|
|
|
|
case "zvm":
|
|
|
|
plugin = new zvmPlugin();
|
2011-12-19 05:03:27 +00:00
|
|
|
title = 'z/VM';
|
2011-11-24 04:18:38 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-08-24 10:30:30 +00:00
|
|
|
|
2011-11-24 04:18:38 +00:00
|
|
|
// Select tab
|
|
|
|
tab.add(newTabId, title, '', 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
|
2011-09-09 21:56:30 +00:00
|
|
|
tab.add('imagesTab', 'Images', '', false);
|
|
|
|
|
|
|
|
// Load tabs onselect
|
|
|
|
$('#provisionPageTabs').bind('tabsselect', function(event, ui){
|
|
|
|
// Load image page
|
|
|
|
if (!$('#imagesTab').children().length && ui.index == 1) {
|
|
|
|
$('#imagesTab').append($('<center></center>').append(createLoader('')));
|
|
|
|
loadImagesPage();
|
|
|
|
}
|
|
|
|
});
|
2011-08-24 10:30:30 +00:00
|
|
|
|
2011-09-09 21:56:30 +00:00
|
|
|
// Open the quick provision tab
|
|
|
|
if (window.location.search) {
|
2011-08-24 10:30:30 +00:00
|
|
|
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
|
|
|
tab.select('quickProvisionTab');
|
|
|
|
|
|
|
|
var provForm = $('<div class="form"></div>');
|
|
|
|
$('#quickProvisionTab').append(provForm);
|
2012-03-15 05:09:28 +00:00
|
|
|
appendProvisionSection('quick', provForm);
|
2011-08-24 10:30:30 +00:00
|
|
|
}
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|