Cleaned up code. Fixed spelling mistakes.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10502 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
a57c83cb8a
commit
057b05e3bf
@ -170,91 +170,96 @@ bladePlugin.prototype.loadResources = function() {
|
||||
* @return Nothing
|
||||
*/
|
||||
bladePlugin.prototype.addNode = function() {
|
||||
var nodeTypeSelectDia = $('<div id="nodeTypeSelectDia" class="form"></div>');
|
||||
var info = createInfoBar('Add a node range');
|
||||
nodeTypeSelectDia.append(info);
|
||||
nodeTypeSelectDia.append('<div><label for="mgt">Node type:</label><select id="nodeTypeSelect">' +
|
||||
'<option value="mm">AMM</option><option value="blade">Blade</option></select></div>');
|
||||
var diag = $('<div id="addBC" class="form"></div>');
|
||||
var info = createInfoBar('Add an Advanced Management Module (AMM) or blade');
|
||||
diag.append(info);
|
||||
|
||||
// Select node type
|
||||
diag.append($('<div><label>Node type:</label>' +
|
||||
'<select name="nodeType">' +
|
||||
'<option value="mm">AMM</option>' +
|
||||
'<option value="blade">Blade</option>' +
|
||||
'</select></div>'));
|
||||
|
||||
//append the mm div
|
||||
var mmStr = '<div id="mmNode">' +
|
||||
'<label>AMM name: </label><input id="ammName" type="text"></input><br/><br/>' +
|
||||
'<label>AMM IP: </label><input id="ammIp" type="text"></input>' +
|
||||
'</div>';
|
||||
// Advanced Management Module (AMM) section
|
||||
var amm = $('<div id="amm"></div>');
|
||||
amm.append($('<div><label>AMM name: </label><input name="ammName" type="text"></input></div>'));
|
||||
amm.append($('<div><label>AMM IP: </label><input name="ammIp" type="text"></div>'));
|
||||
diag.append(amm);
|
||||
|
||||
//append the blade div
|
||||
var bladeStr = '<div id="bladeNode" style="display:none;">' +
|
||||
'<label>Blade Name: </label><input id="bladeName" type="text"></input><br/><br/>' +
|
||||
'<label>Blade Group: </label><input id="bladeGroup" type="text"></input><br/><br/>' +
|
||||
'<label>Blade ID: </label><input id="bladeId" type="text"></input><br/><br/>' +
|
||||
'<label>Blade Series: </label><input type="radio" name="series" value="js"/>JS<input type="radio" name="series" value="ls"/>LS<br/><br/>' +
|
||||
'<label>Blade MPA: </label><select id="mpaSelect"></select>';
|
||||
nodeTypeSelectDia.append(mmStr);
|
||||
nodeTypeSelectDia.append(bladeStr);
|
||||
// Blade section
|
||||
var blade = $('<div id="blade"></div>').hide();
|
||||
blade.append($('<div><label>Blade name:</label><input name="bladeName" type="text"></input></div>'));
|
||||
blade.append($('<div><label>Blade group:</label><input name="bladeGroup" type="text"></input></div>'));
|
||||
blade.append($('<div><label>Blade ID:</label><input name="bladeId" type="text"></input></div>'));
|
||||
blade.append($('<div><label>Blade series:</label><input type="radio" name="series" value="js"/>JS <input type="radio" name="series" value="ls"/>LS</div>'));
|
||||
blade.append($('<div><label>Blade MPA:</label><select name="mpa"></select></div>'));
|
||||
diag.append(blade);
|
||||
|
||||
nodeTypeSelectDia.find('#nodeTypeSelect').bind('change', function(){
|
||||
$('#nodeTypeSelectDia .ui-state-error').remove();
|
||||
$('#mmNode').toggle();
|
||||
$('#bladeNode').toggle();
|
||||
if ('mm' == $(this).val()){
|
||||
return;
|
||||
}
|
||||
diag.find('select[name="nodeType"]').bind('change', function(){
|
||||
diag.find('.ui-state-error').remove();
|
||||
$('#amm').toggle();
|
||||
$('#blade').toggle();
|
||||
|
||||
if ($(this).val() == 'mm') {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#blade select').empty();
|
||||
$('#blade select').parent().append(createLoader());
|
||||
|
||||
//get all mm nodes from the server side
|
||||
$('#bladeNode select').empty();
|
||||
$('#bladeNode').append(createLoader());
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : '-t;node;-w;mgt==blade;-w;id==0',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data){
|
||||
var position = 0;
|
||||
var tempStr = '';
|
||||
var options = '';
|
||||
//remove the loading image
|
||||
$('#bladeNode img').remove();
|
||||
// Get AMMs
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsdef',
|
||||
tgt : '',
|
||||
args : '-t;node;-w;mgt==blade;-w;id==0',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
var position = 0;
|
||||
var temp = '';
|
||||
var options = '';
|
||||
|
||||
// Remove loader
|
||||
$('#blade img').remove();
|
||||
|
||||
//check return result
|
||||
if (1 > data.rsp.length){
|
||||
$('#nodeTypeSelectDia').prepend(createWarnBar('Please define MM node first!'));
|
||||
return;
|
||||
}
|
||||
// Check output
|
||||
if (!data.rsp.length){
|
||||
$('#addBC').prepend(createWarnBar('Please define the AMM node first!'));
|
||||
return;
|
||||
}
|
||||
|
||||
//add all mm nodes to select
|
||||
for (var i in data.rsp){
|
||||
tempStr = data.rsp[i];
|
||||
position = tempStr.indexOf(' ');
|
||||
tempStr = tempStr.substring(0, position);
|
||||
options += '<option value="' + tempStr + '">' + tempStr + '</option>';
|
||||
}
|
||||
// Add AMMs to select
|
||||
for (var i in data.rsp){
|
||||
temp = data.rsp[i];
|
||||
position = temp.indexOf(' ');
|
||||
temp = temp.substring(0, position);
|
||||
options += '<option value="' + temp + '">' + temp + '</option>';
|
||||
}
|
||||
|
||||
$('#bladeNode select').append(options);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#blade select').append(options);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
nodeTypeSelectDia.dialog( {
|
||||
diag.dialog({
|
||||
modal : true,
|
||||
width : 400,
|
||||
title : 'Select Node Type',
|
||||
open : function(event, ui) {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
},
|
||||
buttons : {
|
||||
'Ok' : function() {
|
||||
//remove all error bar
|
||||
$('#nodeTypeSelectDia .ui-state-error').remove();
|
||||
// Remove existing warnings
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
if ($('#nodeTypeSelect').attr('value') == "mm") {
|
||||
if ($(this).find('select[name="nodeType"]').attr('value') == "mm") {
|
||||
addMmNode();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
addBladeNode();
|
||||
}
|
||||
},
|
||||
@ -265,67 +270,80 @@ bladePlugin.prototype.addNode = function() {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Add AMM node
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function addMmNode(){
|
||||
var name = $('#ammName').val();
|
||||
var ip = $('#ammIp').val();
|
||||
var name = $('#addBC input[name="ammName"]').val();
|
||||
var ip = $('#addBC input[name="ammIp"]').val();
|
||||
|
||||
if ((!name) || (!ip)){
|
||||
$('#nodeTypeSelectDia').prepend(createWarnBar("You are missing some inputs!"));
|
||||
if (!name || !ip){
|
||||
$('#addBC').prepend(createWarnBar('You are missing some inputs!'));
|
||||
return;
|
||||
}
|
||||
|
||||
//add the loader
|
||||
$('#nodeTypeSelectDia').prepend(createLoader());
|
||||
// Add loader
|
||||
$('#addBC').prepend(createLoader());
|
||||
$('.ui-dialog-buttonpane .ui-button').attr('disabled', true);
|
||||
var argsTmp = '-t;node;-o;' + name +
|
||||
';id=0;nodetype=mm;groups=mm;mgt=blade;mpa=' + name + ';ip=' + ip;
|
||||
|
||||
var args = '-t;node;-o;' + name + ';id=0;nodetype=mm;groups=mm;mgt=blade;mpa=' + name + ';ip=' + ip;
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chdef',
|
||||
tgt : '',
|
||||
args : argsTmp,
|
||||
args : args,
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
$('#nodeTypeSelectDia').find('img').remove();
|
||||
var messages = data.rsp;
|
||||
var notes = "";
|
||||
for ( var i = 0; i < messages.length; i++) {
|
||||
notes += messages[i];
|
||||
// Remove loader
|
||||
$('#addBC').find('img').remove();
|
||||
|
||||
var rsp = data.rsp;
|
||||
var messages = '';
|
||||
for (var i = 0; i < rsp.length; i++) {
|
||||
messages += rsp[i] + ' ';
|
||||
}
|
||||
var info = createInfoBar(notes);
|
||||
$('#nodeTypeSelectDia').prepend(info);
|
||||
$('#nodeTypeSelectDia').dialog("option", "buttons", {
|
||||
"close" : function() {
|
||||
$('#nodeTypeSelectDia').remove();
|
||||
|
||||
$('#addBC').prepend(createInfoBar(messages));
|
||||
$('#addBC').dialog('option', 'buttons', {
|
||||
'Close' : function() {
|
||||
$('#addBC').remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add blade node
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function addBladeNode(){
|
||||
var name = $('#bladeName').val();
|
||||
var group = $('#bladeGroup').val();
|
||||
var id = $('#bladeId').val();
|
||||
var series = $("#bladeNode :checked").val();
|
||||
var mpa = $('#mpaSelect').val();
|
||||
var name = $('#addBC input[name="bladeName"]').val();
|
||||
var group = $('#addBC input[name="bladeGroup"]').val();
|
||||
var id = $('#addBC input[name="bladeId"]').val();
|
||||
var series = $('#addBC input[name="bladeNode"]:checked').val();
|
||||
var mpa = $('#addBC select[name="mpa"]').val();
|
||||
|
||||
var argsTmp = '-t;node;-o;' + name + ';id=' + id +
|
||||
';nodetype=osi;groups=' + group + ';mgt=blade;mpa=' + mpa + ';serialflow=hard';
|
||||
var args = '-t;node;-o;' + name + ';id=' + id + ';nodetype=osi;groups=' + group + ';mgt=blade;mpa=' + mpa + ';serialflow=hard';
|
||||
if (series != 'js') {
|
||||
argsTmp += ';serialspeed=19200;serialport=1';
|
||||
args += ';serialspeed=19200;serialport=1';
|
||||
}
|
||||
|
||||
if ((!name) || (!group) || (!id) || (!mpa)){
|
||||
$('#nodeTypeSelectDia').prepend(createWarnBar("You miss some inputs."));
|
||||
// Check blade properties
|
||||
if (!name || !group || !id || !mpa){
|
||||
$('#addBC').prepend(createWarnBar('You are missing some inputs!'));
|
||||
return;
|
||||
}
|
||||
|
||||
//add loader and disable buttons
|
||||
$('#nodeTypeSelectDia').prepend(createLoader());
|
||||
// Add loader and disable buttons
|
||||
$('#addBC').prepend(createLoader());
|
||||
$('.ui-dialog-buttonpane .ui-button').attr('disabled', true);
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -333,21 +351,21 @@ function addBladeNode(){
|
||||
data : {
|
||||
cmd : 'chdef',
|
||||
tgt : '',
|
||||
args : argsTmp,
|
||||
args : args,
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
$('#nodeTypeSelectDia').find('img').remove();
|
||||
var messages = data.rsp;
|
||||
var notes = "";
|
||||
for ( var i = 0; i < messages.length; i++) {
|
||||
notes += messages[i];
|
||||
$('#addBC').find('img').remove();
|
||||
var rsp = data.rsp;
|
||||
var messages = '';
|
||||
for (var i = 0; i < rsp.length; i++) {
|
||||
messages += rsp[i] + ' ';
|
||||
}
|
||||
|
||||
$('#nodeTypeSelectDia').prepend(createInfoBar(notes));
|
||||
$('#nodeTypeSelectDia').dialog("option", "buttons", {
|
||||
"close" : function() {
|
||||
$('#nodeTypeSelectDia').remove();
|
||||
$('#addBC').prepend(createInfoBar(messages));
|
||||
|
||||
$('#addBC').dialog('option', 'buttons', {
|
||||
'Close' : function() {
|
||||
$('#addBC').remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
var provisionClock;
|
||||
|
||||
/**
|
||||
* Create nodes datatable for a given group
|
||||
*
|
||||
@ -7,9 +9,6 @@
|
||||
* Division ID to append datatable
|
||||
* @return Nodes datatable
|
||||
*/
|
||||
|
||||
var provisionClock;
|
||||
|
||||
function createNodesDatatable(group, outId) {
|
||||
// Get group nodes
|
||||
$.ajax( {
|
||||
@ -385,26 +384,32 @@ function createProvisionNew(plugin, inst) {
|
||||
return provNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create provision node division
|
||||
*
|
||||
* @param plugin
|
||||
* Plugin name to create division for
|
||||
* @param container
|
||||
* Container to hold provisioning form
|
||||
* @return Nothing
|
||||
*/
|
||||
function createProvision(plugin, container){
|
||||
var showStr = '';
|
||||
|
||||
//group, nodes, arch
|
||||
if ('quick' == plugin){
|
||||
// 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');
|
||||
} else {
|
||||
container.append(createProvNoUrl(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');
|
||||
});
|
||||
}
|
||||
|
||||
//option
|
||||
// Advanced options
|
||||
container.append('<div id="advoption"></div>');
|
||||
|
||||
//add the provision button
|
||||
// Add provision button
|
||||
var provisionBtn = createButton('Provision');
|
||||
provisionBtn.bind('click', function(){
|
||||
var plugin = $(this).parent().parent().attr('id').replace('ProvisionTab', '');
|
||||
@ -413,7 +418,7 @@ function createProvision(plugin, container){
|
||||
provisionBtn.hide();
|
||||
container.append(provisionBtn);
|
||||
|
||||
//bind the image select change event
|
||||
// Bind image select to change event
|
||||
container.find('#' + plugin + 'image').bind('change', function(){
|
||||
var temp = $(this).attr('id');
|
||||
temp = temp.replace('image', '');
|
||||
@ -432,124 +437,138 @@ function createProvision(plugin, container){
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
var containerid = data.msg + 'ProvisionTab';
|
||||
var index = 0;
|
||||
var imagename = 0;
|
||||
var containerId = data.msg + 'ProvisionTab';
|
||||
var i = 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!'));
|
||||
var imageSelect = $('#' + containerId + ' #' + data.msg + 'image');
|
||||
$('#' + containerId + ' img').remove();
|
||||
if (!data.rsp.length) {
|
||||
$('#' + containerId).prepend(createWarnBar('Please run copycds and genimage in provision page before continuing!'));
|
||||
return;
|
||||
}
|
||||
|
||||
for (index in data.rsp){
|
||||
imagename = data.rsp[index];
|
||||
position = imagename.indexOf(' ');
|
||||
imagename = imagename.substr(0, position);
|
||||
for (i in data.rsp) {
|
||||
imageName = data.rsp[i];
|
||||
position = imageName.indexOf(' ');
|
||||
imageName = imageName.substr(0, position);
|
||||
|
||||
imageselect.append('<option value="' + imagename + '">' + imagename + '</option>');
|
||||
imageSelect.append($('<option value="' + imageName + '">' + imageName + '</option>'));
|
||||
}
|
||||
//trigger the select change event
|
||||
imageselect.trigger('change');
|
||||
//show provision button
|
||||
$('#' + containerid + ' button').show();
|
||||
|
||||
// Trigger select change event
|
||||
imageSelect.trigger('change');
|
||||
// Show provision button
|
||||
$('#' + containerId + ' button').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create provision node division using URL
|
||||
*
|
||||
* @returns Provisiong node division
|
||||
*/
|
||||
function createProvWithUrl(){
|
||||
var querystr = window.location.search;
|
||||
var argarray = querystr.substr(1).split('&');
|
||||
var temphash = new Object();
|
||||
var index = 0;
|
||||
var temparray;
|
||||
var showstr = '';
|
||||
var queryStr = window.location.search;
|
||||
var argArray = queryStr.substr(1).split('&');
|
||||
var tempHash = new Object();
|
||||
var i = 0;
|
||||
var tempArray;
|
||||
|
||||
var provHtml = '';
|
||||
|
||||
var master = '';
|
||||
var tftpserver = '';
|
||||
var nfsserver = '';
|
||||
for (index = 0; index < argarray.length; index++){
|
||||
temparray = argarray[index].split('=');
|
||||
temphash[temparray[0]] = temparray[1];
|
||||
var nfsserver = '';
|
||||
for (i = 0; i < argArray.length; i++) {
|
||||
tempArray = argArray[i].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>';
|
||||
provHtml += '<div><label>Nodes:</label><input type="text" disabled="disabled" value="' + tempHash['nodes'] + '"></div>';
|
||||
provHtml += '<div><label>Architecture:</label><input type="text" disabled="disabled" value="' + tempHash['arch'] + '"></div>';
|
||||
provHtml += '<div><label>Image:</label><select id="quickimage"></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>' ;
|
||||
|
||||
showstr += '<div><label>Image:</label><select id="quickimage"></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>' ;
|
||||
|
||||
if (temphash['master']){
|
||||
master = temphash['master'];
|
||||
if (tempHash['master']) {
|
||||
master = tempHash['master'];
|
||||
}
|
||||
|
||||
if (temphash['nfsserver']){
|
||||
nfsserver = temphash['nfsserver'];
|
||||
if (tempHash['nfsserver']) {
|
||||
nfsserver = tempHash['nfsserver'];
|
||||
}
|
||||
|
||||
if (temphash['tftpserver']){
|
||||
tftpserver = temphash['tftpserver'];
|
||||
if (tempHash['tftpserver']) {
|
||||
tftpserver = tempHash['tftpserver'];
|
||||
}
|
||||
|
||||
showstr += '<div><label>xCAT Master:</label><input type="text" value="' + master + '"></div>';
|
||||
showstr += '<div><label>TFTP Server:</label><input type="text" value="' + tftpserver + '"></div>';
|
||||
showstr += '<div><label>NFS Server:</label><input type="text" value="' + nfsserver + '"></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>';
|
||||
|
||||
//add the static input part
|
||||
strSta = '<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>';
|
||||
return strGroup + strNodes + strArch + strSta;
|
||||
provHtml += '<div><label>xCAT master:</label><input type="text" value="' + master + '"></div>';
|
||||
provHtml += '<div><label>TFTP server:</label><input type="text" value="' + tftpserver + '"></div>';
|
||||
provHtml += '<div><label>NFS server:</label><input type="text" value="' + nfsserver + '"></div>';
|
||||
|
||||
return provHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all needed field for provsion and send the command to server
|
||||
* Create provision node division without using URL
|
||||
*
|
||||
* @param plugin
|
||||
* Plugin name to create division for
|
||||
* @returns {String}
|
||||
*/
|
||||
function createProvNoUrl(plugin){
|
||||
// Select group
|
||||
var groupHtml = '<div><label>Group:</label>';
|
||||
var groupNames = $.cookie('groups');
|
||||
if (groupNames) {
|
||||
groupHtml += '<select id="' + plugin + 'group"><option></option>';
|
||||
var temp = groupNames.split(',');
|
||||
for (var i in temp) {
|
||||
groupHtml += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
groupHtml += '</select>';
|
||||
}
|
||||
groupHtml += '</div>';
|
||||
|
||||
// Select nodes
|
||||
var nodesHtml = '<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>';
|
||||
|
||||
// Select architecture
|
||||
var archHtml = '<div><label>Architecture:</label>';
|
||||
var archName = $.cookie('osarchs');
|
||||
if (archName) {
|
||||
archHtml += '<select id="arch">';
|
||||
var temp = archName.split(',');
|
||||
for (var i in temp) {
|
||||
archHtml += '<option value="' + temp[i] + '">' + temp[i] + '</option>';
|
||||
}
|
||||
archHtml += '</select>';
|
||||
} else {
|
||||
archHtml += '<input type="text" id="arch">';
|
||||
}
|
||||
archHtml += '</div>';
|
||||
|
||||
// Add static input part
|
||||
var staticHtml = '<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>';
|
||||
return groupHtml + nodesHtml + archHtml + staticHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get needed fields for provsioning and send command to server
|
||||
*
|
||||
* @param plugin
|
||||
* Plugin name of platform to provision
|
||||
* @return Nothing
|
||||
*/
|
||||
function quickProvision(plugin){
|
||||
var errormessage = '';
|
||||
var errorMessage = '';
|
||||
var argsArray = new Array();
|
||||
var nodesName = '';
|
||||
var provisionArg = '';
|
||||
@ -557,47 +576,47 @@ function quickProvision(plugin){
|
||||
var imageName = '';
|
||||
var url = '';
|
||||
var softwareArg = '';
|
||||
var containerid = plugin + 'ProvisionTab';
|
||||
$('#' + containerid + ' .ui-state-error').remove();
|
||||
var containerId = plugin + 'ProvisionTab';
|
||||
$('#' + containerId + ' .ui-state-error').remove();
|
||||
|
||||
$('#' + containerid + ' input[type!="checkbox"]').each(function(){
|
||||
if ('' == $(this).val()){
|
||||
errormessage = 'You are missing input!';
|
||||
$('#' + containerId + ' input[type!="checkbox"]').each(function() {
|
||||
if (!$(this).val()) {
|
||||
errorMessage = 'You are missing some inputs!';
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
argsArray.push($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != errormessage){
|
||||
$('#' + containerid).prepend('<p class="ui-state-error">' + errormessage + '</p>');
|
||||
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){
|
||||
// If jumped from nodes page, get node names
|
||||
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'));
|
||||
// Select platform, get node names 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>');
|
||||
if (!nodesName) {
|
||||
$('#' + containerId).prepend('<p class="ui-state-error">Please select a node</p>');
|
||||
return;
|
||||
}
|
||||
|
||||
softwareArg = getCheckedByObj($('#' + containerid + ' #advoption'));
|
||||
imageName = $('#' + containerid + ' #' + plugin + 'image').val();
|
||||
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
|
||||
// Show output
|
||||
var deployDia = $('<div id="deployDia"></div>');
|
||||
deployDia.append(createLoader()).append('<br/>');
|
||||
deployDia.append('<iframe id="provisionFrame" width="95%" height="90%" src="' + url + '"></iframe>');
|
||||
@ -605,7 +624,7 @@ function quickProvision(plugin){
|
||||
modal: true,
|
||||
width: 600,
|
||||
height: 480,
|
||||
title:'Provision on Nodes',
|
||||
title:'Provision return',
|
||||
close: function(){$(this).remove();},
|
||||
buttons: {
|
||||
Close : function(){$(this).dialog('close');}
|
||||
@ -615,7 +634,16 @@ function quickProvision(plugin){
|
||||
provisionStopCheck();
|
||||
}
|
||||
|
||||
function provAdvOption(imagename, plugin){
|
||||
/**
|
||||
* Create provisioning advance option
|
||||
*
|
||||
* @param imagename
|
||||
* Image name
|
||||
* @param plugin
|
||||
* Plugin name of platform to provision
|
||||
* @return Nothing
|
||||
*/
|
||||
function provAdvOption(imagename, plugin) {
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -626,40 +654,45 @@ function provAdvOption(imagename, plugin){
|
||||
msg : plugin
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
var containerid = data.msg + 'ProvisionTab';
|
||||
var index = 0;
|
||||
var osname = '';
|
||||
var provmethod = '';
|
||||
var tempstr = '';
|
||||
success : function(data) {
|
||||
var containerId = data.msg + 'ProvisionTab';
|
||||
var i = 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);
|
||||
for (i = 0; i < data.rsp.length; i++) {
|
||||
tempStr = data.rsp[i];
|
||||
if (tempStr.indexOf('osname') != -1) {
|
||||
position = tempStr.indexOf('=');
|
||||
osName = tempStr.substr(position + 1);
|
||||
}
|
||||
if (-1 != tempstr.indexOf('provmethod')){
|
||||
position = tempstr.indexOf('=');
|
||||
provmethod = tempstr.substr(position + 1);
|
||||
|
||||
if (tempStr.indexOf('provmethod') != -1) {
|
||||
position = tempStr.indexOf('=');
|
||||
provMethod = tempStr.substr(position + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + containerid + ' #advoption').empty();
|
||||
if ('aix' == osname.toLowerCase()){
|
||||
$('#' + containerId + ' #advoption').empty();
|
||||
if ('aix' == osName.toLowerCase()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('install' == provmethod){
|
||||
$('#' + containerid + ' #advoption').html('<input type="checkbox" checked="checked" name="ganglia">Install Ganglia.');
|
||||
if ('install' == provMethod){
|
||||
$('#' + containerId + ' #advoption').html('<input type="checkbox" checked="checked" name="ganglia">Install Ganglia.');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the nodes area base on group selected
|
||||
* Refresh nodes area base on group selected
|
||||
*
|
||||
* @param groupName
|
||||
* Group name
|
||||
* @param areaId
|
||||
* Area ID to refresh
|
||||
* @return Nothing
|
||||
*/
|
||||
function createNodesArea(groupName, areaId) {
|
||||
@ -678,18 +711,18 @@ function createNodesArea(groupName, areaId) {
|
||||
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>';
|
||||
var nodesHtml = '<table><thead><tr><th><input type="checkbox" onclick="selectAllCheckbox(event, $(this))"></th>';
|
||||
nodesHtml += '<th>Node</th></tr></thead><tbody>';
|
||||
for (index in nodes) {
|
||||
var node = nodes[index][0];
|
||||
if ('' == node) {
|
||||
if (!node) {
|
||||
continue;
|
||||
}
|
||||
showStr += '<tr><td><input type="checkbox" name="' + node + '"/></td><td>'
|
||||
+ node + '</td></tr>';
|
||||
nodesHtml += '<tr><td><input type="checkbox" name="' + node + '"/></td><td>' + node + '</td></tr>';
|
||||
}
|
||||
showStr += '</tbody></table>';
|
||||
areaObj.empty().append(showStr);
|
||||
nodesHtml += '</tbody></table>';
|
||||
|
||||
areaObj.empty().append(nodesHtml);
|
||||
if (index > 10) {
|
||||
areaObj.css('height', '300px');
|
||||
} else {
|
||||
@ -701,32 +734,34 @@ function createNodesArea(groupName, areaId) {
|
||||
|
||||
function provisionStopCheck(){
|
||||
var content = $('#provisionFrame').contents().find('body').text();
|
||||
if (-1 != content.indexOf('provision stop')){
|
||||
if (content.indexOf('provision stop') != -1) {
|
||||
$('#deployDia img').remove();
|
||||
clearTimeout(provisionClock);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
provisionClock = setTimeout('provisionStopCheck()', 5000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all select elements' name in the obj
|
||||
* Get select element names
|
||||
*
|
||||
* @return All nodes name, seperate by ','
|
||||
* @param obj
|
||||
* Object to get selected element names
|
||||
* @return Nodes name seperate by a comma
|
||||
*/
|
||||
function getCheckedByObj(obj) {
|
||||
var tempStr = '';
|
||||
var str = '';
|
||||
|
||||
// Get nodes that were checked
|
||||
obj.find('input:checked').each(function() {
|
||||
if ($(this).attr('name')) {
|
||||
tempStr += $(this).attr('name') + ',';
|
||||
str += $(this).attr('name') + ',';
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != tempStr) {
|
||||
tempStr = tempStr.substr(0, tempStr.length - 1);
|
||||
if (str) {
|
||||
str = str.substr(0, str.length - 1);
|
||||
}
|
||||
|
||||
return tempStr;
|
||||
return str;
|
||||
}
|
@ -166,27 +166,26 @@ hmcPlugin.prototype.addNode = function() {
|
||||
diaDiv.append('<div><label>Type:</label><select id="pnodetype"><option>HMC</option><option>Scan Node</option></select></div>');
|
||||
diaDiv.append('<div id="pnodeeditarea" ></div>');
|
||||
|
||||
//show the dialog
|
||||
diaDiv.dialog( {
|
||||
// Show the dialog
|
||||
diaDiv.dialog({
|
||||
modal : true,
|
||||
width : 400,
|
||||
title : 'Add System P Node',
|
||||
title : 'Add System p Node',
|
||||
close : function(){$('#addpnodeDiv').remove();}
|
||||
});
|
||||
|
||||
//bind the select change event
|
||||
$('#pnodetype').bind('change', function(){
|
||||
// Bind the select change event
|
||||
$('#pnodetype').bind('change', function() {
|
||||
$('#pnodeeditarea').empty();
|
||||
if ('HMC' == $(this).val()){
|
||||
if ('HMC' == $(this).val()) {
|
||||
$('#addpnodeDiv').dialog('option', 'width', '400');
|
||||
$('#pnodeeditarea').append('<label>Name:</label><input><br/><label>Username:</label><input><br/>' +
|
||||
'<label>Password:</label><input><br/><label>IP Adress:</label><input>');
|
||||
|
||||
$('#addpnodeDiv').dialog('option', 'buttons',
|
||||
{'Add': function(){addHmcNode();},
|
||||
'Cancle': function(){$('#addpnodeDiv').dialog('close');}});
|
||||
}
|
||||
else{
|
||||
'Cancel': function(){$('#addpnodeDiv').dialog('close');}});
|
||||
} else {
|
||||
//add loader image and delete buttons
|
||||
$('#pnodeeditarea').append(createLoader());
|
||||
$('#addpnodeDiv').dialog('option', 'buttons', {'Cancel': function(){$('#addpnodeDiv').dialog('close');}});
|
||||
@ -200,7 +199,7 @@ hmcPlugin.prototype.addNode = function() {
|
||||
args : 'ppc.nodetype==hmc',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data){
|
||||
success : function(data) {
|
||||
$('#pnodeeditarea img').remove();
|
||||
drawHmcSelector(data.rsp);
|
||||
}
|
||||
@ -208,32 +207,34 @@ hmcPlugin.prototype.addNode = function() {
|
||||
}
|
||||
});
|
||||
|
||||
//trigger the selector change event
|
||||
// Trigger the select change event
|
||||
$('#pnodetype').trigger('change');
|
||||
};
|
||||
|
||||
/**
|
||||
* add all hmcs into the dialog
|
||||
* Add HMCs into the dialog
|
||||
*
|
||||
* @param hmc
|
||||
* HMCs
|
||||
* @return Nothing
|
||||
*/
|
||||
function drawHmcSelector(hmcs){
|
||||
if (1 > hmcs.length){
|
||||
if (1 > hmcs.length) {
|
||||
$('#pnodeeditarea').append(createWarnBar('Please define HMC node first.'));
|
||||
return;
|
||||
}
|
||||
|
||||
//add all hmcs into a selecter, add a scan button
|
||||
// Add HMCs into a selector and add a scan button
|
||||
var hmcoption = '';
|
||||
var scanbutton = createButton('Scan');
|
||||
for (var i in hmcs){
|
||||
for (var i in hmcs) {
|
||||
hmcoption += '<option>' + hmcs[i][0] + '</option>';
|
||||
}
|
||||
|
||||
$('#pnodeeditarea').append('<label>HMC:</label><select>' + hmcoption + '</select>');
|
||||
$('#pnodeeditarea').append(scanbutton);
|
||||
|
||||
scanbutton.bind('click', function(){
|
||||
scanbutton.bind('click', function() {
|
||||
var hmcname = $('#pnodeeditarea select').val();
|
||||
$('#pnodeeditarea').append(createLoader());
|
||||
$.ajax({
|
||||
@ -245,16 +246,16 @@ function drawHmcSelector(hmcs){
|
||||
args : '',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data){
|
||||
success : function(data) {
|
||||
$('#pnodeeditarea img').remove();
|
||||
|
||||
//draw a table with checkbox
|
||||
// Draw a table with checkbox
|
||||
drawRscanResult(data.rsp[0]);
|
||||
|
||||
//add the add button
|
||||
// Add the add button
|
||||
$('#addpnodeDiv').dialog('option', 'buttons',
|
||||
{'Add': function(){addPNode();},
|
||||
'Cancle': function(){$('#addpnodeDiv').dialog('close');}});
|
||||
'Cancel': function(){$('#addpnodeDiv').dialog('close');}});
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -271,44 +272,45 @@ function drawRscanResult(rscanresult){
|
||||
var fields = 0;
|
||||
|
||||
$('#pnodeeditarea div').remove();
|
||||
if (!rscanresult){
|
||||
if (!rscanresult) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = rscanresult.split("\n");
|
||||
if (rows.length < 2){
|
||||
if (rows.length < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
//add the table header
|
||||
// Add the table header
|
||||
fields = rows[0].match(tempreg);
|
||||
colnum = fields.length;
|
||||
temprow = '<tr><td><input type="checkbox" onclick="selectAllRscanNode(this)"></td>';
|
||||
for(var i in fields){
|
||||
for(var i in fields) {
|
||||
temprow += '<td>' + fields[i] + '</td>';
|
||||
}
|
||||
rscantable.append(temprow);
|
||||
|
||||
//add the tbody
|
||||
for (var i = 1; i < rows.length; i++){
|
||||
// Add the tbody
|
||||
for (var i = 1; i < rows.length; i++) {
|
||||
line = rows[i];
|
||||
if (!line){
|
||||
continue;
|
||||
}
|
||||
var fields = line.match(tempreg);
|
||||
if ('hmc' == fields[0]){
|
||||
if (!line) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//may be the 3rd field(id) is empty, so we should add the new
|
||||
var fields = line.match(tempreg);
|
||||
if ('hmc' == fields[0]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// May be the 3rd field(id) is empty, so we should add the new
|
||||
if (!idpreg.test(fields[2])){
|
||||
fields = [fields[0], fields[1], ''].concat(fields.slice(2));
|
||||
}
|
||||
temprow = '<tr><td><input type="checkbox" name="' + fields[1] + '"></td>';
|
||||
|
||||
for(var j = 0; j < colnum; j++){
|
||||
for(var j = 0; j < colnum; j++) {
|
||||
temprow += '<td>';
|
||||
if (fields[j]){
|
||||
if (fields[j]) {
|
||||
temprow += fields[j];
|
||||
}
|
||||
temprow += '</td>';
|
||||
@ -320,6 +322,7 @@ function drawRscanResult(rscanresult){
|
||||
resultDiv.append(rscantable);
|
||||
$('#pnodeeditarea').append(resultDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hmc node
|
||||
*
|
||||
@ -330,24 +333,24 @@ function addHmcNode(){
|
||||
var args = '';
|
||||
$('#pnodeeditarea input').each(function(){
|
||||
if (!$(this).val()){
|
||||
errorinfo = 'You are missing input.';
|
||||
errorinfo = 'You are missing some inputs!';
|
||||
}
|
||||
args += $(this).val() + ',';
|
||||
});
|
||||
|
||||
if (errorinfo){
|
||||
//add warning message
|
||||
// Add warning message
|
||||
alert(errorinfo);
|
||||
return;
|
||||
}
|
||||
|
||||
//disabled the button
|
||||
// Disabled the button
|
||||
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
||||
|
||||
args = args.substr(0, args.length - 1);
|
||||
|
||||
$('#pnodeeditarea').append(createLoader());
|
||||
//send the save hmc request
|
||||
// Send the save HMC request
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -358,7 +361,7 @@ function addHmcNode(){
|
||||
msg : ''
|
||||
},
|
||||
success : function(data){
|
||||
//refresh the area on the right side
|
||||
// Refresh the area on the right side
|
||||
$('#addpnodeDiv').dialog('close');
|
||||
$('.selectgroup').trigger('click');
|
||||
}
|
||||
@ -371,26 +374,27 @@ function addHmcNode(){
|
||||
* @return Nothing
|
||||
*/
|
||||
function addPNode(){
|
||||
//get the hmc name
|
||||
// Get the HMC name
|
||||
var hmcname = $('#pnodeeditarea select').val();
|
||||
var nodename = '';
|
||||
//get all need added node
|
||||
$('#pnodeeditarea :checked').each(function(){
|
||||
if ($(this).attr('name')){
|
||||
// Get checked nodes
|
||||
$('#pnodeeditarea :checked').each(function() {
|
||||
if ($(this).attr('name')) {
|
||||
nodename += $(this).attr('name') + ',';
|
||||
}
|
||||
});
|
||||
|
||||
if (!nodename){
|
||||
if (!nodename) {
|
||||
alert('You should select nodes first!');
|
||||
return;
|
||||
}
|
||||
//disabled the button
|
||||
|
||||
// Disabled the button
|
||||
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
||||
|
||||
nodename = nodename.substr(0, nodename.length - 1);
|
||||
$('#pnodeeditarea').append(createLoader());
|
||||
//send the add request
|
||||
// Send the add request
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -400,8 +404,8 @@ function addPNode(){
|
||||
args : 'addpnode;node;' + hmcname + ',' + nodename,
|
||||
msg : ''
|
||||
},
|
||||
success : function(data){
|
||||
//refresh the area on the right side
|
||||
success : function(data) {
|
||||
// Refresh the area on the right side
|
||||
$('#addpnodeDiv').dialog('close');
|
||||
$('.selectgroup').trigger('click');
|
||||
}
|
||||
@ -409,7 +413,7 @@ function addPNode(){
|
||||
}
|
||||
|
||||
/**
|
||||
* select all checkbox in a table
|
||||
* Select all checkbox in a table
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
|
@ -171,7 +171,7 @@ ipmiPlugin.prototype.loadResources = function() {
|
||||
* @return Nothing
|
||||
*/
|
||||
ipmiPlugin.prototype.addNode = function() {
|
||||
var diag = $('<div id="addIdpDiv" class="form" title="Add iDataPlex"></div>');
|
||||
var diag = $('<div id="addIdplx" class="form" title="Add iDataPlex"></div>');
|
||||
var info = createInfoBar('Add a node range');
|
||||
diag.append(info);
|
||||
|
||||
@ -216,37 +216,40 @@ ipmiPlugin.prototype.addNode = function() {
|
||||
*/
|
||||
function addIdataplex(){
|
||||
var tempArray = new Array();
|
||||
var errormessage = '';
|
||||
var errorMessage = '';
|
||||
var attr = '';
|
||||
var args = '';
|
||||
|
||||
//remove the warning bar
|
||||
$('#addIdpDiv .ui-state-error').remove();
|
||||
// Remove existing warnings
|
||||
$('#addIdplx .ui-state-error').remove();
|
||||
|
||||
//get all inputs' value
|
||||
$('#addIdpDiv input').each(function(){
|
||||
// Get input values
|
||||
$('#addIdplx input').each(function(){
|
||||
attr = $(this).val();
|
||||
if (attr){
|
||||
if (attr) {
|
||||
tempArray.push($(this).val());
|
||||
}
|
||||
else{
|
||||
errormessage = "You are missing some inputs!";
|
||||
} else {
|
||||
errorMessage = "You are missing some inputs!";
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if ('' != errormessage){
|
||||
$('#addIdpDiv').prepend(createWarnBar(errormessage));
|
||||
if (errorMessage) {
|
||||
$('#addIdplx').prepend(createWarnBar(errorMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
//add the loader
|
||||
$('#addIdpDiv').append(createLoader());
|
||||
// Create loader
|
||||
$('#addIdplx').append(createLoader());
|
||||
|
||||
//change the dialog button
|
||||
$('#addIdpDiv').dialog('option', 'buttons', {'Close':function(){$('#addIdpDiv').dialog('close');}});
|
||||
// Change dialog buttons
|
||||
$('#addIdplx').dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$('#addIdplx').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
//compose all args into chdef for node
|
||||
// Generate chdef arguments
|
||||
args = '-t;node;-o;' + tempArray[0] + ';mac=' + tempArray[1] + ';ip=' + tempArray[2] + ';groups=' +
|
||||
tempArray[3] + ';mgt=ipmi;chain="runcmd=bmcsetup";netboot=xnba;nodetype=osi;profile=compute;' +
|
||||
'bmc=' + tempArray[4];
|
||||
@ -260,8 +263,8 @@ function addIdataplex(){
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
//compose all args into chdef for bmc
|
||||
|
||||
// Generate chdef arguments for BMC
|
||||
args = '-t;node;-o;' + tempArray[4] + ';ip=' + tempArray[5] + ';groups=' + tempArray[6];
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -272,15 +275,15 @@ function addIdataplex(){
|
||||
args : args,
|
||||
msg : ''
|
||||
},
|
||||
success: function(data){
|
||||
$('#addIdpDiv img').remove();
|
||||
success: function(data) {
|
||||
$('#addIdplx img').remove();
|
||||
var message = '';
|
||||
for (var i in data.rsp){
|
||||
for (var i in data.rsp) {
|
||||
message += data.rsp[i];
|
||||
}
|
||||
|
||||
if ('' != message){
|
||||
$('#addIdpDiv').prepend(createInfoBar(message));
|
||||
if (message) {
|
||||
$('#addIdplx').prepend(createInfoBar(message));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -3262,7 +3262,7 @@ function jump2Provision(tgtNodes){
|
||||
|
||||
// Skip if node does not have arch
|
||||
if (!origAttrs[nodeName]['arch']){
|
||||
errorMsg = 'Nodes should have arch defined!';
|
||||
errorMsg = 'Nodes should have arch defined! ';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -87,9 +87,9 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) {
|
||||
var tabIndex = ($('li', tabs).index(thisTab));
|
||||
|
||||
// Do not remove first tab
|
||||
if (tabIndex != 0) {
|
||||
tabs.tabs('remove', tabIndex);
|
||||
if (tabIndex != 0) {
|
||||
tabs.tabs('select', 0);
|
||||
tabs.tabs('remove', tabIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user