2010-07-28 20:24:29 +00:00
|
|
|
/**
|
|
|
|
* Execute when the DOM is fully loaded
|
|
|
|
*/
|
|
|
|
$(document).ready(function() {
|
|
|
|
// Load utility scripts
|
2010-07-15 22:57:48 +00:00
|
|
|
});
|
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
var hmcPlugin = function() {
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 18:27:12 +00:00
|
|
|
/**
|
|
|
|
* Clone node (service page)
|
|
|
|
*
|
|
|
|
* @param node
|
|
|
|
* Node to clone
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
hmcPlugin.prototype.serviceClone = function(node) {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2011-09-30 18:29:27 +00:00
|
|
|
/**
|
|
|
|
* Load provision page (service page)
|
|
|
|
*
|
|
|
|
* @param tabId
|
|
|
|
* Tab ID where page will reside
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
hmcPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show node inventory (service page)
|
|
|
|
*
|
|
|
|
* @param data
|
|
|
|
* Data from HTTP request
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
hmcPlugin.prototype.loadServiceInventory = function(data) {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-07-15 22:57:48 +00:00
|
|
|
/**
|
|
|
|
* Load node inventory
|
|
|
|
*
|
|
|
|
* @param data
|
|
|
|
* Data from HTTP request
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadInventory = function(data) {
|
2010-07-26 18:34:29 +00:00
|
|
|
// Get arguments
|
2010-07-22 19:56:09 +00:00
|
|
|
var args = data.msg.split(',');
|
|
|
|
// Get tab ID
|
|
|
|
var tabId = args[0].replace('out=', '');
|
|
|
|
// Get node
|
|
|
|
var node = args[1].replace('node=', '');
|
|
|
|
// Get node inventory
|
|
|
|
var inv = data.rsp;
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Remove loader
|
2011-01-19 15:56:43 +00:00
|
|
|
$('#' + tabId).find('img').remove();
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Create division to hold inventory
|
2010-07-26 18:34:29 +00:00
|
|
|
var invDivId = tabId + 'Inventory';
|
2010-07-22 19:56:09 +00:00
|
|
|
var invDiv = $('<div class="inventory" id="' + invDivId + '"></div>');
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-26 18:34:29 +00:00
|
|
|
// Loop through each line
|
2010-07-28 20:24:29 +00:00
|
|
|
var fieldSet, legend, oList, item;
|
2011-04-16 14:40:15 +00:00
|
|
|
for (var k = 0; k < inv.length; k++) {
|
2010-07-28 20:24:29 +00:00
|
|
|
// Remove node name in front
|
2010-07-26 18:34:29 +00:00
|
|
|
var str = inv[k].replace(node + ': ', '');
|
2010-07-29 20:22:09 +00:00
|
|
|
str = jQuery.trim(str);
|
2010-07-28 20:24:29 +00:00
|
|
|
|
|
|
|
// If string is a header
|
|
|
|
if (str.indexOf('I/O Bus Information') > -1 || str.indexOf('Machine Configuration Info') > -1) {
|
2010-07-26 18:34:29 +00:00
|
|
|
// Create a fieldset
|
|
|
|
fieldSet = $('<fieldset></fieldset>');
|
|
|
|
legend = $('<legend>' + str + '</legend>');
|
|
|
|
fieldSet.append(legend);
|
|
|
|
oList = $('<ol></ol>');
|
|
|
|
fieldSet.append(oList);
|
|
|
|
invDiv.append(fieldSet);
|
|
|
|
} else {
|
|
|
|
// If no fieldset is defined
|
|
|
|
if (!fieldSet) {
|
2010-07-28 20:24:29 +00:00
|
|
|
// Define general fieldset
|
2010-07-26 18:34:29 +00:00
|
|
|
fieldSet = $('<fieldset></fieldset>');
|
|
|
|
legend = $('<legend>General</legend>');
|
|
|
|
fieldSet.append(legend);
|
|
|
|
oList = $('<ol></ol>');
|
|
|
|
fieldSet.append(oList);
|
|
|
|
invDiv.append(fieldSet);
|
|
|
|
}
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-26 18:34:29 +00:00
|
|
|
// Append the string to a list
|
|
|
|
item = $('<li></li>');
|
2010-07-28 20:24:29 +00:00
|
|
|
item.append(str);
|
|
|
|
oList.append(item);
|
2010-07-26 18:34:29 +00:00
|
|
|
}
|
2010-07-22 19:56:09 +00:00
|
|
|
}
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
// Append to inventory form
|
|
|
|
$('#' + tabId).append(invDiv);
|
|
|
|
};
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-19 18:28:31 +00:00
|
|
|
* Load clone page
|
2010-07-15 22:57:48 +00:00
|
|
|
*
|
|
|
|
* @param node
|
2010-07-19 18:28:31 +00:00
|
|
|
* Source node to clone
|
2010-07-15 22:57:48 +00:00
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadClonePage = function(node) {
|
2010-10-07 14:15:56 +00:00
|
|
|
// Get nodes tab
|
|
|
|
var tab = getNodesTab();
|
|
|
|
var newTabId = node + 'CloneTab';
|
|
|
|
|
|
|
|
// If there is no existing clone tab
|
|
|
|
if (!$('#' + newTabId).length) {
|
|
|
|
// Create status bar and hide it
|
|
|
|
var statBarId = node + 'CloneStatusBar';
|
2010-10-08 03:03:42 +00:00
|
|
|
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>').hide();
|
2010-10-07 14:15:56 +00:00
|
|
|
|
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Under construction');
|
|
|
|
|
|
|
|
// Create clone form
|
|
|
|
var cloneForm = $('<div class="form"></div>');
|
|
|
|
cloneForm.append(statBar);
|
|
|
|
cloneForm.append(infoBar);
|
|
|
|
|
|
|
|
// Add clone tab
|
|
|
|
tab.add(newTabId, 'Clone', cloneForm, true);
|
|
|
|
}
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-10-07 14:15:56 +00:00
|
|
|
tab.select(newTabId);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-19 18:28:31 +00:00
|
|
|
* Load provision page
|
2010-07-15 22:57:48 +00:00
|
|
|
*
|
|
|
|
* @param tabId
|
|
|
|
* The provision tab ID
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadProvisionPage = function(tabId) {
|
2011-08-24 10:30:30 +00:00
|
|
|
// Create provision form
|
|
|
|
var provForm = $('<div class="form"></div>');
|
2010-07-20 18:49:31 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
// Create info bar
|
2011-09-16 21:35:54 +00:00
|
|
|
var infoBar = createInfoBar('Provision a node on System p.');
|
2011-08-24 10:30:30 +00:00
|
|
|
provForm.append(infoBar);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
// Append to provision tab
|
|
|
|
$('#' + tabId).append(provForm);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
/**
|
|
|
|
* Create provision new node division
|
|
|
|
*/
|
|
|
|
// You should copy whatever is in this function, put it here, and customize it
|
|
|
|
createProvision('hmc', provForm);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-07-19 18:28:31 +00:00
|
|
|
/**
|
|
|
|
* Load resources
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadResources = function() {
|
2010-10-08 03:03:42 +00:00
|
|
|
// Get resource tab ID
|
2011-01-19 15:56:43 +00:00
|
|
|
var tabId = 'hmcResourceTab';
|
|
|
|
// Remove loader
|
|
|
|
$('#' + tabId).find('img').remove();
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-10-07 17:40:24 +00:00
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Under construction');
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-10-07 17:40:24 +00:00
|
|
|
// Create resource form
|
|
|
|
var resrcForm = $('<div class="form"></div>');
|
|
|
|
resrcForm.append(infoBar);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-01-19 15:56:43 +00:00
|
|
|
$('#' + tabId).append(resrcForm);
|
2010-09-22 16:52:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2010-09-24 02:27:04 +00:00
|
|
|
* Add node range
|
2010-09-22 16:52:41 +00:00
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-09-23 20:43:10 +00:00
|
|
|
hmcPlugin.prototype.addNode = function() {
|
2011-09-09 06:03:09 +00:00
|
|
|
var diaDiv = $('<div id="addpnodeDiv" class="form"></div>');
|
|
|
|
diaDiv.append('<div><label>Type:</label><select id="pnodetype"><option>HMC</option><option>Scan Node</option></select></div>');
|
|
|
|
diaDiv.append('<div id="pnodeeditarea" ></div>');
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Show the dialog
|
|
|
|
diaDiv.dialog({
|
2011-09-09 06:03:09 +00:00
|
|
|
modal : true,
|
|
|
|
width : 400,
|
2011-09-28 21:38:12 +00:00
|
|
|
title : 'Add node',
|
2011-09-09 06:03:09 +00:00
|
|
|
close : function(){$('#addpnodeDiv').remove();}
|
|
|
|
});
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Bind the select change event
|
|
|
|
$('#pnodetype').bind('change', function() {
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#pnodeeditarea').empty();
|
2011-09-12 19:47:26 +00:00
|
|
|
if ('HMC' == $(this).val()) {
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#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();},
|
2011-09-12 19:47:26 +00:00
|
|
|
'Cancel': function(){$('#addpnodeDiv').dialog('close');}});
|
|
|
|
} else {
|
2011-09-09 06:03:09 +00:00
|
|
|
//add loader image and delete buttons
|
|
|
|
$('#pnodeeditarea').append(createLoader());
|
|
|
|
$('#addpnodeDiv').dialog('option', 'buttons', {'Cancel': function(){$('#addpnodeDiv').dialog('close');}});
|
|
|
|
$('#addpnodeDiv').dialog('option', 'width', '650');
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'nodels',
|
|
|
|
tgt : 'all',
|
|
|
|
args : 'ppc.nodetype==hmc',
|
|
|
|
msg : ''
|
|
|
|
},
|
2011-09-12 19:47:26 +00:00
|
|
|
success : function(data) {
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#pnodeeditarea img').remove();
|
|
|
|
drawHmcSelector(data.rsp);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Trigger the select change event
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#pnodetype').trigger('change');
|
2011-02-17 09:06:21 +00:00
|
|
|
};
|
|
|
|
|
2011-09-09 06:03:09 +00:00
|
|
|
/**
|
2011-09-12 19:47:26 +00:00
|
|
|
* Add HMCs into the dialog
|
2011-09-09 06:03:09 +00:00
|
|
|
*
|
2011-09-12 19:47:26 +00:00
|
|
|
* @param hmc
|
|
|
|
* HMCs
|
2011-09-09 06:03:09 +00:00
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function drawHmcSelector(hmcs){
|
2011-09-12 19:47:26 +00:00
|
|
|
if (1 > hmcs.length) {
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#pnodeeditarea').append(createWarnBar('Please define HMC node first.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Add HMCs into a selector and add a scan button
|
2011-09-09 06:03:09 +00:00
|
|
|
var hmcoption = '';
|
|
|
|
var scanbutton = createButton('Scan');
|
2011-09-12 19:47:26 +00:00
|
|
|
for (var i in hmcs) {
|
2011-09-09 06:03:09 +00:00
|
|
|
hmcoption += '<option>' + hmcs[i][0] + '</option>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#pnodeeditarea').append('<label>HMC:</label><select>' + hmcoption + '</select>');
|
|
|
|
$('#pnodeeditarea').append(scanbutton);
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
scanbutton.bind('click', function() {
|
2011-09-09 06:03:09 +00:00
|
|
|
var hmcname = $('#pnodeeditarea select').val();
|
|
|
|
$('#pnodeeditarea').append(createLoader());
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'rscan',
|
|
|
|
tgt : hmcname,
|
|
|
|
args : '',
|
|
|
|
msg : ''
|
|
|
|
},
|
2011-09-12 19:47:26 +00:00
|
|
|
success : function(data) {
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#pnodeeditarea img').remove();
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Draw a table with checkbox
|
2011-09-09 06:03:09 +00:00
|
|
|
drawRscanResult(data.rsp[0]);
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Add the add button
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#addpnodeDiv').dialog('option', 'buttons',
|
|
|
|
{'Add': function(){addPNode();},
|
2011-09-12 19:47:26 +00:00
|
|
|
'Cancel': function(){$('#addpnodeDiv').dialog('close');}});
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function drawRscanResult(rscanresult){
|
|
|
|
var line = '';
|
|
|
|
var tempreg = /\S+/g;
|
|
|
|
var idpreg = /^\d+$/;
|
|
|
|
var resultDiv = $('<div class="tab" style="height:300px;overflow:auto;"></div>');
|
|
|
|
var rscantable = $('<table></table>');
|
|
|
|
var temprow = '';
|
|
|
|
var colnum = 0;
|
|
|
|
var fields = 0;
|
|
|
|
|
|
|
|
$('#pnodeeditarea div').remove();
|
2011-09-12 19:47:26 +00:00
|
|
|
if (!rscanresult) {
|
2011-09-09 06:03:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var rows = rscanresult.split("\n");
|
2011-09-12 19:47:26 +00:00
|
|
|
if (rows.length < 2) {
|
2011-09-09 06:03:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Add the table header
|
2011-09-09 06:03:09 +00:00
|
|
|
fields = rows[0].match(tempreg);
|
|
|
|
colnum = fields.length;
|
|
|
|
temprow = '<tr><td><input type="checkbox" onclick="selectAllRscanNode(this)"></td>';
|
2011-09-12 19:47:26 +00:00
|
|
|
for(var i in fields) {
|
2011-09-09 06:03:09 +00:00
|
|
|
temprow += '<td>' + fields[i] + '</td>';
|
|
|
|
}
|
|
|
|
rscantable.append(temprow);
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Add the tbody
|
|
|
|
for (var i = 1; i < rows.length; i++) {
|
2011-09-09 06:03:09 +00:00
|
|
|
line = rows[i];
|
2011-09-12 19:47:26 +00:00
|
|
|
if (!line) {
|
2011-09-09 06:03:09 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-09-12 19:47:26 +00:00
|
|
|
|
2011-09-09 06:03:09 +00:00
|
|
|
var fields = line.match(tempreg);
|
2011-09-12 19:47:26 +00:00
|
|
|
if ('hmc' == fields[0]) {
|
2011-09-09 06:03:09 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// May be the 3rd field(id) is empty, so we should add the new
|
2011-09-09 06:03:09 +00:00
|
|
|
if (!idpreg.test(fields[2])){
|
|
|
|
fields = [fields[0], fields[1], ''].concat(fields.slice(2));
|
|
|
|
}
|
|
|
|
temprow = '<tr><td><input type="checkbox" name="' + fields[1] + '"></td>';
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
for(var j = 0; j < colnum; j++) {
|
2011-09-09 06:03:09 +00:00
|
|
|
temprow += '<td>';
|
2011-09-12 19:47:26 +00:00
|
|
|
if (fields[j]) {
|
2011-09-23 06:22:37 +00:00
|
|
|
if (j == 1){
|
|
|
|
temprow += '<input value="' + fields[j] + '">';
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
temprow += fields[j];
|
|
|
|
}
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
temprow += '</td>';
|
|
|
|
}
|
|
|
|
temprow += '</tr>';
|
|
|
|
rscantable.append(temprow);
|
|
|
|
}
|
|
|
|
|
|
|
|
resultDiv.append(rscantable);
|
|
|
|
$('#pnodeeditarea').append(resultDiv);
|
|
|
|
}
|
2011-09-12 19:47:26 +00:00
|
|
|
|
2011-09-09 06:03:09 +00:00
|
|
|
/**
|
|
|
|
* Add hmc node
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function addHmcNode(){
|
|
|
|
var errorinfo = '';
|
|
|
|
var args = '';
|
|
|
|
$('#pnodeeditarea input').each(function(){
|
|
|
|
if (!$(this).val()){
|
2011-09-12 19:47:26 +00:00
|
|
|
errorinfo = 'You are missing some inputs!';
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
args += $(this).val() + ',';
|
|
|
|
});
|
|
|
|
|
|
|
|
if (errorinfo){
|
2011-09-12 19:47:26 +00:00
|
|
|
// Add warning message
|
2011-09-09 06:03:09 +00:00
|
|
|
alert(errorinfo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
// Disabled the button
|
2011-09-09 06:03:09 +00:00
|
|
|
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
|
|
|
|
|
|
|
args = args.substr(0, args.length - 1);
|
|
|
|
|
|
|
|
$('#pnodeeditarea').append(createLoader());
|
2011-09-12 19:47:26 +00:00
|
|
|
// Send the save HMC request
|
2011-09-09 06:03:09 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
2011-09-21 07:11:31 +00:00
|
|
|
args : 'addnode;hmc;' + args,
|
2011-09-09 06:03:09 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
success : function(data){
|
2011-09-12 19:47:26 +00:00
|
|
|
// Refresh the area on the right side
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#addpnodeDiv').dialog('close');
|
|
|
|
$('.selectgroup').trigger('click');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-09-16 21:35:54 +00:00
|
|
|
* Add System p node, contains frame, cec, lpar
|
2011-09-09 06:03:09 +00:00
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function addPNode(){
|
2011-09-12 19:47:26 +00:00
|
|
|
// Get the HMC name
|
2011-09-09 06:03:09 +00:00
|
|
|
var hmcname = $('#pnodeeditarea select').val();
|
|
|
|
var nodename = '';
|
2011-09-12 19:47:26 +00:00
|
|
|
// Get checked nodes
|
|
|
|
$('#pnodeeditarea :checked').each(function() {
|
|
|
|
if ($(this).attr('name')) {
|
2011-09-09 06:03:09 +00:00
|
|
|
nodename += $(this).attr('name') + ',';
|
2011-09-23 06:22:37 +00:00
|
|
|
nodename += $(this).parents('tr').find('input').eq(1).val() + ',';
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-09-12 19:47:26 +00:00
|
|
|
if (!nodename) {
|
2011-09-09 06:03:09 +00:00
|
|
|
alert('You should select nodes first!');
|
|
|
|
return;
|
|
|
|
}
|
2011-09-12 19:47:26 +00:00
|
|
|
|
|
|
|
// Disabled the button
|
2011-09-09 06:03:09 +00:00
|
|
|
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
|
|
|
|
|
|
|
nodename = nodename.substr(0, nodename.length - 1);
|
|
|
|
$('#pnodeeditarea').append(createLoader());
|
2011-09-12 19:47:26 +00:00
|
|
|
// Send the add request
|
2011-09-09 06:03:09 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
2011-09-21 07:11:31 +00:00
|
|
|
args : 'addnode;node;' + hmcname + ',' + nodename,
|
2011-09-09 06:03:09 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
2011-09-12 19:47:26 +00:00
|
|
|
success : function(data) {
|
|
|
|
// Refresh the area on the right side
|
2011-09-09 06:03:09 +00:00
|
|
|
$('#addpnodeDiv').dialog('close');
|
|
|
|
$('.selectgroup').trigger('click');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-09-12 19:47:26 +00:00
|
|
|
* Select all checkbox in a table
|
2011-09-09 06:03:09 +00:00
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function selectAllRscanNode(obj){
|
|
|
|
var status = $(obj).attr('checked');
|
|
|
|
$(obj).parents('table').find(':checkbox').attr('checked', status);
|
|
|
|
}
|