2010-07-28 20:24:29 +00:00
|
|
|
/**
|
|
|
|
* Execute when the DOM is fully loaded
|
|
|
|
*/
|
|
|
|
$(document).ready(function() {
|
|
|
|
// Load utility scripts
|
2010-07-15 22:57:48 +00:00
|
|
|
});
|
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
var hmcPlugin = function() {
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
|
|
|
|
2010-07-15 22:57:48 +00:00
|
|
|
/**
|
|
|
|
* Load node inventory
|
|
|
|
*
|
|
|
|
* @param data
|
|
|
|
* Data from HTTP request
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadInventory = function(data) {
|
2010-07-26 18:34:29 +00:00
|
|
|
// Get arguments
|
2010-07-22 19:56:09 +00:00
|
|
|
var args = data.msg.split(',');
|
|
|
|
// Get tab ID
|
|
|
|
var tabId = args[0].replace('out=', '');
|
|
|
|
// Get node
|
|
|
|
var node = args[1].replace('node=', '');
|
|
|
|
// Get node inventory
|
|
|
|
var inv = data.rsp;
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Remove loader
|
2011-01-19 15:56:43 +00:00
|
|
|
$('#' + tabId).find('img').remove();
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Create division to hold inventory
|
2010-07-26 18:34:29 +00:00
|
|
|
var invDivId = tabId + 'Inventory';
|
2010-07-22 19:56:09 +00:00
|
|
|
var invDiv = $('<div class="inventory" id="' + invDivId + '"></div>');
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-26 18:34:29 +00:00
|
|
|
// Loop through each line
|
2010-07-28 20:24:29 +00:00
|
|
|
var fieldSet, legend, oList, item;
|
2011-04-16 14:40:15 +00:00
|
|
|
for (var k = 0; k < inv.length; k++) {
|
2010-07-28 20:24:29 +00:00
|
|
|
// Remove node name in front
|
2010-07-26 18:34:29 +00:00
|
|
|
var str = inv[k].replace(node + ': ', '');
|
2010-07-29 20:22:09 +00:00
|
|
|
str = jQuery.trim(str);
|
2010-07-28 20:24:29 +00:00
|
|
|
|
|
|
|
// If string is a header
|
|
|
|
if (str.indexOf('I/O Bus Information') > -1 || str.indexOf('Machine Configuration Info') > -1) {
|
2010-07-26 18:34:29 +00:00
|
|
|
// Create a fieldset
|
|
|
|
fieldSet = $('<fieldset></fieldset>');
|
|
|
|
legend = $('<legend>' + str + '</legend>');
|
|
|
|
fieldSet.append(legend);
|
|
|
|
oList = $('<ol></ol>');
|
|
|
|
fieldSet.append(oList);
|
|
|
|
invDiv.append(fieldSet);
|
|
|
|
} else {
|
|
|
|
// If no fieldset is defined
|
|
|
|
if (!fieldSet) {
|
2010-07-28 20:24:29 +00:00
|
|
|
// Define general fieldset
|
2010-07-26 18:34:29 +00:00
|
|
|
fieldSet = $('<fieldset></fieldset>');
|
|
|
|
legend = $('<legend>General</legend>');
|
|
|
|
fieldSet.append(legend);
|
|
|
|
oList = $('<ol></ol>');
|
|
|
|
fieldSet.append(oList);
|
|
|
|
invDiv.append(fieldSet);
|
|
|
|
}
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-26 18:34:29 +00:00
|
|
|
// Append the string to a list
|
|
|
|
item = $('<li></li>');
|
2010-07-28 20:24:29 +00:00
|
|
|
item.append(str);
|
|
|
|
oList.append(item);
|
2010-07-26 18:34:29 +00:00
|
|
|
}
|
2010-07-22 19:56:09 +00:00
|
|
|
}
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Append to inventory form
|
|
|
|
$('#' + tabId).append(invDiv);
|
|
|
|
};
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-19 18:28:31 +00:00
|
|
|
* Load clone page
|
2010-07-15 22:57:48 +00:00
|
|
|
*
|
|
|
|
* @param node
|
2010-07-19 18:28:31 +00:00
|
|
|
* Source node to clone
|
2010-07-15 22:57:48 +00:00
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadClonePage = function(node) {
|
2010-10-07 14:15:56 +00:00
|
|
|
// Get nodes tab
|
|
|
|
var tab = getNodesTab();
|
|
|
|
var newTabId = node + 'CloneTab';
|
|
|
|
|
|
|
|
// If there is no existing clone tab
|
|
|
|
if (!$('#' + newTabId).length) {
|
|
|
|
// Create status bar and hide it
|
|
|
|
var statBarId = node + 'CloneStatusBar';
|
2010-10-08 03:03:42 +00:00
|
|
|
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>').hide();
|
2010-10-07 14:15:56 +00:00
|
|
|
|
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Under construction');
|
|
|
|
|
|
|
|
// Create clone form
|
|
|
|
var cloneForm = $('<div class="form"></div>');
|
|
|
|
cloneForm.append(statBar);
|
|
|
|
cloneForm.append(infoBar);
|
|
|
|
|
|
|
|
// Add clone tab
|
|
|
|
tab.add(newTabId, 'Clone', cloneForm, true);
|
|
|
|
}
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-10-07 14:15:56 +00:00
|
|
|
tab.select(newTabId);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-19 18:28:31 +00:00
|
|
|
* Load provision page
|
2010-07-15 22:57:48 +00:00
|
|
|
*
|
|
|
|
* @param tabId
|
|
|
|
* The provision tab ID
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadProvisionPage = function(tabId) {
|
2011-08-24 10:30:30 +00:00
|
|
|
// Create provision form
|
|
|
|
var provForm = $('<div class="form"></div>');
|
2010-07-20 18:49:31 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Provision a node on system P server.');
|
|
|
|
provForm.append(infoBar);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
// Append to provision tab
|
|
|
|
$('#' + tabId).append(provForm);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
/**
|
|
|
|
* Create provision new node division
|
|
|
|
*/
|
|
|
|
// You should copy whatever is in this function, put it here, and customize it
|
|
|
|
createProvision('hmc', provForm);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-07-19 18:28:31 +00:00
|
|
|
/**
|
|
|
|
* Load resources
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadResources = function() {
|
2010-10-08 03:03:42 +00:00
|
|
|
// Get resource tab ID
|
2011-01-19 15:56:43 +00:00
|
|
|
var tabId = 'hmcResourceTab';
|
|
|
|
// Remove loader
|
|
|
|
$('#' + tabId).find('img').remove();
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-10-07 17:40:24 +00:00
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Under construction');
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-10-07 17:40:24 +00:00
|
|
|
// Create resource form
|
|
|
|
var resrcForm = $('<div class="form"></div>');
|
|
|
|
resrcForm.append(infoBar);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-01-19 15:56:43 +00:00
|
|
|
$('#' + tabId).append(resrcForm);
|
2010-09-22 16:52:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2010-09-24 02:27:04 +00:00
|
|
|
* Add node range
|
2010-09-22 16:52:41 +00:00
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-09-23 20:43:10 +00:00
|
|
|
hmcPlugin.prototype.addNode = function() {
|
2010-10-07 14:15:56 +00:00
|
|
|
openDialog('info', 'Under construction');
|
2011-02-17 09:06:21 +00:00
|
|
|
};
|
|
|
|
|