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);
|
|
|
|
tab.add('monitorTab', 'Monitor', monitorForm);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resources
|
|
|
|
*/
|
|
|
|
var resrcForm = $('<div class="monitor"></div>');
|
|
|
|
|
|
|
|
// Create info bar
|
|
|
|
var resrcInfoBar = createInfoBar('Select a hardware to view its resources');
|
|
|
|
resrcForm.append(resrcInfoBar);
|
2010-07-15 23:22:13 +00:00
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
// Create drop-down menu
|
|
|
|
// Hardware available to provision - ipmi, blade, hmc, ivm, fsp, and zvm
|
|
|
|
var div = $('<div></div>');
|
|
|
|
var label = $('<span>Select the hardware:</span>');
|
|
|
|
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);
|
|
|
|
resrcForm.append(div);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 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);
|
|
|
|
tab.add(newTabId, hw, loader);
|
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Create an instance of the plugin
|
|
|
|
var plugin;
|
|
|
|
switch(hw) {
|
|
|
|
case "blade":
|
|
|
|
plugin = new blade();
|
|
|
|
break;
|
|
|
|
case "fsp":
|
|
|
|
plugin = new fsp();
|
|
|
|
break;
|
|
|
|
case "hmc":
|
|
|
|
plugin = new hmc();
|
|
|
|
break;
|
|
|
|
case "ipmi":
|
|
|
|
plugin = new ipmi();
|
|
|
|
break;
|
|
|
|
case "ivm":
|
|
|
|
plugin = new ivm();
|
|
|
|
break;
|
|
|
|
case "zvm":
|
|
|
|
plugin = new zvm();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
plugin.loadResources();
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Select tab
|
|
|
|
tab.select(newTabId);
|
|
|
|
});
|
|
|
|
resrcForm.append(okBtn);
|
|
|
|
|
|
|
|
tab.add('resourceTab', 'Resources', resrcForm);
|
|
|
|
}
|