/** * Execute when the DOM is fully loaded */ $(document).ready(function() { // Load utility scripts }); /** * Constructor * * @return Nothing */ var bladePlugin = function() { }; /** * Load node inventory * * @param data * Data from HTTP request * @return Nothing */ bladePlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); // Get node inventory var inv = data.rsp; // Remove loader $('#' + tabId).find('img').remove(); // Create division to hold inventory var invDivId = tabId + 'Inventory'; var invDiv = $('
'); // Create a fieldset var fieldSet = $('
'); var legend = $('Hardware'); fieldSet.append(legend); var oList = $('
    '); fieldSet.append(oList); invDiv.append(fieldSet); // Loop through each line var item; for (var k = 0; k < inv.length; k++) { // Remove node name in front var str = inv[k].replace(node + ': ', ''); str = jQuery.trim(str); // Append the string to a list item = $('
  1. '); item.append(str); oList.append(item); } // Append to inventory form $('#' + tabId).append(invDiv); }; /** * Load clone page * * @param node * Source node to clone * @return Nothing */ bladePlugin.prototype.loadClonePage = function(node) { // Get nodes tab var tab = getNodesTab(); var newTabId = node + 'CloneTab'; // If there is no existing clone tab if (!$('#' + newTabId).length) { // Create info bar var infoBar = createInfoBar('Not supported'); // Create clone form var cloneForm = $('
    '); cloneForm.append(infoBar); // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } tab.select(newTabId); }; /** * Load provision page * * @param tabId * The provision tab ID * @return Nothing */ bladePlugin.prototype.loadProvisionPage = function(tabId) { // Get OS image names $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'tabdump', tgt : '', args : 'osimage', msg : '' }, success : setOSImageCookies }); // Get groups $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'extnoderange', tgt : '/.*', args : 'subgroups', msg : '' }, success : setGroupsCookies }); // Get provision tab instance var inst = tabId.replace('bladeProvisionTab', ''); // Create provision form var provForm = $('
    '); // Create info bar var infoBar = createInfoBar('Provision a blade. This will install an operating system onto the blade.'); provForm.append(infoBar); // Append to provision tab $('#' + tabId).append(provForm); // Create provision existing node division var provExisting = createBladeProvisionExisting(inst); provForm.append(provExisting); }; /** * Load resources * * @return Nothing */ bladePlugin.prototype.loadResources = function() { // Get resource tab ID var tabId = 'bladeResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); // Create info bar var infoBar = createInfoBar('Under construction'); // Create resource form var resrcForm = $('
    '); resrcForm.append(infoBar); $('#' + tabId).append(resrcForm); }; /** * Add node range * * @return Nothing */ bladePlugin.prototype.addNode = function() { var nodeTypeSelectDia = $('
    '); var info = createInfoBar('Add a node range'); nodeTypeSelectDia.append(info); nodeTypeSelectDia.append('
    '); //append the mm div var mmStr = '
    ' + '

    ' + '' + '
    '; //append the blade div var bladeStr = '