2010-06-16 18:21:58 +00:00
|
|
|
/**
|
|
|
|
* Global variables
|
|
|
|
*/
|
|
|
|
var monitorTabs; // Monitor tabs
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the monitor tab
|
|
|
|
*
|
|
|
|
* @param o
|
|
|
|
* Tab object
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function setMonitorTab(o) {
|
|
|
|
monitorTabs = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the monitor tab
|
|
|
|
*
|
|
|
|
* @param Nothing
|
|
|
|
* @return Tab object
|
|
|
|
*/
|
|
|
|
function getMonitorTab() {
|
|
|
|
return monitorTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the monitor page
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function loadMonitorPage() {
|
|
|
|
// If the page is already loaded
|
|
|
|
if ($('#monitor_page').children().length) {
|
|
|
|
// Do not reload the monitor page
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create monitor tab
|
|
|
|
var tab = new Tab();
|
|
|
|
setConfigTab(tab);
|
|
|
|
tab.init();
|
2010-07-14 20:11:07 +00:00
|
|
|
$('#content').append(tab.object());
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
// Create provision tab
|
|
|
|
var tab = new Tab();
|
|
|
|
setMonitorTab(tab);
|
|
|
|
tab.init();
|
2010-07-14 20:11:07 +00:00
|
|
|
$('#content').append(tab.object());
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Monitor nodes
|
|
|
|
*/
|
|
|
|
var monitorForm = $('<div class="monitor"></div>');
|
|
|
|
|
|
|
|
// Create info bar
|
|
|
|
var monitorInfoBar = createInfoBar('Under construction');
|
|
|
|
monitorForm.append(monitorInfoBar);
|
|
|
|
|
|
|
|
// Create drop-down menu
|
|
|
|
// Hardware available to provision - ipmi, blade, hmc, ivm, fsp, and zvm
|
|
|
|
var div = $('<div></div>');
|
|
|
|
monitorForm.append(div);
|
2010-08-03 14:58:08 +00:00
|
|
|
tab.add('monitorTab', 'Monitor', monitorForm, false);
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
/**
|
2010-08-03 14:16:24 +00:00
|
|
|
* Monitor resources
|
2010-06-16 18:21:58 +00:00
|
|
|
*/
|
|
|
|
var resrcForm = $('<div class="monitor"></div>');
|
|
|
|
|
|
|
|
// Create info bar
|
2010-08-03 14:16:24 +00:00
|
|
|
var resrcInfoBar = createInfoBar('Monitor resources');
|
2010-06-16 18:21:58 +00:00
|
|
|
resrcForm.append(resrcInfoBar);
|
2010-07-15 23:22:13 +00:00
|
|
|
|
2010-08-03 14:16:24 +00:00
|
|
|
// Create radio buttons for platforms
|
|
|
|
var hwList =$('<ol>Select a platform to view its resources:</ol>');
|
|
|
|
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>');
|
|
|
|
|
|
|
|
hwList.append(ipmi);
|
|
|
|
hwList.append(blade);
|
|
|
|
hwList.append(hmc);
|
|
|
|
hwList.append(ivm);
|
|
|
|
hwList.append(fsp);
|
|
|
|
hwList.append(zvm);
|
|
|
|
resrcForm.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 newTabId = hw + 'ResourceTab';
|
|
|
|
if (!$('#' + newTabId).length) {
|
2010-07-15 23:22:13 +00:00
|
|
|
var loader = createLoader(hw + 'ResourceLoader');
|
2010-06-16 18:21:58 +00:00
|
|
|
loader = $('<center></center>').append(loader);
|
2010-08-03 14:58:08 +00:00
|
|
|
tab.add(newTabId, hw, loader, 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
plugin.loadResources();
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Select tab
|
|
|
|
tab.select(newTabId);
|
|
|
|
});
|
|
|
|
resrcForm.append(okBtn);
|
|
|
|
|
2010-08-03 14:58:08 +00:00
|
|
|
tab.add('resourceTab', 'Resources', resrcForm, false);
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|