quick provision from nodes page
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10353 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
92e0dd20bb
commit
10fe1f542f
@ -97,50 +97,21 @@ bladePlugin.prototype.loadClonePage = function(node) {
|
||||
* @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 : ''
|
||||
},
|
||||
// Create provision form
|
||||
var provForm = $('<div class="form"></div>');
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Provision a node on Blade.');
|
||||
provForm.append(infoBar);
|
||||
|
||||
// Get groups
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'extnoderange',
|
||||
tgt : '/.*',
|
||||
args : 'subgroups',
|
||||
msg : ''
|
||||
},
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
success : setGroupsCookies
|
||||
});
|
||||
|
||||
// Get provision tab instance
|
||||
var inst = tabId.replace('bladeProvisionTab', '');
|
||||
|
||||
// Create provision form
|
||||
var provForm = $('<div class="form"></div>');
|
||||
|
||||
// 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);
|
||||
/**
|
||||
* Create provision new node division
|
||||
*/
|
||||
// You should copy whatever is in this function, put it here, and customize it
|
||||
createProvision('blade', provForm);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -351,465 +322,3 @@ function addBladeNode(){
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create provision existing node division
|
||||
*
|
||||
* @param inst
|
||||
* Provision tab instance
|
||||
* @return Provision existing node division
|
||||
*/
|
||||
function createBladeProvisionExisting(inst) {
|
||||
// Create provision existing division
|
||||
var provExisting = $('<div></div>');
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label for="provType">Group:</label>');
|
||||
group.append(groupLabel);
|
||||
|
||||
// Turn on auto complete for group
|
||||
var dTableDivId = 'bladeNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
|
||||
var groupNames = $.cookie('groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
|
||||
// Create drop down for groups
|
||||
var groupSelect = $('<select></select>');
|
||||
groupSelect.append('<option></option>');
|
||||
for ( var i in tmp) {
|
||||
// Add group into drop down
|
||||
var opt = $('<option value="' + tmp[i] + '">' + tmp[i] + '</option>');
|
||||
groupSelect.append(opt);
|
||||
}
|
||||
group.append(groupSelect);
|
||||
|
||||
// Create node datatable
|
||||
groupSelect.change(function() {
|
||||
// Get group selected
|
||||
var thisGroup = $(this).val();
|
||||
// If a valid group is selected
|
||||
if (thisGroup) {
|
||||
createNodesDatatable(thisGroup, dTableDivId);
|
||||
} // End of if (thisGroup)
|
||||
});
|
||||
} else {
|
||||
// If no groups are cookied
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
provExisting.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
var nodeLabel = $('<label for="nodeName">Nodes:</label>');
|
||||
var nodeDatatable = $('<div id="' + dTableDivId + '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeDatatable);
|
||||
provExisting.append(node);
|
||||
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label for="method">Boot method:</label>');
|
||||
var methodSelect = $('<select id="bootMethod" name="bootMethod"></select>');
|
||||
methodSelect.append('<option value=""></option>'
|
||||
+ '<option value="boot">boot</option>'
|
||||
+ '<option value="install">install</option>'
|
||||
+ '<option value="iscsiboot">iscsiboot</option>'
|
||||
+ '<option value="netboot">netboot</option>'
|
||||
+ '<option value="statelite">statelite</option>'
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
provExisting.append(method);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label for="os">Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
provExisting.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label for="arch">Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
provExisting.append(arch);
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label for="profile">Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
provExisting.append(profile);
|
||||
|
||||
/**
|
||||
* Provision existing
|
||||
*/
|
||||
var provisionBtn = createButton('Provision');
|
||||
provisionBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
var errorMessage = '';
|
||||
|
||||
// Get provision tab ID
|
||||
var thisTabId = 'bladeProvisionTab' + inst;
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
if (!tgts) {
|
||||
errorMessage += 'You need to select a node. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// Check booth method
|
||||
var boot = $('#' + thisTabId + ' select[name=bootMethod]');
|
||||
if (!boot.val()) {
|
||||
errorMessage += 'You need to select a boot method. ';
|
||||
boot.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
boot.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// Check operating system image
|
||||
var os = $('#' + thisTabId + ' input[name=os]');
|
||||
if (!os.val()) {
|
||||
errorMessage += 'You need to select a operating system image. ';
|
||||
os.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
os.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// Check architecture
|
||||
var arch = $('#' + thisTabId + ' input[name=arch]');
|
||||
if (!arch.val()) {
|
||||
errorMessage += 'You need to select an architecture. ';
|
||||
arch.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
arch.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// Check profile
|
||||
var profile = $('#' + thisTabId + ' input[name=profile]');
|
||||
if (!profile.val()) {
|
||||
errorMessage += 'You need to select a profile. ';
|
||||
profile.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
profile.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// If all inputs are valid, ready to provision
|
||||
if (ready) {
|
||||
// Disable provision button
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
// Prepend status bar
|
||||
var statBar = createStatusBar('bladeProvisionStatBar' + inst);
|
||||
statBar.append(createLoader(''));
|
||||
statBar.prependTo($('#' + thisTabId));
|
||||
|
||||
// Disable all inputs
|
||||
var inputs = $('#' + thisTabId + ' input');
|
||||
inputs.attr('disabled', 'disabled');
|
||||
|
||||
// Disable all selects
|
||||
var selects = $('#' + thisTabId + ' select');
|
||||
selects.attr('disabled', 'disabled');
|
||||
|
||||
/**
|
||||
* (1) Set operating system
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=xnba;nodetype.os=' + os.val() + ';nodetype.arch=' + arch.val() + ';nodetype.profile=' + profile.val(),
|
||||
msg : 'cmd=nodeadd;out=' + inst
|
||||
},
|
||||
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errorMessage);
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
provExisting.append(provisionBtn);
|
||||
|
||||
return provExisting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create nodes datatable for a given group
|
||||
*
|
||||
* @param group
|
||||
* Group name
|
||||
* @param outId
|
||||
* Division ID to append datatable
|
||||
* @return Nodes datatable
|
||||
*/
|
||||
function createNodesDatatable(group, outId) {
|
||||
// Get group nodes
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : group,
|
||||
msg : outId
|
||||
},
|
||||
|
||||
/**
|
||||
* Create nodes datatable
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function(data) {
|
||||
// Data returned
|
||||
var rsp = data.rsp;
|
||||
|
||||
// Get output ID
|
||||
var outId = data.msg;
|
||||
// Get datatable ID
|
||||
var dTableId = outId.replace('DIV', '');
|
||||
|
||||
// Node attributes hash
|
||||
var attrs = new Object();
|
||||
// Node attributes
|
||||
var headers = new Object();
|
||||
|
||||
// Clear nodes datatable division
|
||||
$('#' + outId).empty();
|
||||
|
||||
// Create nodes datatable
|
||||
var node, args;
|
||||
for ( var i in rsp) {
|
||||
// Get node
|
||||
var pos = rsp[i].indexOf('Object name:');
|
||||
if (pos > -1) {
|
||||
var temp = rsp[i].split(': ');
|
||||
node = jQuery.trim(temp[1]);
|
||||
|
||||
// Create a hash for the node attributes
|
||||
attrs[node] = new Object();
|
||||
i++;
|
||||
}
|
||||
|
||||
// Get key and value
|
||||
args = rsp[i].split('=');
|
||||
var key = jQuery.trim(args[0]);
|
||||
var val = jQuery.trim(args[1]);
|
||||
|
||||
// Create hash table
|
||||
attrs[node][key] = val;
|
||||
headers[key] = 1;
|
||||
}
|
||||
|
||||
// Sort headers
|
||||
var sorted = new Array();
|
||||
for ( var key in headers) {
|
||||
sorted.push(key);
|
||||
}
|
||||
sorted.sort();
|
||||
|
||||
// Add column for check box and node
|
||||
sorted.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'node');
|
||||
|
||||
// Create nodes datatable
|
||||
var dTable = new DataTable(dTableId);
|
||||
dTable.init(sorted);
|
||||
|
||||
// Go through each node
|
||||
for ( var node in attrs) {
|
||||
// Create a row
|
||||
var row = new Array();
|
||||
// Create a check box
|
||||
var checkBx = '<input type="checkbox" name="' + node + '"/>';
|
||||
row.push(checkBx, node);
|
||||
|
||||
// Go through each header
|
||||
for ( var i = 2; i < sorted.length; i++) {
|
||||
// Add node attributes to the row
|
||||
var key = sorted[i];
|
||||
var val = attrs[node][key];
|
||||
if (val) {
|
||||
row.push(val);
|
||||
} else {
|
||||
row.push('');
|
||||
}
|
||||
}
|
||||
|
||||
// Add row to table
|
||||
dTable.add(row);
|
||||
}
|
||||
|
||||
$('#' + outId).append(dTable.object());
|
||||
$('#' + dTableId).dataTable();
|
||||
} // End of function(data)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the provision existing node status
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
function updateBladeProvisionExistingStatus(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get provision tab instance
|
||||
var inst = args[1].replace('out=', '');
|
||||
|
||||
// Get provision tab and status bar ID
|
||||
var statBarId = 'bladeProvisionStatBar' + inst;
|
||||
var tabId = 'bladeProvisionTab' + inst;
|
||||
|
||||
/**
|
||||
* (2) Remote install
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Get parameters
|
||||
var os = $('#' + tabId + ' input[name="os"]').val();
|
||||
var profile = $('#' + tabId + ' input[name="profile"]').val();
|
||||
var arch = $('#' + tabId + ' input[name="arch"]').val();
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
// Begin installation
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rbootseq',
|
||||
tgt : tgts,
|
||||
args : 'net,hd',
|
||||
msg : 'cmd=rbootseq;out=' + inst
|
||||
},
|
||||
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (3) Prepare node for boot
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
// Get provision method
|
||||
var bootMethod = $('#' + tabId + ' select[name=bootMethod]').val();
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : bootMethod,
|
||||
msg : 'cmd=nodeset;out=' + inst
|
||||
},
|
||||
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (4) Power on node
|
||||
*/
|
||||
if (cmd == 'nodeset') {
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpower',
|
||||
tgt : tgts,
|
||||
args : 'boot',
|
||||
msg : 'cmd=rpower;out=' + inst
|
||||
},
|
||||
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (5) Done
|
||||
*/
|
||||
else if (cmd == 'rpower') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
$('#' + statBarId).find('img').remove();
|
||||
|
||||
// If installation was successful
|
||||
if (prg.html().indexOf('Error') == -1) {
|
||||
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.</pre>');
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,9 @@
|
||||
* Division ID to append datatable
|
||||
* @return Nodes datatable
|
||||
*/
|
||||
|
||||
var provisionClock;
|
||||
|
||||
function createNodesDatatable(group, outId) {
|
||||
// Get group nodes
|
||||
$.ajax( {
|
||||
@ -380,4 +383,329 @@ function createProvisionNew(plugin, inst) {
|
||||
provNew.append(provisionBtn);
|
||||
|
||||
return provNew;
|
||||
}
|
||||
|
||||
function createProvision(plugin, container){
|
||||
var showStr = '';
|
||||
|
||||
//group, nodes, arch
|
||||
if ('quick' == plugin){
|
||||
container.append(createProvWithUrl());
|
||||
}
|
||||
else{
|
||||
container.append(createProvNonurl(plugin));
|
||||
container.find('#' + plugin + 'group').bind('change', function(){
|
||||
var pluginname = $(this).attr('id').replace('group', '');
|
||||
$('#' + pluginname + 'SelectNodesTable').html('<img src="images/loader.gif"></img>');
|
||||
createNodesArea($(this).val(), pluginname + 'SelectNodesTable');
|
||||
});
|
||||
}
|
||||
|
||||
//image,nic,master,tftp,nfs,option
|
||||
showStr = '<div><label>Image:</label><select id="' + plugin + 'image"></select><img src="images/loader.gif"></img></div>' +
|
||||
'<div><label>Install Nic:</label><input value="mac"></div>' +
|
||||
'<div><label>Primary Nic:</label><input value="mac"></div>' +
|
||||
'<div><label>xCAT Master:</label><input ></div>' +
|
||||
'<div><label>TFTP Server:</label><input ></div>' +
|
||||
'<div><label>NFS Server:</label><input ></div>' +
|
||||
'<div id="advoption"></div>';
|
||||
|
||||
container.append(showStr);
|
||||
|
||||
//add the provision button
|
||||
var provisionBtn = createButton('Provision');
|
||||
provisionBtn.bind('click', function(){
|
||||
var plugin = $(this).parent().parent().attr('id').replace('ProvisionTab', '');
|
||||
quickProvision(plugin);
|
||||
});
|
||||
provisionBtn.hide();
|
||||
container.append(provisionBtn);
|
||||
|
||||
//bind the image select change event
|
||||
container.find('#' + plugin + 'image').bind('change', function(){
|
||||
var temp = $(this).attr('id');
|
||||
temp = temp.replace('image', '');
|
||||
$('#' + temp + 'ProvisionTab #advoption').html('<img src="images/loader.gif"></img>');
|
||||
provAdvOption($(this).val(), temp);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : '-t;osimage',
|
||||
msg : plugin
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
var containerid = data.msg + 'ProvisionTab';
|
||||
var index = 0;
|
||||
var imagename = 0;
|
||||
var position = 0;
|
||||
var imageselect = $('#' + containerid + ' #' + data.msg + 'image');
|
||||
$('#' + containerid + ' img').remove();
|
||||
if (data.rsp.lenght < 1){
|
||||
$('#' + containerid).prepend(createWarnBar('Please copycds and genimage in provision page first!'));
|
||||
return;
|
||||
}
|
||||
|
||||
for (index in data.rsp){
|
||||
imagename = data.rsp[index];
|
||||
position = imagename.indexOf(' ');
|
||||
imagename = imagename.substr(0, position);
|
||||
|
||||
imageselect.append('<option value="' + imagename + '">' + imagename + '</option>');
|
||||
}
|
||||
//trigger the select change event
|
||||
imageselect.trigger('change');
|
||||
//show provision button
|
||||
$('#' + containerid + ' button').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createProvWithUrl(){
|
||||
var querystr = window.location.search;
|
||||
var argarray = querystr.substr(1).split('&');
|
||||
var temphash = new Object();
|
||||
var index = 0;
|
||||
var temparray;
|
||||
var showstr = '';
|
||||
for (index = 0; index < argarray.length; index++){
|
||||
temparray = argarray[index].split('=');
|
||||
temphash[temparray[0]] = temparray[1];
|
||||
}
|
||||
|
||||
showstr += '<div><label>Nodes:</label><input type="text" disabled="disabled" value="' +
|
||||
temphash['nodes'] + '"></div>';
|
||||
showstr += '<div><label>Architecture:</label><input type="text" disabled="disabled" value="' +
|
||||
temphash['arch'] + '"></div>';
|
||||
|
||||
return showstr;
|
||||
}
|
||||
|
||||
function createProvNonurl(plugin){
|
||||
// Create the group area
|
||||
var strGroup = '<div><label>Group:</label>';
|
||||
var groupNames = $.cookie('groups');
|
||||
if (groupNames) {
|
||||
strGroup += '<select id="' + plugin + 'group"><option></option>';
|
||||
var temp = groupNames.split(',');
|
||||
for (var i in temp) {
|
||||
strGroup += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
strGroup += '</select>';
|
||||
}
|
||||
strGroup += '</div>';
|
||||
|
||||
// Create nodes area
|
||||
var strNodes = '<div><label>Nodes:</label><div id="' + plugin + 'SelectNodesTable" ' +
|
||||
' style="display:inline-block;width:700px;overflow-y:auto;">Select a group to view its nodes</div></div>';
|
||||
|
||||
// Create architecture
|
||||
var strArch = '<div><label>Architecture:</label>';
|
||||
var archName = $.cookie('osarchs');
|
||||
if ('' != archName) {
|
||||
strArch += '<select id="arch">';
|
||||
var temp = archName.split(',');
|
||||
for (var i in temp) {
|
||||
strArch += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
strArch += '</select>';
|
||||
} else {
|
||||
strArch += '<input type="text" id="arch">';
|
||||
}
|
||||
strArch += '</div>';
|
||||
|
||||
return strGroup + strNodes + strArch;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all needed field for provsion and send the command to server
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function quickProvision(plugin){
|
||||
var errormessage = '';
|
||||
var argsArray = new Array();
|
||||
var nodesName = '';
|
||||
var provisionArg = '';
|
||||
var provisionFrame;
|
||||
var imageName = '';
|
||||
var url = '';
|
||||
var softwareArg = '';
|
||||
var containerid = plugin + 'ProvisionTab';
|
||||
$('#' + containerid + ' .ui-state-error').remove();
|
||||
|
||||
$('#' + containerid + ' input[type!="checkbox"]').each(function(){
|
||||
if ('' == $(this).val()){
|
||||
errormessage = 'You are missing input!';
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
argsArray.push($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != errormessage){
|
||||
$('#' + containerid).prepend('<p class="ui-state-error">' + errormessage + '</p>');
|
||||
return;
|
||||
}
|
||||
|
||||
//if jumped from nodes page, get nodes name from input
|
||||
if ('quick' == plugin){
|
||||
nodesName = argsArray.shift();
|
||||
}
|
||||
//select the different platform, get nodes name from table checkbox
|
||||
else{
|
||||
//should unshift the arch type
|
||||
argsArray.unshift($('#' + containerid + ' #arch').val());
|
||||
nodesName = getCheckedByObj($('#' + containerid + ' #' + plugin + 'SelectNodesTable'));
|
||||
}
|
||||
|
||||
if ('' == nodesName){
|
||||
$('#' + containerid).prepend('<p class="ui-state-error">Please select nodes first.</p>');
|
||||
return;
|
||||
}
|
||||
|
||||
softwareArg = getCheckedByObj($('#' + containerid + ' #advoption'));
|
||||
imageName = $('#' + containerid + ' #' + plugin + 'image').val();
|
||||
provisionArg = argsArray.join(',');
|
||||
url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' + nodesName + ';' + imageName + ';' +
|
||||
provisionArg + ';' + softwareArg + '&msg=&opts=flush';
|
||||
|
||||
// show the result
|
||||
var deployDia = $('<div id="deployDia"></div>');
|
||||
deployDia.append(createLoader()).append('<br/>');
|
||||
deployDia.append('<iframe id="provisionFrame" width="95%" height="90%" src="' + url + '"></iframe>');
|
||||
deployDia.dialog({
|
||||
modal: true,
|
||||
width: 600,
|
||||
height: 480,
|
||||
title:'Provision on Nodes',
|
||||
close: function(){$(this).remove();},
|
||||
buttons: {
|
||||
Close : function(){$(this).dialog('close');}
|
||||
}
|
||||
});
|
||||
|
||||
provisionStopCheck();
|
||||
}
|
||||
|
||||
function provAdvOption(imagename, plugin){
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : '-t;osimage;' + imagename + ';-i;osname,provmethod',
|
||||
msg : plugin
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
var containerid = data.msg + 'ProvisionTab';
|
||||
var index = 0;
|
||||
var osname = '';
|
||||
var provmethod = '';
|
||||
var tempstr = '';
|
||||
var position = 0;
|
||||
for (index = 0; index < data.rsp.length; index++){
|
||||
tempstr = data.rsp[index];
|
||||
if (-1 != tempstr.indexOf('osname')){
|
||||
position = tempstr.indexOf('=');
|
||||
osname = tempstr.substr(position + 1);
|
||||
}
|
||||
if (-1 != tempstr.indexOf('provmethod')){
|
||||
position = tempstr.indexOf('=');
|
||||
provmethod = tempstr.substr(position + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + containerid + ' #advoption').empty();
|
||||
if ('aix' == osname.toLowerCase()){
|
||||
return;
|
||||
}
|
||||
|
||||
if ('install' == provmethod){
|
||||
$('#' + containerid + ' #advoption').html('<input type="checkbox" checked="checked" name="ganglia">Install Ganglia.');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the nodes area base on group selected
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function createNodesArea(groupName, areaId) {
|
||||
// Get group nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodels',
|
||||
tgt : groupName,
|
||||
args : '',
|
||||
msg : areaId
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
var areaObj = $('#' + data.msg);
|
||||
var nodes = data.rsp;
|
||||
var index;
|
||||
var showStr = '<table><thead><tr><th><input type="checkbox" onclick="selectAllCheckbox(event, $(this))"></th>';
|
||||
showStr += '<th>Node</th></tr></thead><tbody>';
|
||||
for (index in nodes) {
|
||||
var node = nodes[index][0];
|
||||
if ('' == node) {
|
||||
continue;
|
||||
}
|
||||
showStr += '<tr><td><input type="checkbox" name="' + node + '"/></td><td>'
|
||||
+ node + '</td></tr>';
|
||||
}
|
||||
showStr += '</tbody></table>';
|
||||
areaObj.empty().append(showStr);
|
||||
if (index > 10) {
|
||||
areaObj.css('height', '300px');
|
||||
} else {
|
||||
areaObj.css('height', 'auto');
|
||||
}
|
||||
} // End of function(data)
|
||||
});
|
||||
}
|
||||
|
||||
function provisionStopCheck(){
|
||||
var content = $('#provisionFrame').contents().find('body').text();
|
||||
if (-1 != content.indexOf('provision stop')){
|
||||
$('#deployDia img').remove();
|
||||
clearTimeout(provisionClock);
|
||||
}
|
||||
else{
|
||||
provisionClock = setTimeout('provisionStopCheck()', 5000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all select elements' name in the obj
|
||||
*
|
||||
* @return All nodes name, seperate by ','
|
||||
*/
|
||||
function getCheckedByObj(obj) {
|
||||
var tempStr = '';
|
||||
// Get nodes that were checked
|
||||
obj.find('input:checked').each(function() {
|
||||
if ($(this).attr('name')) {
|
||||
tempStr += $(this).attr('name') + ',';
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != tempStr) {
|
||||
tempStr = tempStr.substr(0, tempStr.length - 1);
|
||||
}
|
||||
|
||||
return tempStr;
|
||||
}
|
@ -118,140 +118,21 @@ hmcPlugin.prototype.loadClonePage = function(node) {
|
||||
* @return Nothing
|
||||
*/
|
||||
hmcPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
// Get OS image names
|
||||
if (!$.cookie('imagenames')) {
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
// Create provision form
|
||||
var provForm = $('<div class="form"></div>');
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
}
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Provision a node on system P server.');
|
||||
provForm.append(infoBar);
|
||||
|
||||
// Get groups
|
||||
if (!$.cookie('groups')) {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'extnoderange',
|
||||
tgt : '/.*',
|
||||
args : 'subgroups',
|
||||
msg : ''
|
||||
},
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
success : setGroupsCookies
|
||||
});
|
||||
}
|
||||
|
||||
// Get provision tab instance
|
||||
var inst = tabId.replace('hmcProvisionTab', '');
|
||||
|
||||
// Create provision form
|
||||
var provForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBar = createStatusBar('statBar').hide();
|
||||
provForm.append(statBar);
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('loader').hide();
|
||||
statBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Provision a node on System p.');
|
||||
provForm.append(infoBar);
|
||||
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
// Create provision type drop down
|
||||
provForm.append('<div><label>Provision:</label><select><option value="existing">Existing node</option></select></div>');
|
||||
|
||||
/**
|
||||
* Create provision existing node division
|
||||
*/
|
||||
provForm.append(createHmcProvisionExisting(inst));
|
||||
|
||||
var hmcProvisionBtn = createButton('Provision');
|
||||
hmcProvisionBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
var tempTab = $(this).parent().parent();
|
||||
tempTab.find('.ui-state-error').remove();
|
||||
|
||||
var ready = true;
|
||||
var errMsg = '';
|
||||
var tempNodes = '';
|
||||
|
||||
// Get nodes that were checked
|
||||
tempNodes = getCheckedByObj(tempTab.find('table'));
|
||||
if ('' == tempNodes) {
|
||||
errMsg += 'You need to select a node.<br>';
|
||||
ready = false;
|
||||
} else {
|
||||
tempNodes = tempNodes.substr(0, tempNodes.length - 1);
|
||||
}
|
||||
|
||||
// If all inputs are valid, ready to provision
|
||||
if (ready) {
|
||||
// Disable provision button
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
// Show loader
|
||||
tempTab.find('#statBar').show();
|
||||
tempTab.find('#loader').show();
|
||||
|
||||
// Disable all selects, input and checkbox
|
||||
tempTab.find('input').attr('disabled', 'disabled');
|
||||
|
||||
// Get operating system image
|
||||
var os = tempTab.find('#osname').val();
|
||||
var arch = tempTab.find('#arch').val();
|
||||
var profile = tempTab.find('#pro').val();
|
||||
|
||||
/**
|
||||
* (1) Set operating system
|
||||
*/
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tempNodes + ';noderes.netboot=yaboot;nodetype.os=' + os
|
||||
+ ';nodetype.arch=' + arch + ';nodetype.profile=' + profile,
|
||||
msg : 'cmd=nodeadd;out=' + tempTab.attr('id')
|
||||
},
|
||||
|
||||
success : pProvisionExisting
|
||||
});
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo(tempTab);
|
||||
}
|
||||
});
|
||||
provForm.append(hmcProvisionBtn);
|
||||
|
||||
// Update the node table on group select
|
||||
provForm.find('#groupname').bind('change', function() {
|
||||
var groupName = $(this).val();
|
||||
var nodeArea = $('#hmcSelectNodesTable' + inst);
|
||||
nodeArea.empty();
|
||||
if (!groupName) {
|
||||
nodeArea.html('Select a group to view its nodes');
|
||||
return;
|
||||
}
|
||||
|
||||
nodeArea.append(createLoader());
|
||||
createNodesArea(groupName, 'hmcSelectNodesTable' + inst);
|
||||
});
|
||||
/**
|
||||
* Create provision new node division
|
||||
*/
|
||||
// You should copy whatever is in this function, put it here, and customize it
|
||||
createProvision('hmc', provForm);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -284,239 +165,3 @@ hmcPlugin.prototype.addNode = function() {
|
||||
openDialog('info', 'Under construction');
|
||||
};
|
||||
|
||||
/**
|
||||
* Create hmc provision existing form
|
||||
*
|
||||
* @return: Form content
|
||||
*/
|
||||
function createHmcProvisionExisting(inst) {
|
||||
// Create the group area
|
||||
var strGroup = '<div><label>Group:</label>';
|
||||
var groupNames = $.cookie('groups');
|
||||
if (groupNames) {
|
||||
strGroup += '<select id="groupname"><option></option>';
|
||||
var temp = groupNames.split(',');
|
||||
for (var i in temp) {
|
||||
strGroup += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
strGroup += '</select>';
|
||||
} else {
|
||||
strGroup += '<input type="text" id="groupname">';
|
||||
}
|
||||
strGroup += '</div>';
|
||||
|
||||
// Create nodes area
|
||||
var strNodes = '<div><label>Nodes:</label><div id="hmcSelectNodesTable'
|
||||
+ inst
|
||||
+ '" style="display:inline-block;width:700px;overflow-y:auto;">Select a group to view its nodes</div></div>';
|
||||
|
||||
// Create boot method
|
||||
var strBoot = '<div><label>Boot Method:</label><select id="boot">'
|
||||
+ '<option value="install">install</option>'
|
||||
+ '<option value="netboot">netboot</option>'
|
||||
+ '<option value="statelite">statelite</option></select></div>';
|
||||
|
||||
// Create operating system
|
||||
var strOs = '<div><label>Operating system:</label>';
|
||||
var osName = $.cookie('osvers');
|
||||
if (osName) {
|
||||
strOs += '<select id="osname">';
|
||||
var temp = osName.split(',');
|
||||
for (var i in temp) {
|
||||
strOs += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
strOs += '</select>';
|
||||
} else {
|
||||
strOs += '<input type="text" id="osname">';
|
||||
}
|
||||
strOs += '</div>';
|
||||
|
||||
// Create architecture
|
||||
var strArch = '<div><label>Architecture:</label>';
|
||||
var archName = $.cookie('osarchs');
|
||||
if ('' != archName) {
|
||||
strArch += '<select id="arch">';
|
||||
var temp = archName.split(',');
|
||||
for (var i in temp) {
|
||||
strArch += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
strArch += '</select>';
|
||||
} else {
|
||||
strArch += '<input type="text" id="arch">';
|
||||
}
|
||||
strArch += '</div>';
|
||||
|
||||
// Create profile
|
||||
var strPro = '<div><label>Profile:</label>';
|
||||
var proName = $.cookie('profiles');
|
||||
if ('' != proName) {
|
||||
strPro += '<select id="pro">';
|
||||
var temp = proName.split(',');
|
||||
for (var i in temp) {
|
||||
strPro += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
strPro += '</select>';
|
||||
} else {
|
||||
strPro += '<input type="text" id="pro">';
|
||||
}
|
||||
strPro += '</div>';
|
||||
|
||||
var strRet = strGroup + strNodes + strBoot + strOs + strArch + strPro;
|
||||
return strRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the nodes area base on group selected
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function createNodesArea(groupName, areaId) {
|
||||
// Get group nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodels',
|
||||
tgt : groupName,
|
||||
args : '',
|
||||
msg : areaId
|
||||
},
|
||||
|
||||
/**
|
||||
* Create nodes datatable
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function(data) {
|
||||
var areaObj = $('#' + data.msg);
|
||||
var nodes = data.rsp;
|
||||
var index;
|
||||
var showStr = '<table><thead><tr><th><input type="checkbox" onclick="selectAllCheckbox(event, $(this))"></th>';
|
||||
showStr += '<th>Node</th></tr></thead><tbody>';
|
||||
for (index in nodes) {
|
||||
var node = nodes[index][0];
|
||||
if ('' == node) {
|
||||
continue;
|
||||
}
|
||||
showStr += '<tr><td><input type="checkbox" name="' + node + '"/></td><td>'
|
||||
+ node + '</td></tr>';
|
||||
}
|
||||
showStr += '</tbody></table>';
|
||||
areaObj.empty().append(showStr);
|
||||
if (index > 10) {
|
||||
areaObj.css('height', '300px');
|
||||
} else {
|
||||
areaObj.css('height', 'auto');
|
||||
}
|
||||
} // End of function(data)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Provision for existing system p node
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function pProvisionExisting(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get provision tab instance
|
||||
var tabId = args[1].replace('out=', '');
|
||||
|
||||
// Get tab obj
|
||||
var tempTab = $('#' + tabId);
|
||||
|
||||
/**
|
||||
* (2) Prepare node for boot
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
// Get operating system
|
||||
var bootMethod = tempTab.find('#boot').val();
|
||||
|
||||
// Get nodes that were checked
|
||||
var tgts = getCheckedByObj(tempTab.find('table'));
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : bootMethod,
|
||||
msg : 'cmd=nodeset;out=' + tabId
|
||||
},
|
||||
|
||||
success : pProvisionExisting
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (3) Boot node from network
|
||||
*/
|
||||
else if (cmd == 'nodeset') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
tempTab.find('#statBar div').append(prg);
|
||||
|
||||
// If there was an error, do not continue
|
||||
if (prg.html().indexOf('Error') > -1) {
|
||||
tempTab.find('#loader').remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get nodes that were checked
|
||||
var tgts = getCheckedByObj(tempTab.find('table'));
|
||||
|
||||
// Boot node from network
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rnetboot',
|
||||
tgt : tgts,
|
||||
args : '',
|
||||
msg : 'cmd=rnetboot;out=' + tabId
|
||||
},
|
||||
|
||||
success : pProvisionExisting
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (4) Done
|
||||
*/
|
||||
else if (cmd == 'rnetboot') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
tempTab.find('#statBar div').append(prg);
|
||||
tempTab.find('#loader').remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all select elements' name in the obj
|
||||
*
|
||||
* @return All nodes name, seperate by ','
|
||||
*/
|
||||
function getCheckedByObj(obj) {
|
||||
var tempStr = '';
|
||||
// Get nodes that were checked
|
||||
obj.find('input:checked').each(function() {
|
||||
if ($(this).attr('name')) {
|
||||
tempStr += $(this).attr('name') + ',';
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != tempStr) {
|
||||
tempStr = tempStr.substr(0, tempStr.length - 1);
|
||||
}
|
||||
|
||||
return tempStr;
|
||||
}
|
@ -98,50 +98,21 @@ ipmiPlugin.prototype.loadClonePage = function(node) {
|
||||
* @return Nothing
|
||||
*/
|
||||
ipmiPlugin.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('ipmiProvisionTab', '');
|
||||
|
||||
// Create provision form
|
||||
var provForm = $('<div class="form"></div>');
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Provision an iDataPlex. This will install an operating system onto the iDataPlex.');
|
||||
var infoBar = createInfoBar('Provision a node on iDataPlex.');
|
||||
provForm.append(infoBar);
|
||||
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
// Create provision existing node division
|
||||
var provExisting = createIpmpProvisionExisting(inst);
|
||||
provForm.append(provExisting);
|
||||
/**
|
||||
* Create provision new node division
|
||||
*/
|
||||
// You should copy whatever is in this function, put it here, and customize it
|
||||
createProvision('ipmi', provForm);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -265,413 +236,3 @@ function addidataplexNode(){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create provision existing node division
|
||||
*
|
||||
* @param inst
|
||||
* Provision tab instance
|
||||
* @return Provision existing node division
|
||||
*/
|
||||
function createIpmpProvisionExisting(inst) {
|
||||
// Create provision existing division
|
||||
var provExisting = $('<div></div>');
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label for="provType">Group:</label>');
|
||||
group.append(groupLabel);
|
||||
|
||||
// Turn on auto complete for group
|
||||
var dTableDivId = 'ipmiNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
|
||||
var groupNames = $.cookie('groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
|
||||
// Create drop down for groups
|
||||
var groupSelect = $('<select></select>');
|
||||
groupSelect.append('<option></option>');
|
||||
for ( var i in tmp) {
|
||||
// Add group into drop down
|
||||
var opt = $('<option value="' + tmp[i] + '">' + tmp[i] + '</option>');
|
||||
groupSelect.append(opt);
|
||||
}
|
||||
group.append(groupSelect);
|
||||
|
||||
// Create node datatable
|
||||
groupSelect.change(function() {
|
||||
// Get group selected
|
||||
var thisGroup = $(this).val();
|
||||
// If a valid group is selected
|
||||
if (thisGroup) {
|
||||
createNodesDatatable(thisGroup, dTableDivId);
|
||||
} // End of if (thisGroup)
|
||||
});
|
||||
} else {
|
||||
// If no groups are cookied
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
provExisting.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
var nodeLabel = $('<label for="nodeName">Nodes:</label>');
|
||||
var nodeDatatable = $('<div id="' + dTableDivId + '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeDatatable);
|
||||
provExisting.append(node);
|
||||
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label for="method">Boot method:</label>');
|
||||
var methodSelect = $('<select id="bootMethod" name="bootMethod"></select>');
|
||||
methodSelect.append('<option value=""></option>'
|
||||
+ '<option value="boot">boot</option>'
|
||||
+ '<option value="install">install</option>'
|
||||
+ '<option value="iscsiboot">iscsiboot</option>'
|
||||
+ '<option value="netboot">netboot</option>'
|
||||
+ '<option value="statelite">statelite</option>'
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
provExisting.append(method);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label for="os">Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
provExisting.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label for="arch">Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
provExisting.append(arch);
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label for="profile">Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
provExisting.append(profile);
|
||||
|
||||
/**
|
||||
* Provision existing
|
||||
*/
|
||||
var provisionBtn = createButton('Provision');
|
||||
provisionBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
var errorMessage = '';
|
||||
|
||||
// Get provision tab ID
|
||||
var thisTabId = 'ipmiProvisionTab' + inst;
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'ipmiNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
if (!tgts) {
|
||||
errorMessage += 'You need to select a node. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// Check booth method
|
||||
var boot = $('#' + thisTabId + ' select[name=bootMethod]');
|
||||
if (!boot.val()) {
|
||||
errorMessage += 'You need to select a boot method. ';
|
||||
boot.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
boot.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// Check operating system image
|
||||
var os = $('#' + thisTabId + ' input[name=os]');
|
||||
if (!os.val()) {
|
||||
errorMessage += 'You need to select a operating system image. ';
|
||||
os.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
os.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// Check architecture
|
||||
var arch = $('#' + thisTabId + ' input[name=arch]');
|
||||
if (!arch.val()) {
|
||||
errorMessage += 'You need to select an architecture. ';
|
||||
arch.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
arch.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// Check profile
|
||||
var profile = $('#' + thisTabId + ' input[name=profile]');
|
||||
if (!profile.val()) {
|
||||
errorMessage += 'You need to select a profile. ';
|
||||
profile.css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
profile.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
// If all inputs are valid, ready to provision
|
||||
if (ready) {
|
||||
// Disable provision button
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
// Prepend status bar
|
||||
var statBar = createStatusBar('ipmiProvisionStatBar' + inst);
|
||||
statBar.append(createLoader(''));
|
||||
statBar.prependTo($('#' + thisTabId));
|
||||
|
||||
// Disable all inputs
|
||||
var inputs = $('#' + thisTabId + ' input');
|
||||
inputs.attr('disabled', 'disabled');
|
||||
|
||||
// Disable all selects
|
||||
var selects = $('#' + thisTabId + ' select');
|
||||
selects.attr('disabled', 'disabled');
|
||||
|
||||
/**
|
||||
* (1) Set operating system
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=xnba;nodetype.os=' + os.val() + ';nodetype.arch=' + arch.val() + ';nodetype.profile=' + profile.val(),
|
||||
msg : 'cmd=nodeadd;out=' + inst
|
||||
},
|
||||
|
||||
success : updateIpmiProvisionExistingStatus
|
||||
});
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errorMessage);
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
provExisting.append(provisionBtn);
|
||||
|
||||
return provExisting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create nodes datatable for a given group
|
||||
*
|
||||
* @param group
|
||||
* Group name
|
||||
* @param outId
|
||||
* Division ID to append datatable
|
||||
* @return Nodes datatable
|
||||
*/
|
||||
function createNodesDatatable(group, outId) {
|
||||
// Get group nodes
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : group,
|
||||
msg : outId
|
||||
},
|
||||
|
||||
/**
|
||||
* Create nodes datatable
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function(data) {
|
||||
// Data returned
|
||||
var rsp = data.rsp;
|
||||
|
||||
// Get output ID
|
||||
var outId = data.msg;
|
||||
// Get datatable ID
|
||||
var dTableId = outId.replace('DIV', '');
|
||||
|
||||
// Node attributes hash
|
||||
var attrs = new Object();
|
||||
// Node attributes
|
||||
var headers = new Object();
|
||||
|
||||
// Clear nodes datatable division
|
||||
$('#' + outId).empty();
|
||||
|
||||
// Create nodes datatable
|
||||
var node, args;
|
||||
for ( var i in rsp) {
|
||||
// Get node
|
||||
var pos = rsp[i].indexOf('Object name:');
|
||||
if (pos > -1) {
|
||||
var temp = rsp[i].split(': ');
|
||||
node = jQuery.trim(temp[1]);
|
||||
|
||||
// Create a hash for the node attributes
|
||||
attrs[node] = new Object();
|
||||
i++;
|
||||
}
|
||||
|
||||
// Get key and value
|
||||
args = rsp[i].split('=');
|
||||
var key = jQuery.trim(args[0]);
|
||||
var val = jQuery.trim(args[1]);
|
||||
|
||||
// Create hash table
|
||||
attrs[node][key] = val;
|
||||
headers[key] = 1;
|
||||
}
|
||||
|
||||
// Sort headers
|
||||
var sorted = new Array();
|
||||
for ( var key in headers) {
|
||||
sorted.push(key);
|
||||
}
|
||||
sorted.sort();
|
||||
|
||||
// Add column for check box and node
|
||||
sorted.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'node');
|
||||
|
||||
// Create nodes datatable
|
||||
var dTable = new DataTable(dTableId);
|
||||
dTable.init(sorted);
|
||||
|
||||
// Go through each node
|
||||
for ( var node in attrs) {
|
||||
// Create a row
|
||||
var row = new Array();
|
||||
// Create a check box
|
||||
var checkBx = '<input type="checkbox" name="' + node + '"/>';
|
||||
row.push(checkBx, node);
|
||||
|
||||
// Go through each header
|
||||
for ( var i = 2; i < sorted.length; i++) {
|
||||
// Add node attributes to the row
|
||||
var key = sorted[i];
|
||||
var val = attrs[node][key];
|
||||
if (val) {
|
||||
row.push(val);
|
||||
} else {
|
||||
row.push('');
|
||||
}
|
||||
}
|
||||
|
||||
// Add row to table
|
||||
dTable.add(row);
|
||||
}
|
||||
|
||||
$('#' + outId).append(dTable.object());
|
||||
$('#' + dTableId).dataTable();
|
||||
} // End of function(data)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the provision existing node status
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
function updateIpmiProvisionExistingStatus(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get provision tab instance
|
||||
var inst = args[1].replace('out=', '');
|
||||
|
||||
// Get provision tab and status bar ID
|
||||
var statBarId = 'ipmiProvisionStatBar' + inst;
|
||||
var tabId = 'ipmiProvisionTab' + inst;
|
||||
|
||||
/**
|
||||
* (2) Remote install
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Get parameters
|
||||
var os = $('#' + tabId + ' input[name="os"]').val();
|
||||
var profile = $('#' + tabId + ' input[name="profile"]').val();
|
||||
var arch = $('#' + tabId + ' input[name="arch"]').val();
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'ipmiNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
// Begin installation
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'rinstall;' + os + ';' + profile + ';' + arch + ';' + tgts,
|
||||
msg : 'cmd=rinstall;out=' + inst
|
||||
},
|
||||
|
||||
success : updateIpmiProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (3) Done
|
||||
*/
|
||||
else if (cmd == 'rinstall') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
$('#' + statBarId).find('img').remove();
|
||||
|
||||
// If installation was successful
|
||||
if (prg.html().indexOf('Error') == -1) {
|
||||
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use nodestat to check the status of the install.</pre>');
|
||||
}
|
||||
}
|
||||
}
|
@ -769,7 +769,8 @@ function loadNodes(data) {
|
||||
provisionLnk.click(function(){
|
||||
var tgtNodes = getNodesChecked(nodesTableId);
|
||||
if (tgtNodes){
|
||||
openQuickProvisionDia(tgtNodes);
|
||||
//jump to the provision page directly
|
||||
jumpProvision(tgtNodes);
|
||||
}
|
||||
});
|
||||
|
||||
@ -3194,7 +3195,7 @@ function advancedLoad(group){
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function openQuickProvisionDia(tgtnodes){
|
||||
function jumpProvision(tgtnodes){
|
||||
var nodeArray = tgtnodes.split(',');
|
||||
var nodeName = '';
|
||||
var index = 0;
|
||||
@ -3249,169 +3250,8 @@ function openQuickProvisionDia(tgtnodes){
|
||||
return;
|
||||
}
|
||||
|
||||
// organize the provison dialog
|
||||
var showstr = '<table><tbody>';
|
||||
showstr += '<tr><td>Target node:</td><td><input id="nodesinput" value="' + tgtnodes + '" readonly="readonly"></td></tr>';
|
||||
showstr += '<tr><td>Arch:</td><td><input id="archinput" value="' + archtype + '" disabled="disabled"></td></tr>';
|
||||
showstr += '<tr><td>Image:</td><td><select></select></td></tr>';
|
||||
showstr += '<tr><td>Install Nic:</td><td><input id="inicinput" value="ent0"></td></tr>';
|
||||
showstr += '<tr><td>Primary Nic:</td><td><input id="pnicinput" value="ent0"></td></tr>';
|
||||
showstr += '<tr><td>xCAT Master:</td><td><input id="masterinput"></td></tr>';
|
||||
showstr += '<tr><td>TFTP Server:</td><td><input id="tftpinput"></td></tr>';
|
||||
showstr += '<tr><td>NFS Server:</td><td><input id="nfsinput"></td></tr>';
|
||||
showstr += '</tbody></table>';
|
||||
showstr += '<div id="advoption"></div>';
|
||||
diaDiv.append(showstr);
|
||||
diaDiv.dialog({
|
||||
modal: true,
|
||||
width: 400,
|
||||
height: 480,
|
||||
close: function(){$(this).remove();},
|
||||
buttons: {
|
||||
'Close': function(){$(this).remove();}
|
||||
}
|
||||
});
|
||||
|
||||
$('#deployDiv select').parent().append(createLoader());
|
||||
$('#deployDiv select').bind('change', function(){
|
||||
$('#deployDiv #advoption').html('<img src="images/loader.gif"></img>');
|
||||
provisionAdvOption($(this).val());
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : '-t;osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
var index = 0;
|
||||
var imagename = 0;
|
||||
var position = 0;
|
||||
$('#deployDiv img').remove();
|
||||
if (data.rsp.lenght < 1){
|
||||
$('#deployDiv').append(createWarnBar('Please copycds and genimage in provision page first!'));
|
||||
return;
|
||||
}
|
||||
|
||||
for (index in data.rsp){
|
||||
imagename = data.rsp[index];
|
||||
position = imagename.indexOf(' ');
|
||||
imagename = imagename.substr(0, position);
|
||||
|
||||
$('#deployDiv select').append('<option value="' + imagename + '">' + imagename + '</option>');
|
||||
}
|
||||
|
||||
$('#deployDiv select').trigger('change');
|
||||
|
||||
$('#deployDiv').dialog( "option", "buttons", {'Ok': function(){quickProvision();},
|
||||
'Cancel': function(){$(this).remove();}}
|
||||
);
|
||||
}
|
||||
});
|
||||
window.location.href = 'provision.php?nodes=' + tgtnodes + '&arch=' + archtype;
|
||||
}
|
||||
|
||||
function provisionAdvOption(imagename){
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : '-t;osimage;' + imagename + ';-i;osname,provmethod',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
var index = 0;
|
||||
var osname = '';
|
||||
var provmethod = '';
|
||||
var tempstr = '';
|
||||
var position = 0;
|
||||
for (index = 0; index < data.rsp.length; index++){
|
||||
tempstr = data.rsp[index];
|
||||
if (-1 != tempstr.indexOf('osname')){
|
||||
position = tempstr.indexOf('=');
|
||||
osname = tempstr.substr(position + 1);
|
||||
}
|
||||
if (-1 != tempstr.indexOf('provmethod')){
|
||||
position = tempstr.indexOf('=');
|
||||
provmethod = tempstr.substr(position + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$('#deployDiv #advoption').empty();
|
||||
if ('aix' == osname.toLowerCase()){
|
||||
return;
|
||||
}
|
||||
|
||||
if ('install' == provmethod){
|
||||
$('#deployDiv #advoption').html('<input type="checkbox" checked="checked">Install Ganglia.');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* get all needed field for provsion and send the command to server
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function quickProvision(){
|
||||
var errormessage = '';
|
||||
var argsArray = new Array();
|
||||
var nodesName = '';
|
||||
var provisionArg = '';
|
||||
var provisionFrame;
|
||||
var imageName = '';
|
||||
var url = '';
|
||||
$('#deployDiv .ui-state-error').remove();
|
||||
$('#deployDiv input').each(function(){
|
||||
if ('' == $(this).val()){
|
||||
errormessage = 'You are missing input!';
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != errormessage){
|
||||
$('#deployDiv').prepend('<p class="ui-state-error">' + errormessage + '</p>');
|
||||
return;
|
||||
}
|
||||
|
||||
$('#deployDiv input').each(function(){
|
||||
argsArray.push($(this).val());
|
||||
});
|
||||
|
||||
nodesName = argsArray.shift();
|
||||
imageName = $('#deployDiv select').val();
|
||||
provisionArg = argsArray.join(',');
|
||||
url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' + nodesName + ';' + imageName + ';' + provisionArg + '&msg=&opts=flush';
|
||||
|
||||
// show the result
|
||||
$('#deployDiv').empty().append(createLoader()).append('<br/>');
|
||||
$('#deployDiv').dialog( "option", "buttons", {'Close': function(){$(this).remove();clearTimeout(provisionClock);}});
|
||||
$('#deployDiv').dialog( "option", "width", 600);
|
||||
provisionFrame = $('<iframe id="provisionFrame" width="95%" height="90%"></iframe>');
|
||||
$('#deployDiv').append(provisionFrame);
|
||||
|
||||
provisionFrame.attr('src', url);
|
||||
provisionStopCheck();
|
||||
}
|
||||
|
||||
function provisionStopCheck(){
|
||||
var content = $('#provisionFrame').contents().find('body').text();
|
||||
if (-1 != content.indexOf('provision stop')){
|
||||
$('#deployDiv img').remove();
|
||||
clearTimeout(provisionClock);
|
||||
}
|
||||
else{
|
||||
provisionClock = setTimeout('provisionStopCheck()', 5000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust datatable column size
|
||||
*/
|
||||
|
@ -101,38 +101,40 @@ function loadProvisionPage() {
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
var newTabId = hw + 'ProvisionTab';
|
||||
|
||||
// Generate new tab ID
|
||||
var instance = 0;
|
||||
var newTabId = hw + 'ProvisionTab' + instance;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
instance = instance + 1;
|
||||
newTabId = hw + 'ProvisionTab' + instance;
|
||||
}
|
||||
if ($('#' + newTabId).size() > 0){
|
||||
tab.select(newTabId);
|
||||
}
|
||||
else{
|
||||
var tabtitle = '';
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
tabtitle = 'Blade';
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
tabtitle = 'System P';
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
tabtitle = 'System X';
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
tabtitle = 'ZVM';
|
||||
break;
|
||||
}
|
||||
|
||||
tab.add(newTabId, hw, '', true);
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.select(newTabId);
|
||||
plugin.loadProvisionPage(newTabId);
|
||||
// Select tab
|
||||
tab.add(newTabId, tabtitle, '', true);
|
||||
tab.select(newTabId);
|
||||
plugin.loadProvisionPage(newTabId);
|
||||
}
|
||||
});
|
||||
provPg.append(okBtn);
|
||||
|
||||
@ -143,4 +145,14 @@ function loadProvisionPage() {
|
||||
var loader = $('<center></center>').append(createLoader(''));
|
||||
tab.add('imagesTab', 'Images', loader, false);
|
||||
loadImagesPage();
|
||||
|
||||
//should open the quick provision tab
|
||||
if (window.location.search){
|
||||
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
||||
tab.select('quickProvisionTab');
|
||||
|
||||
var provForm = $('<div class="form"></div>');
|
||||
$('#quickProvisionTab').append(provForm);
|
||||
createProvision('quick', provForm);
|
||||
}
|
||||
}
|
@ -479,6 +479,7 @@ function initPage() {
|
||||
includeJs("js/custom/ipmi.js");
|
||||
includeJs("js/custom/zvm.js");
|
||||
includeJs("js/custom/hmc.js");
|
||||
includeJs("js/custom/customUtils.js");
|
||||
|
||||
// Get the page being loaded
|
||||
var url = window.location.pathname;
|
||||
|
Loading…
x
Reference in New Issue
Block a user