';
+
+ $.prompt(procForm, {
+ callback : addProcessor,
+ buttons : {
+ Ok : true,
+ Cancel : false
+ },
+ prefix : 'cleanblue'
+ });
+ });
procFooter.append(addProcLink);
procTable.append(procFooter);
@@ -605,14 +592,16 @@ function loadInventory(data) {
var dasdBody = $('');
var dasdFooter = $('');
- // Create context menu - Remove disk
- contextMenu = [ {
+ /**
+ * Remove disk
+ */
+ contextMenu = [{
'Remove' : function(menuItem, menu) {
if (confirm('Are you sure?')) {
removeDisk(node, $(this).text());
}
}
- } ];
+ }];
// Table columns - Virtual Device, Type, VolID, Type of Access, and
// Size
@@ -654,46 +643,45 @@ function loadInventory(data) {
dasdTable.append(dasdBody);
/**
- * Add DASD
+ * Add disk
*/
var addDasdLink = $('Add disk');
- addDasdLink
- .bind('click', function(event) {
- // Get list of disk pools
- var temp = attrs['hcp'][0].split('.');
- var cookie = $.cookie(temp[0] + 'DiskPools');
+ addDasdLink.bind('click', function(event) {
+ // Get list of disk pools
+ var temp = attrs['hcp'][0].split('.');
+ var cookie = $.cookie(temp[0] + 'DiskPools');
- // Create drop down list for disk pool
- var pools = cookie.split(',');
- var selectPool = '';
+ // Create drop down list for disk pool
+ var pools = cookie.split(',');
+ var selectPool = '';
- var dasdForm = '
'
- + ''
- + ''
- + ''
- + ''
- + '
'
- + selectPool
- + '
'
- + ''
- + '
';
+ var dasdForm = '
'
+ + ''
+ + ''
+ + ''
+ + ''
+ + '
'
+ + selectPool
+ + '
'
+ + ''
+ + '
';
- $.prompt(dasdForm, {
- callback : addDisk,
- buttons : {
- Ok : true,
- Cancel : false
- },
- prefix : 'cleanblue'
- });
+ $.prompt(dasdForm, {
+ callback : addDisk,
+ buttons : {
+ Ok : true,
+ Cancel : false
+ },
+ prefix : 'cleanblue'
});
+ });
dasdFooter.append(addDasdLink);
dasdTable.append(dasdFooter);
@@ -713,8 +701,9 @@ function loadInventory(data) {
var nicBody = $('');
var nicFooter = $('');
- // Create context menu - Remove NIC
- contextMenu = [ {
+ /**
+ * Remove NIC
+ */contextMenu = [ {
'Remove' : function(menuItem, menu) {
if (confirm('Are you sure?')) {
removeNic(node, $(this).text());
@@ -769,120 +758,119 @@ function loadInventory(data) {
* Add NIC
*/
var addNicLink = $('Add NIC');
- addNicLink
- .bind('click', function(event) {
- // Get network names
- var temp = attrs['hcp'][0].split('.');
- var networks = $.cookie(temp[0] + 'Networks').split(',');
+ addNicLink.bind('click', function(event) {
+ // Get network names
+ var temp = attrs['hcp'][0].split('.');
+ var networks = $.cookie(temp[0] + 'Networks').split(',');
- // Create a drop down list
- var gLans = '';
+ };
- var nicTypeForm = '
'
- + ''
- + ''
- + '
'
- + ''
- + ''
- + ''
- + ''
- + '
'
- + '
'
- + ''
- + ''
- + '' + ''
- + '
' + '
';
- var configGuestLanForm = '
'
- + '
'
- + gLans + '
' + '
';
- var configVSwitchForm = '
'
- + '
'
- + vswitches + '
' + '
';
-
- var states = {
- // Select NIC type
- type : {
- html : nicTypeForm,
- buttons : {
- Ok : true,
- Cancel : false
- },
- focus : 1,
- prefix : 'cleanblue',
- submit : function(v, m, f) {
- if (!v) {
- return true;
- } else {
- var networkType = f.nicNetworkType;
- if (networkType == 'Guest LAN')
- $.prompt.goToState('configGuestLan');
- else
- $.prompt.goToState('configVSwitch');
- return false;
- }
- }
- },
-
- // Configure guest LAN
- configGuestLan : {
- html : configGuestLanForm,
- callback : addNic,
- buttons : {
- Ok : true,
- Cancel : false
- },
- focus : 1,
- prefix : 'cleanblue',
- submit : function(v, m, f) {
- if (v) {
- return true;
- }
- }
- },
-
- // Configure VSwitch
- configVSwitch : {
- html : configVSwitchForm,
- callback : addNic,
- buttons : {
- Ok : true,
- Cancel : false
- },
- focus : 1,
- prefix : 'cleanblue',
- submit : function(v, m, f) {
- if (v) {
- return true;
- }
- }
- }
- };
-
- $.prompt(states, {
- callback : addNic,
- prefix : 'cleanblue'
- });
+ $.prompt(states, {
+ callback : addNic,
+ prefix : 'cleanblue'
});
+ });
nicFooter.append(addNicLink);
nicTable.append(nicFooter);
@@ -897,14 +885,14 @@ function loadInventory(data) {
invDiv.append(fieldSet);
// Append to tab
- $('#' + tabId).append(statusBar);
+ $('#' + tabId).append(statBar);
$('#' + tabId).append(toggleLnkDiv);
$('#' + tabId).append(ueDiv);
$('#' + tabId).append(invDiv);
}
/**
- * Load zVM provision page
+ * Load provision page
*
* @param tabId
* The provision tab ID
@@ -1128,169 +1116,90 @@ function loadProvisionPage(tabId) {
* Provision
*/
var provisionBtn = createButton('Provision');
- provisionBtn
- .bind('click', function(event) {
- var ready = true;
- errMsg = '';
+ provisionBtn.bind('click', function(event) {
+ var ready = true;
+ errMsg = '';
- // Get the tab ID
- var thisTabId = $(this).parent().parent().attr('id');
- var out2Id = thisTabId.replace('zvmProvisionTab', '');
+ // Get the tab ID
+ var thisTabId = $(this).parent().parent().attr('id');
+ var out2Id = thisTabId.replace('zvmProvisionTab', '');
- // Check node name, userId, hardware control point, and
- // group
- var inputs = $('#' + thisTabId + ' input');
- for ( var i = 0; i < inputs.length; i++) {
- // Do not check OS or disk password
- if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'os'
- && inputs.eq(i).attr('type') != 'password') {
- inputs.eq(i).css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- inputs.eq(i).css('border', 'solid #BDBDBD 1px');
- }
- }
-
- // Check user entry
- var thisUserEntry = $('#' + thisTabId + ' textarea');
- thisUserEntry.val(thisUserEntry.val().toUpperCase());
- if (!thisUserEntry.val()) {
- thisUserEntry.css('border', 'solid #FF0000 1px');
+ // Check node name, userId, hardware control point, and group
+ var inputs = $('#' + thisTabId + ' input');
+ for ( var i = 0; i < inputs.length; i++) {
+ // Do not check OS or disk password
+ if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'os'
+ && inputs.eq(i).attr('type') != 'password') {
+ inputs.eq(i).css('border', 'solid #FF0000 1px');
ready = false;
} else {
- thisUserEntry.css('border', 'solid #BDBDBD 1px');
+ inputs.eq(i).css('border', 'solid #BDBDBD 1px');
}
+ }
- // Check if user entry contains user ID
- var thisUserId = $('#' + thisTabId + ' input[name=userId]');
- var pos = thisUserEntry.val().indexOf(
- 'USER ' + thisUserId.val().toUpperCase());
- if (pos < 0) {
- errMsg = errMsg + 'The user entry does not contain the correct user ID. ';
+ // Check user entry
+ var thisUserEntry = $('#' + thisTabId + ' textarea');
+ thisUserEntry.val(thisUserEntry.val().toUpperCase());
+ if (!thisUserEntry.val()) {
+ thisUserEntry.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ thisUserEntry.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check if user entry contains user ID
+ var thisUserId = $('#' + thisTabId + ' input[name=userId]');
+ var pos = thisUserEntry.val().indexOf(
+ 'USER ' + thisUserId.val().toUpperCase());
+ if (pos < 0) {
+ errMsg = errMsg + 'The user entry does not contain the correct user ID. ';
+ ready = false;
+ }
+
+ // If no operating system is specified, create only user entry
+ os = $('#' + thisTabId + ' input[name=os]');
+
+ // Check number of disks
+ var diskRows = $('#' + thisTabId + ' table tr');
+ // If an OS is given, disks are needed
+ if (os.val() && (diskRows.length < 1)) {
+ errMsg = errMsg + 'You need to add at some disks. ';
+ ready = false;
+ }
+
+ // Check address, size, pool, and password
+ var diskArgs = $('#' + thisTabId + ' table input');
+ for ( var i = 0; i < diskArgs.length; i++) {
+ if (!diskArgs.eq(i).val()
+ && diskArgs.eq(i).attr('type') != 'password') {
+ diskArgs.eq(i).css('border', 'solid #FF0000 1px');
ready = false;
+ } else {
+ diskArgs.eq(i).css('border', 'solid #BDBDBD 1px');
}
+ }
- // If no operating system is specified, create only user
- // entry
- os = $('#' + thisTabId + ' input[name=os]');
-
- // Check number of disks
- var diskRows = $('#' + thisTabId + ' table tr');
- // If an OS is given, disks are needed
- if (os.val() && (diskRows.length < 1)) {
- errMsg = errMsg + 'You need to add at some disks. ';
- ready = false;
- }
-
- // Check address, size, pool, and password
- var diskArgs = $('#' + thisTabId + ' table input');
- for ( var i = 0; i < diskArgs.length; i++) {
- if (!diskArgs.eq(i).val()
- && diskArgs.eq(i).attr('type') != 'password') {
- diskArgs.eq(i).css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- diskArgs.eq(i).css('border', 'solid #BDBDBD 1px');
+ if (ready) {
+ if (!os.val()) {
+ /*
+ * If no OS is given, create a virtual server
+ */
+ var msg = '';
+ if (diskRows.length > 0) {
+ msg = 'Do you want to create virtual server(s) without an operating system ?';
}
- }
- if (ready) {
- if (!os.val()) {
- /**
- * If no OS is given, create a virtual server
- */
- var msg = '';
- if (diskRows.length > 0) {
- msg = 'Do you want to create virtual server(s) without an operating system ?';
- }
-
- // If no disks are given, create a virtual
- // server (no disk)
- else {
- msg = 'Do you want to create virtual server(s) without an operating system or disk(s) ?';
- }
-
- // If the user clicks Ok
- if (confirm(msg)) {
- // Stop this function from executing again
- // Unbind event
- provisionBtn.unbind('click');
- provisionBtn.css( {
- 'background-color' : '#F2F2F2',
- 'color' : '#BDBDBD'
- });
-
- // Show loader
- $('#zProvisionStatBar' + out2Id).show();
- $('#zProvisionLoader' + out2Id).show();
-
- // Stop this function from executing again
- // Unbind event
- addDiskLink.unbind('click');
- addDiskLink.css( {
- 'color' : '#BDBDBD'
- });
-
- // Disable close button on disk table
- $('#' + thisTabId + ' table span').unbind('click');
-
- // Disable all fields
- var inputs = $('#' + thisTabId + ' input');
- inputs.attr('readonly', 'readonly');
- inputs.css( {
- 'background-color' : '#F2F2F2'
- });
-
- var textarea = $('#' + thisTabId + ' textarea');
-
- // Add a new line at the end of the user entry
- var tmp = jQuery.trim(textarea.val());
- textarea.val(tmp + '\n');
-
- textarea.attr('readonly', 'readonly');
- textarea.css( {
- 'background-color' : '#F2F2F2'
- });
-
- // Get node name
- var node = $('#' + thisTabId + ' input[name=nodeName]')
- .val();
- // Get userId
- var userId = $('#' + thisTabId + ' input[name=userId]')
- .val();
- // Get hardware control point
- var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
- // Get group
- var group = $('#' + thisTabId + ' input[name=group]')
- .val();
-
- /**
- * 1. Define node
- */
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeadd',
- tgt : '',
- args : node + ';zvm.hcp=' + hcp
- + ';zvm.userid=' + userId
- + ';nodehm.mgt=zvm' + ';groups=' + group,
- msg : 'cmd=nodeadd;out=' + out2Id
- },
-
- success : updateProvisionStatus
- });
- }
- } else {
- /**
- * Create a virtual server and install OS
- */
+ // If no disks are given, create a virtual server (no disk)
+ else {
+ msg = 'Do you want to create virtual server(s) without an operating system or disk(s) ?';
+ }
+ // If the user clicks Ok
+ if (confirm(msg)) {
// Stop this function from executing again
// Unbind event
- $(this).unbind(event);
- $(this).css( {
+ provisionBtn.unbind('click');
+ provisionBtn.css( {
'background-color' : '#F2F2F2',
'color' : '#BDBDBD'
});
@@ -1336,10 +1245,11 @@ function loadProvisionPage(tabId) {
// Get hardware control point
var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
// Get group
- var group = $('#' + thisTabId + ' input[name=group]').val();
+ var group = $('#' + thisTabId + ' input[name=group]')
+ .val();
/**
- * 1. Define node
+ * (1) Define node
*/
$.ajax( {
url : 'lib/cmd.php',
@@ -1347,9 +1257,9 @@ function loadProvisionPage(tabId) {
data : {
cmd : 'nodeadd',
tgt : '',
- args : node + ';zvm.hcp=' + hcp + ';zvm.userid='
- + userId + ';nodehm.mgt=zvm' + ';groups='
- + group,
+ args : node + ';zvm.hcp=' + hcp
+ + ';zvm.userid=' + userId
+ + ';nodehm.mgt=zvm' + ';groups=' + group,
msg : 'cmd=nodeadd;out=' + out2Id
},
@@ -1357,9 +1267,83 @@ function loadProvisionPage(tabId) {
});
}
} else {
- alert('(Error) ' + errMsg);
+ /**
+ * Create a virtual server and install OS
+ */
+
+ // Stop this function from executing again
+ // Unbind event
+ $(this).unbind(event);
+ $(this).css( {
+ 'background-color' : '#F2F2F2',
+ 'color' : '#BDBDBD'
+ });
+
+ // Show loader
+ $('#zProvisionStatBar' + out2Id).show();
+ $('#zProvisionLoader' + out2Id).show();
+
+ // Stop this function from executing again
+ // Unbind event
+ addDiskLink.unbind('click');
+ addDiskLink.css( {
+ 'color' : '#BDBDBD'
+ });
+
+ // Disable close button on disk table
+ $('#' + thisTabId + ' table span').unbind('click');
+
+ // Disable all fields
+ var inputs = $('#' + thisTabId + ' input');
+ inputs.attr('readonly', 'readonly');
+ inputs.css( {
+ 'background-color' : '#F2F2F2'
+ });
+
+ var textarea = $('#' + thisTabId + ' textarea');
+
+ // Add a new line at the end of the user entry
+ var tmp = jQuery.trim(textarea.val());
+ textarea.val(tmp + '\n');
+
+ textarea.attr('readonly', 'readonly');
+ textarea.css( {
+ 'background-color' : '#F2F2F2'
+ });
+
+ // Get node name
+ var node = $('#' + thisTabId + ' input[name=nodeName]')
+ .val();
+ // Get userId
+ var userId = $('#' + thisTabId + ' input[name=userId]')
+ .val();
+ // Get hardware control point
+ var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
+ // Get group
+ var group = $('#' + thisTabId + ' input[name=group]').val();
+
+ /**
+ * (1) Define node
+ */
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeadd',
+ tgt : '',
+ args : node + ';zvm.hcp=' + hcp + ';zvm.userid='
+ + userId + ';nodehm.mgt=zvm' + ';groups='
+ + group,
+ msg : 'cmd=nodeadd;out=' + out2Id
+ },
+
+ success : updateProvisionStatus
+ });
}
- });
+ } else {
+ alert('(Error) ' + errMsg);
+ }
+ });
provForm.append(provisionBtn);
}
diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js
index cd071f374..cc9f1dd30 100644
--- a/xCAT-UI/js/custom/zvmUtils.js
+++ b/xCAT-UI/js/custom/zvmUtils.js
@@ -1,8 +1,8 @@
/**
* Global variables
*/
-var diskDataTable; // zVM datatable containing disks
-var networkDataTable; // zVM datatable containing networks
+var diskDatatable; // zVM datatable containing disks
+var networkDatatable; // zVM datatable containing networks
/**
* Get the disk datatable
@@ -11,7 +11,7 @@ var networkDataTable; // zVM datatable containing networks
* @return Data table object
*/
function getDiskDataTable() {
- return diskDataTable;
+ return diskDatatable;
}
/**
@@ -22,7 +22,7 @@ function getDiskDataTable() {
* @return Nothing
*/
function setDiskDataTable(table) {
- diskDataTable = table;
+ diskDatatable = table;
}
/**
@@ -32,7 +32,7 @@ function setDiskDataTable(table) {
* @return Data table object
*/
function getNetworkDataTable() {
- return networkDataTable;
+ return networkDatatable;
}
/**
@@ -43,7 +43,7 @@ function getNetworkDataTable() {
* @return Nothing
*/
function setNetworkDataTable(table) {
- networkDataTable = table;
+ networkDatatable = table;
}
/**
@@ -115,7 +115,9 @@ function loadUserEntry(data) {
cancelBtn.show();
});
- // Save button
+ /**
+ * Save
+ */
var saveBtn = createButton('Save');
saveBtn.hide();
saveBtn.bind('click', function(event) {
@@ -144,7 +146,7 @@ function loadUserEntry(data) {
});
// Increment node process and save it in a cookie
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
txtArea.attr('readonly', 'readonly');
txtArea.css( {
@@ -158,7 +160,9 @@ function loadUserEntry(data) {
cancelBtn.hide();
});
- // Cancel button
+ /**
+ * Cancel
+ */
var cancelBtn = createButton('Cancel');
cancelBtn.hide();
cancelBtn.bind('click', function(event) {
@@ -188,20 +192,20 @@ function loadUserEntry(data) {
* Node to set cookie for
* @return Nothing
*/
-function incrementZNodeProcess(node) {
+function incrementNodeProcess(node) {
// Set cookie for number actions performed against node
- var actions = $.cookie(node + 'Processes');
- if (actions) {
+ var procs = $.cookie(node + 'Processes');
+ if (procs) {
// One more process
- actions = parseInt(actions) + 1;
- $.cookie(node + 'Processes', actions);
+ procs = parseInt(procs) + 1;
+ $.cookie(node + 'Processes', procs);
} else {
$.cookie(node + 'Processes', 1);
}
}
/**
- * Update the provision status bar
+ * Update the provision status
*
* @param data
* Data returned from HTTP request
@@ -235,10 +239,9 @@ function updateProvisionStatus(data) {
var osImage = $('#' + tabId + ' input[name=os]').val();
/**
- * 2. Update /etc/hosts
+ * (2) Update /etc/hosts
*/
if (cmd == 'nodeadd') {
-
// If no output, no errors occurred
if (rsp.length) {
$('#' + statBarId).append(
@@ -264,7 +267,7 @@ function updateProvisionStatus(data) {
}
/**
- * 3. Update DNS
+ * (3) Update DNS
*/
else if (cmd == 'makehosts') {
// If no output, no errors occurred
@@ -291,7 +294,7 @@ function updateProvisionStatus(data) {
}
/**
- * 4. Create user entry
+ * (4) Create user entry
*/
else if (cmd == 'makedns') {
// Reset the number of tries
@@ -325,7 +328,7 @@ function updateProvisionStatus(data) {
}
/**
- * 5. Add disk and format disk
+ * (5) Add disk
*/
else if (cmd == 'mkvm') {
var failed = false;
@@ -383,14 +386,12 @@ function updateProvisionStatus(data) {
}
// If there were no errors
else {
-
// Reset the number of tries
$.cookie('tries4' + tabId, 0);
// Set cookie for number of disks
var diskRows = $('#' + tabId + ' table tr');
$.cookie('zProvisionDisks2Add' + out2Id, diskRows.length);
-
if (diskRows.length > 0) {
for ( var i = 0; i < diskRows.length; i++) {
var diskArgs = diskRows.eq(i).find('td');
@@ -431,7 +432,7 @@ function updateProvisionStatus(data) {
}
/**
- * 6. Set the operating system for given node
+ * (6) Set the operating system for given node
*/
else if (cmd == 'chvm') {
var failed = false;
@@ -550,7 +551,7 @@ function updateProvisionStatus(data) {
}
/**
- * 7. Update DHCP
+ * (7) Update DHCP
*/
else if (cmd == 'noderes') {
// If no output, no errors occurred
@@ -578,7 +579,7 @@ function updateProvisionStatus(data) {
}
/**
- * 8. Prepare node for boot
+ * (8) Prepare node for boot
*/
else if (cmd == 'makedhcp') {
var failed = false;
@@ -619,7 +620,7 @@ function updateProvisionStatus(data) {
}
/**
- * 9. Boot node from network
+ * (9) Boot node to network
*/
else if (cmd == 'nodeset') {
var failed = false;
@@ -667,7 +668,7 @@ function updateProvisionStatus(data) {
}
/**
- * 10. Done
+ * (10) Done
*/
else if (cmd == 'rnetboot') {
var failed = false;
@@ -705,7 +706,7 @@ function updateProvisionStatus(data) {
}
/**
- * Update node status bar
+ * Update zVM node status
*
* @param data
* Data returned from HTTP request
@@ -720,13 +721,14 @@ function updateZNodeStatus(data) {
// One less process
actions = actions - 1;
$.cookie(node + 'Processes', actions);
+
if (actions < 1) {
// Hide loader when there are no more processes
var statusBarLoaderId = node + 'StatusBarLoader';
$('#' + statusBarLoaderId).hide();
}
- var statusId = node + 'StatusBar';
+ var statBarId = node + 'StatusBar';
var failed = false;
// Separate output into lines
@@ -746,11 +748,11 @@ function updateZNodeStatus(data) {
}
}
- $('#' + statusId).append(p);
+ $('#' + statBarId).append(p);
}
/**
- * Update the clone status bar
+ * Update the clone status
*
* @param data
* Data returned from HTTP request
@@ -766,7 +768,7 @@ function updateCloneStatus(data) {
var out2Id = args[2].replace('out=', '');
/**
- * 2. Update /etc/hosts
+ * (2) Update /etc/hosts
*/
if (cmd == 'nodeadd') {
var node = args[3].replace('node=', '');
@@ -800,7 +802,7 @@ function updateCloneStatus(data) {
}
/**
- * 3. Update DNS
+ * (3) Update DNS
*/
else if (cmd == 'makehosts') {
// If no output, no errors occurred
@@ -827,7 +829,7 @@ function updateCloneStatus(data) {
}
/**
- * 4. Clone
+ * (4) Clone
*/
else if (cmd == 'makedns') {
// Separate output into lines
@@ -841,6 +843,8 @@ function updateCloneStatus(data) {
$('#' + out2Id).append(p);
+ // The tab must be opened for this to work
+
// Get clone tab
var tabId = out2Id.replace('CloneStatusBar', 'CloneTab');
@@ -849,6 +853,7 @@ function updateCloneStatus(data) {
var tgtNodes = '';
if (tgtNodeRange.indexOf('-') > -1) {
var tmp = tgtNodeRange.split('-');
+
// Get node base name
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
// Get the starting index
@@ -867,9 +872,7 @@ function updateCloneStatus(data) {
} else {
tgtNodes = tgtNodeRange;
}
-
- // The tab must be opened for this to work
-
+
// Get other inputs
var srcNode = $('#' + tabId + ' input[name=srcNode]').val();
hcp = $('#' + tabId + ' input[name=newHcp]').val();
@@ -896,7 +899,7 @@ function updateCloneStatus(data) {
}
/**
- * 5. Done
+ * (5) Done
*/
else if (cmd == 'mkvm') {
var failed = false;
@@ -924,14 +927,14 @@ function updateCloneStatus(data) {
}
/**
- * Get the resources
+ * Get zVM resources
*
* @param data
* Data from HTTP request
* @return Nothing
*/
function getZResources(data) {
- // Do not set cookie if there is no output
+ // Do not continue if there is no output
if (data.rsp) {
// Loop through each line
var node, hcp;
@@ -1007,7 +1010,6 @@ function getNodeAttrs(keys, propNames, data) {
// Loop through property keys
// Does this line contains one of the properties?
for ( var j = 0; j < keys.length; j++) {
-
// Find property name
if (data[i].indexOf(propNames[keys[j]]) > -1) {
attrs[keys[j]] = new Array();
@@ -1073,7 +1075,7 @@ function addProcessor(v, m, f) {
});
// Increment node process and save it in a cookie
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
// Show loader
var statusId = node + 'StatusBar';
@@ -1122,7 +1124,7 @@ function addDisk(v, m, f) {
});
// Increment node process and save it in a cookie
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
// Show loader
var statusId = node + 'StatusBar';
@@ -1200,7 +1202,7 @@ function addNic(v, m, f) {
}
// Increment node process and save it in a cookie
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
// Show loader
var statusId = node + 'StatusBar';
@@ -1235,7 +1237,7 @@ function removeProcessor(node, address) {
});
// Increment node process and save it in a cookie
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
// Show loader
var statusId = node + 'StatusBar';
@@ -1269,7 +1271,7 @@ function removeDisk(node, address) {
});
// Increment node process and save it in a cookie
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
// Show loader
var statusId = node + 'StatusBar';
@@ -1306,7 +1308,7 @@ function removeNic(node, nic) {
});
// Set cookie for number actions performed against node
- incrementZNodeProcess(node);
+ incrementNodeProcess(node);
// Show loader
var statusId = node + 'StatusBar';
diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js
index 396a8702e..a2feb0302 100644
--- a/xCAT-UI/js/nodes/nodes.js
+++ b/xCAT-UI/js/nodes/nodes.js
@@ -203,7 +203,7 @@ function loadNodes(data) {
// Load the plugin code
// Plugin code should be located under js/custom/
- // Plugin names should be valid values of mgt
+ // Plugin names should be valid values of nodehm.mgt
for ( var p in plugins) {
resetJs();
includeJs("js/custom/" + p + ".js");
@@ -858,14 +858,14 @@ function loadNodesetPage(trgtNodes) {
var nodesetForm = $('');
// Create status bar
- var barId = 'nodesetStatusBar' + inst;
- var statusBar = createStatusBar(barId);
- statusBar.hide();
- nodesetForm.append(statusBar);
+ var statBarId = 'nodesetStatusBar' + inst;
+ var statBar = createStatusBar(statBarId);
+ statBar.hide();
+ nodesetForm.append(statBar);
// Create loader
var loader = createLoader('nodesetLoader');
- statusBar.append(loader);
+ statBar.append(loader);
// Create info bar
var infoBar = createInfoBar('Set the boot state for a node range');
@@ -997,7 +997,7 @@ function loadNodesetPage(trgtNodes) {
});
/**
- * 1. Set the OS, arch, and profile
+ * (1) Set the OS, arch, and profile
*/
$.ajax( {
url : 'lib/cmd.php',
@@ -1015,7 +1015,7 @@ function loadNodesetPage(trgtNodes) {
});
// Show status bar
- statusBar.show();
+ statBar.show();
} else {
alert('You are missing some values');
}
@@ -1174,7 +1174,7 @@ function loadNetbootPage(tgtNodes) {
});
/**
- * 1. Boot to network
+ * (1) Boot to network
*/
$.ajax( {
url : 'lib/cmd.php',
@@ -1431,7 +1431,7 @@ function loadUpdatenodePage(tgtNodes) {
});
/**
- * 1. Boot to network
+ * (1) Boot to network
*/
$.ajax( {
url : 'lib/cmd.php',
@@ -1455,7 +1455,7 @@ function loadUpdatenodePage(tgtNodes) {
updatenodeForm.append(okBtn);
// Append to discover tab
- tab.add(newTabId, 'updatenode', updatenodeForm);
+ tab.add(newTabId, 'Updatenode', updatenodeForm);
// Select new tab
tab.select(newTabId);
@@ -1625,7 +1625,7 @@ function updateNodesetStatus(data) {
var method = $('#' + tabId + ' select[id=bootMethod]').val();
/**
- * 2. Update /etc/hosts
+ * (2) Update /etc/hosts
*/
if (cmd == 'nodeadd') {
// If no output, no errors occurred
@@ -1682,7 +1682,7 @@ function updateNodesetStatus(data) {
}
/**
- * 4. Update DNS
+ * (4) Update DNS
*/
else if (cmd == 'makehosts') {
// If no output, no errors occurred
@@ -1709,7 +1709,7 @@ function updateNodesetStatus(data) {
}
/**
- * 5. Update DHCP
+ * (5) Update DHCP
*/
else if (cmd == 'makedns') {
// Separate output into lines
@@ -1739,7 +1739,7 @@ function updateNodesetStatus(data) {
}
/**
- * 6. Prepare node for boot
+ * (6) Prepare node for boot
*/
else if (cmd == 'makedhcp') {
var failed = false;
@@ -1780,7 +1780,7 @@ function updateNodesetStatus(data) {
}
/**
- * 7. Boot node from network
+ * (7) Boot node from network
*/
else if (cmd == 'nodeset') {
var tgtsArray = tgts.split(',');
@@ -1808,7 +1808,7 @@ function updateNodesetStatus(data) {
}
/**
- * Update the status bar
+ * Update the status bar of a given tab
*
* @param data
* Data returned from HTTP request
@@ -1848,8 +1848,7 @@ function updateStatusBar(data) {
for ( var i = 0; i < rsp.length; i++) {
if (rsp[i]) {
// Determine if the command failed
- if (rsp[i].indexOf("Error") > -1
- || rsp[i].indexOf("Failed") > -1) {
+ if (rsp[i].indexOf("Error") > -1 || rsp[i].indexOf("Failed") > -1) {
failed = true;
}
@@ -1886,8 +1885,7 @@ function updateStatusBar(data) {
if (rsp[i]) {
// Find the node name and insert a break before it
for ( var j = 0; j < tgts.length; j++) {
- rsp[i] = rsp[i].replace(new RegExp(tgts[j], 'g'),
- ' ' + tgts[j]);
+ rsp[i] = rsp[i].replace(new RegExp(tgts[j], 'g'), ' ' + tgts[j]);
}
p.append(rsp[i]);
@@ -1900,7 +1898,7 @@ function updateStatusBar(data) {
}
/**
- * Check the completeness of the form
+ * Check if the form is complete
*
* @param tabId
* Tab ID containing form
@@ -1915,6 +1913,7 @@ function formComplete(tabId) {
// If there is no value given in the input
if (!inputs.eq(i).val()) {
inputs.eq(i).css('border', 'solid #FF0000 1px');
+
// It is not complete
ready = false;
} else {
@@ -1926,7 +1925,7 @@ function formComplete(tabId) {
}
/**
- * Update the power status of the node
+ * Update the power status of a node in the datatable
*
* @param data
* Data from HTTP request
diff --git a/xCAT-UI/js/provision/provision.js b/xCAT-UI/js/provision/provision.js
index 9c57044fe..515d7d125 100644
--- a/xCAT-UI/js/provision/provision.js
+++ b/xCAT-UI/js/provision/provision.js
@@ -99,6 +99,7 @@ function loadProvisionPage() {
tab.add(newTabId, hw, '');
// Load plugin code
+ resetJs();
includeJs("js/custom/" + hw + ".js");
// Select tab
diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php
index b35e1d32b..79ae00801 100644
--- a/xCAT-UI/lib/functions.php
+++ b/xCAT-UI/lib/functions.php
@@ -111,7 +111,7 @@ function submit_request($req, $skipVerify){
* $key
* @return
*/
-function xorcrypt($data,$key) {
+function xorcrypt($data, $key) {
$datalen = strlen($data);
$keylen = strlen($key);
for ($i=0;$i<$datalen;$i++) {
@@ -142,7 +142,7 @@ function getpassword() {
/**
* Get the password splitting knowledge between server
* and client side persistant storage. Caller should regenerate
- * session id when contemplating a new user/password, to preclude
+ * session ID when contemplating a new user/password, to preclude
* session fixation, though fixation is limited without the secret.
*
* @param $password Password
@@ -161,7 +161,7 @@ function setpassword($password) {
}
/**
- * Get RAND characters.
+ * Get RAND characters
*
* @param $length Length of characters
* @return RAND characters
diff --git a/xCAT-UI/lib/zCmd.php b/xCAT-UI/lib/zCmd.php
index 9b81d8162..03ec6eb38 100644
--- a/xCAT-UI/lib/zCmd.php
+++ b/xCAT-UI/lib/zCmd.php
@@ -95,7 +95,7 @@ if (isset($_GET["cmd"])) {
}
}
- // Unlock virtual server
+ // Run shell script
// This is a typical command used by all platforms. It is put here because
// most of the code needed are already here
else if (strncasecmp($cmd, "xdsh", 4) == 0) {