diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js
index 2716a6f1a..851f7745e 100644
--- a/xCAT-UI/js/custom/blade.js
+++ b/xCAT-UI/js/custom/blade.js
@@ -1,5 +1,8 @@
-$(document).ready(function(){
- // Include utility scripts
+/**
+ * Execute when the DOM is fully loaded
+ */
+$(document).ready(function() {
+ // Load utility scripts
});
/**
@@ -8,7 +11,7 @@ $(document).ready(function(){
* @return Nothing
*/
var bladePlugin = function() {
-
+
};
/**
@@ -19,7 +22,7 @@ var bladePlugin = function() {
* @return Nothing
*/
bladePlugin.prototype.loadInventory = function(data) {
-
+
};
/**
@@ -30,7 +33,7 @@ bladePlugin.prototype.loadInventory = function(data) {
* @return Nothing
*/
bladePlugin.prototype.loadClonePage = function(node) {
-
+
};
/**
@@ -41,9 +44,7 @@ bladePlugin.prototype.loadClonePage = function(node) {
* @return Nothing
*/
bladePlugin.prototype.loadProvisionPage = function(tabId) {
- var errMsg;
-
- // Get the OS image names
+ // Get OS image names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
@@ -71,16 +72,15 @@ bladePlugin.prototype.loadProvisionPage = function(tabId) {
success : setGroupsCookies
});
- // Generate new tab ID
+ // Get provision tab instance
var inst = tabId.replace('bladeProvisionTab', '');
- // Open new tab
// Create provision form
var provForm = $('
');
// Create status bar
- var barId = 'bladeProvisionStatBar' + inst;
- var statBar = createStatusBar(barId);
+ var statBarId = 'bladeProvisionStatBar' + inst;
+ var statBar = createStatusBar(statBarId);
statBar.hide();
provForm.append(statBar);
@@ -96,116 +96,41 @@ bladePlugin.prototype.loadProvisionPage = function(tabId) {
// Append to provision tab
$('#' + tabId).append(provForm);
- // Node name
- var nodeName = $('Node:
');
- provForm.append(nodeName);
-
- // Group
- var group = $('
');
- var groupLabel = $('Group: ');
- var groupInput = $(' ');
+ // Create provision type drop down
+ var provType = $('
');
+ var typeLabel = $('Provision: ');
+ var typeSelect = $(' ');
+ var provNewNode = $('New node ');
+ var provExistNode = $('Existing node ');
+ typeSelect.append(provNewNode);
+ typeSelect.append(provExistNode);
+ provType.append(typeLabel);
+ provType.append(typeSelect);
+ provForm.append(provType);
- // Get the groups on-focus
- groupInput.one('focus', function(){
- var groupNames = $.cookie('Groups');
-
- // If there are groups, turn on auto-complete
- if (groupNames) {
- $(this).autocomplete(groupNames.split(','));
- }
- });
-
- group.append(groupLabel);
- group.append(groupInput);
- provForm.append(group);
-
- // Boot method (boot, install, stat, iscsiboot, netboot, statelite)
- var method = $('
');
- var methodLabel = $('Boot method: ');
- var methodSelect = $(' ');
- methodSelect.append('boot ');
- methodSelect.append('install ');
- methodSelect.append('iscsiboot ');
- methodSelect.append('netboot ');
- methodSelect.append('statelite ');
- method.append(methodLabel);
- method.append(methodSelect);
- provForm.append(method);
-
- // Boot type (zvm, pxe, yaboot)
- var type = $('
');
- var typeLabel = $('Boot type: ');
- var typeSelect = $(' ');
- typeSelect.append('zvm ');
- typeSelect.append('pxe ');
- typeSelect.append('yaboot ');
- type.append(typeLabel);
- type.append(typeSelect);
- provForm.append(type);
-
- // Operating system
- var os = $('
');
- var osLabel = $('Operating system: ');
- var osInput = $(' ');
-
- // Get the OS versions on-focus
- var tmp;
- osInput.one('focus', function(){
- tmp = $.cookie('OSVers');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provForm.append(os);
-
- // Architecture
- var arch = $('
');
- var archLabel = $('Architecture: ');
- var archInput = $(' ');
-
- // Get the OS architectures on-focus
- archInput.one('focus', function(){
- tmp = $.cookie('OSArchs');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provForm.append(arch);
-
- // Profiles
- var profile = $('
');
- var profileLabel = $('Profile: ');
- var profileInput = $(' ');
-
- // Get the profiles on-focus
- profileInput.one('focus', function(){
- tmp = $.cookie('Profiles');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provForm.append(profile);
-
/**
- * Provision
+ * Create provision new node division
*/
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Insert provision code here
+ var provNew = createProvisionNew('blade', inst);
+ provForm.append(provNew);
+
+ /**
+ * Create provision existing node division
+ */
+ var provExisting = createProvisionExisting('blade', inst);
+ provForm.append(provExisting);
+
+ // Toggle provision new/existing on select
+ typeSelect.change(function() {
+ var selected = $(this).val();
+ if (selected == 'new') {
+ provNew.toggle();
+ provExisting.toggle();
+ } else {
+ provNew.toggle();
+ provExisting.toggle();
+ }
});
- provForm.append(provisionBtn);
};
/**
@@ -214,5 +139,5 @@ bladePlugin.prototype.loadProvisionPage = function(tabId) {
* @return Nothing
*/
bladePlugin.prototype.loadResources = function() {
-
+
};
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js
new file mode 100644
index 000000000..83b0fb20a
--- /dev/null
+++ b/xCAT-UI/js/custom/customUtils.js
@@ -0,0 +1,363 @@
+/**
+ * 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;
+
+ // Output ID
+ var outId = data.msg;
+ // 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).children().remove();
+
+ // 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(' ', '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 = ' ';
+ 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)
+ });
+}
+
+/**
+ * Create provision existing node division
+ *
+ * @param plugin
+ * Plugin name to create division for
+ * @param inst
+ * Provision tab instance
+ * @return Provision existing node division
+ */
+function createProvisionExisting(plugin, inst) {
+ // Create provision existing division and hide it
+ var provExisting = $('
').hide();
+
+ // Create group input
+ var group = $('
');
+ var groupLabel = $('Group: ');
+ group.append(groupLabel);
+
+ // Turn on auto complete for group
+ var dTableDivId = plugin + 'NodesDatatableDIV' + 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 = $(' ');
+ groupSelect.append(' ');
+ for ( var i in tmp) {
+ // Add group into drop down
+ var opt = $('' + tmp[i] + ' ');
+ 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 = $(' ');
+ group.append(groupInput);
+ }
+ provExisting.append(group);
+
+ // Create node input
+ var node = $('
');
+ var nodeLabel = $('Nodes: ');
+ var nodeDatatable = $('Select a group to view its nodes
');
+ node.append(nodeLabel);
+ node.append(nodeDatatable);
+ provExisting.append(node);
+
+ // Create boot method drop down
+ var method = $('
');
+ var methodLabel = $('Boot method: ');
+ var methodSelect = $(' ');
+ methodSelect.append('boot ');
+ methodSelect.append('install ');
+ methodSelect.append('iscsiboot ');
+ methodSelect.append('netboot ');
+ methodSelect.append('statelite ');
+ method.append(methodLabel);
+ method.append(methodSelect);
+ provExisting.append(method);
+
+ // Create boot type drop down
+ var type = $('
');
+ var typeLabel = $('Boot type: ');
+ var typeSelect = $(' ');
+ typeSelect.append('pxe ');
+ typeSelect.append('yaboot ');
+ typeSelect.append('zvm ');
+ type.append(typeLabel);
+ type.append(typeSelect);
+ provExisting.append(type);
+
+ // Create operating system input
+ var os = $('
');
+ var osLabel = $('Operating system: ');
+ var osInput = $(' ');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('OSVers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete(tmp.split(','));
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ provExisting.append(os);
+
+ // Create architecture input
+ var arch = $('
');
+ var archLabel = $('Architecture: ');
+ var archInput = $(' ');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('OSArchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete(tmp.split(','));
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ provExisting.append(arch);
+
+ // Create profile input
+ var profile = $('
');
+ var profileLabel = $('Profile: ');
+ var profileInput = $(' ');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('Profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete(tmp.split(','));
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ provExisting.append(profile);
+
+ /**
+ * Provision existing
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // TODO Insert provision code here
+ });
+ provExisting.append(provisionBtn);
+
+ return provExisting;
+}
+
+/**
+ * Create provision new node division
+ *
+ * @param inst
+ * Provision tab instance
+ * @return Provision new node division
+ */
+function createProvisionNew(plugin, inst) {
+ // Create provision new node division
+ var provNew = $('
');
+
+ // Create node input
+ var nodeName = $('Node:
');
+ provNew.append(nodeName);
+
+ // Create group input
+ var group = $('
');
+ var groupLabel = $('Group: ');
+ var groupInput = $(' ');
+ groupInput.one('focus', function() {
+ var groupNames = $.cookie('Groups');
+ if (groupNames) {
+ // Turn on auto complete
+ $(this).autocomplete(groupNames.split(','));
+ }
+ });
+ group.append(groupLabel);
+ group.append(groupInput);
+ provNew.append(group);
+
+ // Create boot method drop down
+ var method = $('
');
+ var methodLabel = $('Boot method: ');
+ var methodSelect = $(' ');
+ methodSelect.append('boot ');
+ methodSelect.append('install ');
+ methodSelect.append('iscsiboot ');
+ methodSelect.append('netboot ');
+ methodSelect.append('statelite ');
+ method.append(methodLabel);
+ method.append(methodSelect);
+ provNew.append(method);
+
+ // Create boot type drop down
+ var type = $('
');
+ var typeLabel = $('Boot type: ');
+ var typeSelect = $(' ');
+ typeSelect.append('pxe ');
+ typeSelect.append('yaboot ');
+ typeSelect.append('zvm ');
+ type.append(typeLabel);
+ type.append(typeSelect);
+ provNew.append(type);
+
+ // Create operating system input
+ var os = $('
');
+ var osLabel = $('Operating system: ');
+ var osInput = $(' ');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('OSVers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete(tmp.split(','));
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ provNew.append(os);
+
+ // Create architecture input
+ var arch = $('
');
+ var archLabel = $('Architecture: ');
+ var archInput = $(' ');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('OSArchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete(tmp.split(','));
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ provNew.append(arch);
+
+ // Create profile input
+ var profile = $('
');
+ var profileLabel = $('Profile: ');
+ var profileInput = $(' ');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('Profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete(tmp.split(','));
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ provNew.append(profile);
+
+ /**
+ * Provision new node
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // TODO Insert provision code here
+ });
+ provNew.append(provisionBtn);
+
+ return provNew;
+}
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/fsp.js b/xCAT-UI/js/custom/fsp.js
index fe14ba61b..508084ea0 100644
--- a/xCAT-UI/js/custom/fsp.js
+++ b/xCAT-UI/js/custom/fsp.js
@@ -1,5 +1,8 @@
-$(document).ready(function(){
- // Include utility scripts
+/**
+ * Execute when the DOM is fully loaded
+ */
+$(document).ready(function() {
+ // Load utility scripts
});
/**
@@ -8,7 +11,7 @@ $(document).ready(function(){
* @return Nothing
*/
var fspPlugin = function() {
-
+
};
/**
@@ -19,7 +22,7 @@ var fspPlugin = function() {
* @return Nothing
*/
fspPlugin.prototype.loadInventory = function(data) {
-
+
};
/**
@@ -30,7 +33,7 @@ fspPlugin.prototype.loadInventory = function(data) {
* @return Nothing
*/
fspPlugin.prototype.loadClonePage = function(node) {
-
+
};
/**
@@ -41,9 +44,7 @@ fspPlugin.prototype.loadClonePage = function(node) {
* @return Nothing
*/
fspPlugin.prototype.loadProvisionPage = function(tabId) {
- var errMsg;
-
- // Get the OS image names
+ // Get OS image names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
@@ -71,16 +72,15 @@ fspPlugin.prototype.loadProvisionPage = function(tabId) {
success : setGroupsCookies
});
- // Generate new tab ID
+ // Get provision tab instance
var inst = tabId.replace('fspProvisionTab', '');
- // Open new tab
// Create provision form
var provForm = $('
');
// Create status bar
- var barId = 'fspProvisionStatBar' + inst;
- var statBar = createStatusBar(barId);
+ var statBarId = 'fspProvisionStatBar' + inst;
+ var statBar = createStatusBar(statBarId);
statBar.hide();
provForm.append(statBar);
@@ -90,122 +90,47 @@ fspPlugin.prototype.loadProvisionPage = function(tabId) {
statBar.append(loader);
// Create info bar
- var infoBar = createInfoBar('Provision a FSP node');
+ var infoBar = createInfoBar('Provision a fsp node');
provForm.append(infoBar);
// Append to provision tab
$('#' + tabId).append(provForm);
- // Node name
- var nodeName = $('Node:
');
- provForm.append(nodeName);
-
- // Group
- var group = $('
');
- var groupLabel = $('Group: ');
- var groupInput = $(' ');
+ // Create provision type drop down
+ var provType = $('
');
+ var typeLabel = $('Provision: ');
+ var typeSelect = $(' ');
+ var provNewNode = $('New node ');
+ var provExistNode = $('Existing node ');
+ typeSelect.append(provNewNode);
+ typeSelect.append(provExistNode);
+ provType.append(typeLabel);
+ provType.append(typeSelect);
+ provForm.append(provType);
- // Get the groups on-focus
- groupInput.one('focus', function(){
- var groupNames = $.cookie('Groups');
-
- // If there are groups, turn on auto-complete
- if (groupNames) {
- $(this).autocomplete(groupNames.split(','));
- }
- });
-
- group.append(groupLabel);
- group.append(groupInput);
- provForm.append(group);
-
- // Boot method (boot, install, stat, iscsiboot, netboot, statelite)
- var method = $('
');
- var methodLabel = $('Boot method: ');
- var methodSelect = $(' ');
- methodSelect.append('boot ');
- methodSelect.append('install ');
- methodSelect.append('iscsiboot ');
- methodSelect.append('netboot ');
- methodSelect.append('statelite ');
- method.append(methodLabel);
- method.append(methodSelect);
- provForm.append(method);
-
- // Boot type (zvm, pxe, yaboot)
- var type = $('
');
- var typeLabel = $('Boot type: ');
- var typeSelect = $(' ');
- typeSelect.append('zvm ');
- typeSelect.append('pxe ');
- typeSelect.append('yaboot ');
- type.append(typeLabel);
- type.append(typeSelect);
- provForm.append(type);
-
- // Operating system
- var os = $('
');
- var osLabel = $('Operating system: ');
- var osInput = $(' ');
-
- // Get the OS versions on-focus
- var tmp;
- osInput.one('focus', function(){
- tmp = $.cookie('OSVers');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provForm.append(os);
-
- // Architecture
- var arch = $('
');
- var archLabel = $('Architecture: ');
- var archInput = $(' ');
-
- // Get the OS architectures on-focus
- archInput.one('focus', function(){
- tmp = $.cookie('OSArchs');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provForm.append(arch);
-
- // Profiles
- var profile = $('
');
- var profileLabel = $('Profile: ');
- var profileInput = $(' ');
-
- // Get the profiles on-focus
- profileInput.one('focus', function(){
- tmp = $.cookie('Profiles');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provForm.append(profile);
-
/**
- * Provision
+ * Create provision new node division
*/
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Insert provision code here
+ var provNew = createProvisionNew('fsp', inst);
+ provForm.append(provNew);
+
+ /**
+ * Create provision existing node division
+ */
+ var provExisting = createProvisionExisting('fsp', inst);
+ provForm.append(provExisting);
+
+ // Toggle provision new/existing on select
+ typeSelect.change(function() {
+ var selected = $(this).val();
+ if (selected == 'new') {
+ provNew.toggle();
+ provExisting.toggle();
+ } else {
+ provNew.toggle();
+ provExisting.toggle();
+ }
});
- provForm.append(provisionBtn);
};
/**
@@ -214,5 +139,5 @@ fspPlugin.prototype.loadProvisionPage = function(tabId) {
* @return Nothing
*/
fspPlugin.prototype.loadResources = function() {
-
+
};
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js
index 66467c668..acf9182fb 100644
--- a/xCAT-UI/js/custom/hmc.js
+++ b/xCAT-UI/js/custom/hmc.js
@@ -1,5 +1,8 @@
-$(document).ready(function(){
- // Include utility scripts
+/**
+ * Execute when the DOM is fully loaded
+ */
+$(document).ready(function() {
+ // Load utility scripts
});
/**
@@ -8,7 +11,7 @@ $(document).ready(function(){
* @return Nothing
*/
var hmcPlugin = function() {
-
+
};
/**
@@ -27,24 +30,23 @@ hmcPlugin.prototype.loadInventory = function(data) {
var node = args[1].replace('node=', '');
// Get node inventory
var inv = data.rsp;
-
+
// Remove loader
var loaderId = tabId + 'TabLoader';
$('#' + loaderId).remove();
-
+
// Create division to hold inventory
var invDivId = tabId + 'Inventory';
var invDiv = $('
');
-
- var fieldSet, legend, oList, item;
-
+
// Loop through each line
+ var fieldSet, legend, oList, item;
for ( var k = 0; k < inv.length; k++) {
- // Remove the node name in front
+ // Remove node name in front
var str = inv[k].replace(node + ': ', '');
-
- // If the string is a header
- if (str.indexOf('I/O Bus Information') > -1 || str.indexOf('Machine Configuration Info') > -1) {
+
+ // If string is a header
+ if (str.indexOf('I/O Bus Information') > -1 || str.indexOf('Machine Configuration Info') > -1) {
// Create a fieldset
fieldSet = $(' ');
legend = $('' + str + ' ');
@@ -55,7 +57,7 @@ hmcPlugin.prototype.loadInventory = function(data) {
} else {
// If no fieldset is defined
if (!fieldSet) {
- // Define fieldset
+ // Define general fieldset
fieldSet = $(' ');
legend = $('General ');
fieldSet.append(legend);
@@ -63,14 +65,14 @@ hmcPlugin.prototype.loadInventory = function(data) {
fieldSet.append(oList);
invDiv.append(fieldSet);
}
-
+
// Append the string to a list
item = $(' ');
- item.append(str);
- oList.append(item);
+ item.append(str);
+ oList.append(item);
}
}
-
+
// Append to inventory form
$('#' + tabId).append(invDiv);
};
@@ -83,7 +85,7 @@ hmcPlugin.prototype.loadInventory = function(data) {
* @return Nothing
*/
hmcPlugin.prototype.loadClonePage = function(node) {
-
+
};
/**
@@ -94,9 +96,7 @@ hmcPlugin.prototype.loadClonePage = function(node) {
* @return Nothing
*/
hmcPlugin.prototype.loadProvisionPage = function(tabId) {
- var errMsg;
-
- // Get the OS image names
+ // Get OS image names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
@@ -124,16 +124,15 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) {
success : setGroupsCookies
});
- // Generate new tab ID
+ // Get provision tab instance
var inst = tabId.replace('hmcProvisionTab', '');
- // Open new tab
// Create provision form
var provForm = $('
');
// Create status bar
- var barId = 'hmcProvisionStatBar' + inst;
- var statBar = createStatusBar(barId);
+ var statBarId = 'hmcProvisionStatBar' + inst;
+ var statBar = createStatusBar(statBarId);
statBar.hide();
provForm.append(statBar);
@@ -143,122 +142,47 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) {
statBar.append(loader);
// Create info bar
- var infoBar = createInfoBar('Provision a HMC node');
+ var infoBar = createInfoBar('Provision a hmc node');
provForm.append(infoBar);
// Append to provision tab
$('#' + tabId).append(provForm);
- // Node name
- var nodeName = $('Node:
');
- provForm.append(nodeName);
-
- // Group
- var group = $('
');
- var groupLabel = $('Group: ');
- var groupInput = $(' ');
+ // Create provision type drop down
+ var provType = $('
');
+ var typeLabel = $('Provision: ');
+ var typeSelect = $(' ');
+ var provNewNode = $('New node ');
+ var provExistNode = $('Existing node ');
+ typeSelect.append(provNewNode);
+ typeSelect.append(provExistNode);
+ provType.append(typeLabel);
+ provType.append(typeSelect);
+ provForm.append(provType);
- // Get the groups on-focus
- groupInput.one('focus', function(){
- var groupNames = $.cookie('Groups');
-
- // If there are groups, turn on auto-complete
- if (groupNames) {
- $(this).autocomplete(groupNames.split(','));
- }
- });
-
- group.append(groupLabel);
- group.append(groupInput);
- provForm.append(group);
-
- // Boot method (boot, install, stat, iscsiboot, netboot, statelite)
- var method = $('
');
- var methodLabel = $('Boot method: ');
- var methodSelect = $(' ');
- methodSelect.append('boot ');
- methodSelect.append('install ');
- methodSelect.append('iscsiboot ');
- methodSelect.append('netboot ');
- methodSelect.append('statelite ');
- method.append(methodLabel);
- method.append(methodSelect);
- provForm.append(method);
-
- // Boot type (zvm, pxe, yaboot)
- var type = $('
');
- var typeLabel = $('Boot type: ');
- var typeSelect = $(' ');
- typeSelect.append('zvm ');
- typeSelect.append('pxe ');
- typeSelect.append('yaboot ');
- type.append(typeLabel);
- type.append(typeSelect);
- provForm.append(type);
-
- // Operating system
- var os = $('
');
- var osLabel = $('Operating system: ');
- var osInput = $(' ');
-
- // Get the OS versions on-focus
- var tmp;
- osInput.one('focus', function(){
- tmp = $.cookie('OSVers');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provForm.append(os);
-
- // Architecture
- var arch = $('
');
- var archLabel = $('Architecture: ');
- var archInput = $(' ');
-
- // Get the OS architectures on-focus
- archInput.one('focus', function(){
- tmp = $.cookie('OSArchs');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provForm.append(arch);
-
- // Profiles
- var profile = $('
');
- var profileLabel = $('Profile: ');
- var profileInput = $(' ');
-
- // Get the profiles on-focus
- profileInput.one('focus', function(){
- tmp = $.cookie('Profiles');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provForm.append(profile);
-
/**
- * Provision
+ * Create provision new node division
*/
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Insert provision code here
+ var provNew = createProvisionNew('hmc', inst);
+ provForm.append(provNew);
+
+ /**
+ * Create provision existing node division
+ */
+ var provExisting = createProvisionExisting('hmc', inst);
+ provForm.append(provExisting);
+
+ // Toggle provision new/existing on select
+ typeSelect.change(function() {
+ var selected = $(this).val();
+ if (selected == 'new') {
+ provNew.toggle();
+ provExisting.toggle();
+ } else {
+ provNew.toggle();
+ provExisting.toggle();
+ }
});
- provForm.append(provisionBtn);
};
/**
@@ -267,5 +191,5 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) {
* @return Nothing
*/
hmcPlugin.prototype.loadResources = function() {
-
+
};
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js
index 9f935dc8c..f4187f4f4 100644
--- a/xCAT-UI/js/custom/ipmi.js
+++ b/xCAT-UI/js/custom/ipmi.js
@@ -1,5 +1,8 @@
-$(document).ready(function(){
- // Include utility scripts
+/**
+ * Execute when the DOM is fully loaded
+ */
+$(document).ready(function() {
+ // Load utility scripts
});
/**
@@ -8,7 +11,7 @@ $(document).ready(function(){
* @return Nothing
*/
var ipmiPlugin = function() {
-
+
};
/**
@@ -19,7 +22,7 @@ var ipmiPlugin = function() {
* @return Nothing
*/
ipmiPlugin.prototype.loadInventory = function(data) {
-
+
};
/**
@@ -30,7 +33,7 @@ ipmiPlugin.prototype.loadInventory = function(data) {
* @return Nothing
*/
ipmiPlugin.prototype.loadClonePage = function(node) {
-
+
};
/**
@@ -41,9 +44,7 @@ ipmiPlugin.prototype.loadClonePage = function(node) {
* @return Nothing
*/
ipmiPlugin.prototype.loadProvisionPage = function(tabId) {
- var errMsg;
-
- // Get the OS image names
+ // Get OS image names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
@@ -71,16 +72,15 @@ ipmiPlugin.prototype.loadProvisionPage = function(tabId) {
success : setGroupsCookies
});
- // Generate new tab ID
+ // Get provision tab instance
var inst = tabId.replace('ipmiProvisionTab', '');
- // Open new tab
// Create provision form
var provForm = $('
');
// Create status bar
- var barId = 'ipmiProvisionStatBar' + inst;
- var statBar = createStatusBar(barId);
+ var statBarId = 'ipmiProvisionStatBar' + inst;
+ var statBar = createStatusBar(statBarId);
statBar.hide();
provForm.append(statBar);
@@ -90,122 +90,47 @@ ipmiPlugin.prototype.loadProvisionPage = function(tabId) {
statBar.append(loader);
// Create info bar
- var infoBar = createInfoBar('Provision a IPMI node');
+ var infoBar = createInfoBar('Provision a ipmi node');
provForm.append(infoBar);
// Append to provision tab
$('#' + tabId).append(provForm);
- // Node name
- var nodeName = $('Node:
');
- provForm.append(nodeName);
-
- // Group
- var group = $('
');
- var groupLabel = $('Group: ');
- var groupInput = $(' ');
+ // Create provision type drop down
+ var provType = $('
');
+ var typeLabel = $('Provision: ');
+ var typeSelect = $(' ');
+ var provNewNode = $('New node ');
+ var provExistNode = $('Existing node ');
+ typeSelect.append(provNewNode);
+ typeSelect.append(provExistNode);
+ provType.append(typeLabel);
+ provType.append(typeSelect);
+ provForm.append(provType);
- // Get the groups on-focus
- groupInput.one('focus', function(){
- var groupNames = $.cookie('Groups');
-
- // If there are groups, turn on auto-complete
- if (groupNames) {
- $(this).autocomplete(groupNames.split(','));
- }
- });
-
- group.append(groupLabel);
- group.append(groupInput);
- provForm.append(group);
-
- // Boot method (boot, install, stat, iscsiboot, netboot, statelite)
- var method = $('
');
- var methodLabel = $('Boot method: ');
- var methodSelect = $(' ');
- methodSelect.append('boot ');
- methodSelect.append('install ');
- methodSelect.append('iscsiboot ');
- methodSelect.append('netboot ');
- methodSelect.append('statelite ');
- method.append(methodLabel);
- method.append(methodSelect);
- provForm.append(method);
-
- // Boot type (zvm, pxe, yaboot)
- var type = $('
');
- var typeLabel = $('Boot type: ');
- var typeSelect = $(' ');
- typeSelect.append('zvm ');
- typeSelect.append('pxe ');
- typeSelect.append('yaboot ');
- type.append(typeLabel);
- type.append(typeSelect);
- provForm.append(type);
-
- // Operating system
- var os = $('
');
- var osLabel = $('Operating system: ');
- var osInput = $(' ');
-
- // Get the OS versions on-focus
- var tmp;
- osInput.one('focus', function(){
- tmp = $.cookie('OSVers');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provForm.append(os);
-
- // Architecture
- var arch = $('
');
- var archLabel = $('Architecture: ');
- var archInput = $(' ');
-
- // Get the OS architectures on-focus
- archInput.one('focus', function(){
- tmp = $.cookie('OSArchs');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provForm.append(arch);
-
- // Profiles
- var profile = $('
');
- var profileLabel = $('Profile: ');
- var profileInput = $(' ');
-
- // Get the profiles on-focus
- profileInput.one('focus', function(){
- tmp = $.cookie('Profiles');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provForm.append(profile);
-
/**
- * Provision
+ * Create provision new node division
*/
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Insert provision code here
+ var provNew = createProvisionNew('ipmi', inst);
+ provForm.append(provNew);
+
+ /**
+ * Create provision existing node division
+ */
+ var provExisting = createProvisionExisting('ipmi', inst);
+ provForm.append(provExisting);
+
+ // Toggle provision new/existing on select
+ typeSelect.change(function() {
+ var selected = $(this).val();
+ if (selected == 'new') {
+ provNew.toggle();
+ provExisting.toggle();
+ } else {
+ provNew.toggle();
+ provExisting.toggle();
+ }
});
- provForm.append(provisionBtn);
};
/**
@@ -214,5 +139,5 @@ ipmiPlugin.prototype.loadProvisionPage = function(tabId) {
* @return Nothing
*/
ipmiPlugin.prototype.loadResources = function() {
-
+
};
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/ivm.js b/xCAT-UI/js/custom/ivm.js
index e77b00ce4..bfe5d2c2b 100644
--- a/xCAT-UI/js/custom/ivm.js
+++ b/xCAT-UI/js/custom/ivm.js
@@ -1,5 +1,8 @@
-$(document).ready(function(){
- // Include utility scripts
+/**
+ * Execute when the DOM is fully loaded
+ */
+$(document).ready(function() {
+ // Load utility scripts
});
/**
@@ -8,7 +11,7 @@ $(document).ready(function(){
* @return Nothing
*/
var ivmPlugin = function() {
-
+
};
/**
@@ -19,7 +22,7 @@ var ivmPlugin = function() {
* @return Nothing
*/
ivmPlugin.prototype.loadInventory = function(data) {
-
+
};
/**
@@ -30,7 +33,7 @@ ivmPlugin.prototype.loadInventory = function(data) {
* @return Nothing
*/
ivmPlugin.prototype.loadClonePage = function(node) {
-
+
};
/**
@@ -41,9 +44,7 @@ ivmPlugin.prototype.loadClonePage = function(node) {
* @return Nothing
*/
ivmPlugin.prototype.loadProvisionPage = function(tabId) {
- var errMsg;
-
- // Get the OS image names
+ // Get OS image names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
@@ -71,16 +72,15 @@ ivmPlugin.prototype.loadProvisionPage = function(tabId) {
success : setGroupsCookies
});
- // Generate new tab ID
+ // Get provision tab instance
var inst = tabId.replace('ivmProvisionTab', '');
- // Open new tab
// Create provision form
var provForm = $('
');
// Create status bar
- var barId = 'ivmProvisionStatBar' + inst;
- var statBar = createStatusBar(barId);
+ var statBarId = 'ivmProvisionStatBar' + inst;
+ var statBar = createStatusBar(statBarId);
statBar.hide();
provForm.append(statBar);
@@ -90,122 +90,47 @@ ivmPlugin.prototype.loadProvisionPage = function(tabId) {
statBar.append(loader);
// Create info bar
- var infoBar = createInfoBar('Provision a IVM node');
+ var infoBar = createInfoBar('Provision a ivm node');
provForm.append(infoBar);
// Append to provision tab
$('#' + tabId).append(provForm);
- // Node name
- var nodeName = $('Node:
');
- provForm.append(nodeName);
-
- // Group
- var group = $('
');
- var groupLabel = $('Group: ');
- var groupInput = $(' ');
+ // Create provision type drop down
+ var provType = $('
');
+ var typeLabel = $('Provision: ');
+ var typeSelect = $(' ');
+ var provNewNode = $('New node ');
+ var provExistNode = $('Existing node ');
+ typeSelect.append(provNewNode);
+ typeSelect.append(provExistNode);
+ provType.append(typeLabel);
+ provType.append(typeSelect);
+ provForm.append(provType);
- // Get the groups on-focus
- groupInput.one('focus', function(){
- var groupNames = $.cookie('Groups');
-
- // If there are groups, turn on auto-complete
- if (groupNames) {
- $(this).autocomplete(groupNames.split(','));
- }
- });
-
- group.append(groupLabel);
- group.append(groupInput);
- provForm.append(group);
-
- // Boot method (boot, install, stat, iscsiboot, netboot, statelite)
- var method = $('
');
- var methodLabel = $('Boot method: ');
- var methodSelect = $(' ');
- methodSelect.append('boot ');
- methodSelect.append('install ');
- methodSelect.append('iscsiboot ');
- methodSelect.append('netboot ');
- methodSelect.append('statelite ');
- method.append(methodLabel);
- method.append(methodSelect);
- provForm.append(method);
-
- // Boot type (zvm, pxe, yaboot)
- var type = $('
');
- var typeLabel = $('Boot type: ');
- var typeSelect = $(' ');
- typeSelect.append('zvm ');
- typeSelect.append('pxe ');
- typeSelect.append('yaboot ');
- type.append(typeLabel);
- type.append(typeSelect);
- provForm.append(type);
-
- // Operating system
- var os = $('
');
- var osLabel = $('Operating system: ');
- var osInput = $(' ');
-
- // Get the OS versions on-focus
- var tmp;
- osInput.one('focus', function(){
- tmp = $.cookie('OSVers');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provForm.append(os);
-
- // Architecture
- var arch = $('
');
- var archLabel = $('Architecture: ');
- var archInput = $(' ');
-
- // Get the OS architectures on-focus
- archInput.one('focus', function(){
- tmp = $.cookie('OSArchs');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provForm.append(arch);
-
- // Profiles
- var profile = $('
');
- var profileLabel = $('Profile: ');
- var profileInput = $(' ');
-
- // Get the profiles on-focus
- profileInput.one('focus', function(){
- tmp = $.cookie('Profiles');
-
- // If there are any, turn on auto-complete
- if (tmp) {
- $(this).autocomplete(tmp.split(','));
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provForm.append(profile);
-
/**
- * Provision
+ * Create provision new node division
*/
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Insert provision code here
+ var provNew = createProvisionNew('ivm', inst);
+ provForm.append(provNew);
+
+ /**
+ * Create provision existing node division
+ */
+ var provExisting = createProvisionExisting('ivm', inst);
+ provForm.append(provExisting);
+
+ // Toggle provision new/existing on select
+ typeSelect.change(function() {
+ var selected = $(this).val();
+ if (selected == 'new') {
+ provNew.toggle();
+ provExisting.toggle();
+ } else {
+ provNew.toggle();
+ provExisting.toggle();
+ }
});
- provForm.append(provisionBtn);
};
/**
@@ -214,5 +139,5 @@ ivmPlugin.prototype.loadProvisionPage = function(tabId) {
* @return Nothing
*/
ivmPlugin.prototype.loadResources = function() {
-
+
};
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js
index 6be75b72e..b616c60d1 100644
--- a/xCAT-UI/js/custom/zvm.js
+++ b/xCAT-UI/js/custom/zvm.js
@@ -1,5 +1,8 @@
+/**
+ * Execute when the DOM is fully loaded
+ */
$(document).ready(function() {
- // Include utility scripts
+ // Load utility scripts
includeJs("js/custom/zvmUtils.js");
});
@@ -24,7 +27,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
var tab = getNodesTab();
var newTabId = node + 'CloneTab';
- // If there is no existing clone tab for this node
+ // If there is no existing clone tab
if (!$('#' + newTabId).length) {
// Get table headers
var table = $('#' + node).parent().parent().parent().parent();
@@ -45,7 +48,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
var aData = dTable.fnGetData(rowPos);
var hcp = aData[hcpCol];
- // Create status bar, hide on load
+ // Create status bar and hide it
var statBarId = node + 'CloneStatusBar';
var statBar = $('
')
.hide();
@@ -58,28 +61,23 @@ zvmPlugin.prototype.loadClonePage = function(node) {
cloneForm.append(statBar);
cloneForm.append(infoBar);
- // Target node range
+ // Create target node range input
cloneForm.append('Target node range:
');
- // Target user ID range
+ // Create target user ID range input
cloneForm.append('Target user ID range:
');
- // Create the rest of the form
- // Include clone source, hardware control point, group, disk pool, and
- // disk password
+ // Create clone source and hardware control point inputs
cloneForm.append('Clone source:
');
cloneForm.append('Hardware control point:
');
- // Group
+ // Create group input
var group = $('
');
var groupLabel = $('Group: ');
var groupInput = $(' ');
-
- // Get the groups on-focus
groupInput.one('focus', function(){
var groupNames = $.cookie('Groups');
-
- // If there are groups, turn on auto-complete
if (groupNames) {
+ // Turn on auto complete
$(this).autocomplete(groupNames.split(','));
}
});
@@ -87,31 +85,30 @@ zvmPlugin.prototype.loadClonePage = function(node) {
group.append(groupInput);
cloneForm.append(group);
- // Get the list of disk pools
+ // Get list of disk pools
var temp = hcp.split('.');
var diskPools = $.cookie(temp[0] + 'DiskPools');
- // Set autocomplete for disk pool
+ // Create disk pool input
var poolDiv = $('
');
var poolLabel = $('Disk pool: ');
- var poolInput = $(' ')
- .autocomplete(diskPools.split(','));
+ var poolInput = $(' ').autocomplete(diskPools.split(','));
poolDiv.append(poolLabel);
poolDiv.append(poolInput);
cloneForm.append(poolDiv);
+ // Create disk password input
cloneForm.append('Disk password:
');
/**
- * Clone
+ * Clone node
*/
var cloneBtn = createButton('Clone');
cloneBtn.bind('click', function(event) {
var ready = true;
var errMsg = '';
- // Check node name, userId, hardware control point, group,
- // and password
+ // Check node name, userId, hardware control point, group, and password
var inputs = $('#' + newTabId + ' input');
for ( var i = 0; i < inputs.length; i++) {
if (!inputs.eq(i).val()
@@ -124,6 +121,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
}
}
+ // Write error message
if (!ready) {
errMsg = errMsg + 'You are missing some inputs. ';
}
@@ -133,7 +131,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
// Get target user ID
var userIdRange = $('#' + newTabId + ' input[name=tgtUserId]').val();
- // Is a node range given
+ // Check node range and user ID range
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
errMsg = errMsg + 'A user ID range and node range needs to be given. ';
@@ -143,21 +141,21 @@ zvmPlugin.prototype.loadClonePage = function(node) {
// Get node base name
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
- // Get the starting index
+ // Get starting index
var nodeStart = parseInt(tmp[0].match(/\d+/));
- // Get the ending index
+ // Get ending index
var nodeEnd = parseInt(tmp[1]);
tmp = userIdRange.split('-');
// Get user ID base name
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
- // Get the starting index
+ // Get starting index
var userIdStart = parseInt(tmp[0].match(/\d+/));
- // Get the ending index
+ // Get ending index
var userIdEnd = parseInt(tmp[1]);
- // If the starting and ending index do not match
+ // If starting and ending index do not match
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
// Not ready to provision
errMsg = errMsg + 'The node range and user ID range does not match. ';
@@ -166,8 +164,9 @@ zvmPlugin.prototype.loadClonePage = function(node) {
}
}
+ // Get source node, hardware control point, group, disk pool, and disk password
var srcNode = $('#' + newTabId + ' input[name=srcNode]').val();
- hcp = $('#' + newTabId + ' input[name=newHcp]').val();
+ var hcp = $('#' + newTabId + ' input[name=newHcp]').val();
var group = $('#' + newTabId + ' input[name=newGroup]').val();
var diskPool = $('#' + newTabId + ' input[name=diskPool]').val();
var diskPw = $('#' + newTabId + ' input[name=diskPw]').val();
@@ -175,32 +174,30 @@ zvmPlugin.prototype.loadClonePage = function(node) {
// If a value is given for every input
if (ready) {
// Disable all inputs
- var inputs = cloneForm.find('input');
- inputs.attr('readonly', 'readonly');
- inputs.css( {
- 'background-color' : '#F2F2F2'
- });
-
+ var inputs = $('#' + newTabId + ' input');
+ inputs.attr('disabled', 'disabled');
+
// If a node range is given
if (nodeRange.indexOf('-') > -1) {
var tmp = nodeRange.split('-');
// Get node base name
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
- // Get the starting index
+ // Get starting index
var nodeStart = parseInt(tmp[0].match(/\d+/));
- // Get the ending index
+ // Get ending index
var nodeEnd = parseInt(tmp[1]);
tmp = userIdRange.split('-');
// Get user ID base name
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
- // Get the starting index
+ // Get starting index
var userIdStart = parseInt(tmp[0].match(/\d+/));
- // Get the ending index
+ // Get ending index
var userIdEnd = parseInt(tmp[1]);
+ // Loop through each node in the node range
for ( var i = nodeStart; i <= nodeEnd; i++) {
var node = nodeBase + i.toString();
var userId = userIdBase + i.toString();
@@ -217,16 +214,17 @@ zvmPlugin.prototype.loadClonePage = function(node) {
tgt : '',
args : node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
- + ';nodehm.mgt=zvm' + ';groups='
- + group,
- msg : 'cmd=nodeadd;inst=' + inst + ';out='
- + statBarId + ';node=' + node
+ + ';nodehm.mgt=zvm'
+ + ';groups=' + group,
+ msg : 'cmd=nodeadd;inst=' + inst
+ + ';out=' + statBarId
+ + ';node=' + node
},
- success : updateCloneStatus
+ success : updateZCloneStatus
});
}
- } else {
+ } else {
/**
* (1) Define node
*/
@@ -238,12 +236,13 @@ zvmPlugin.prototype.loadClonePage = function(node) {
tgt : '',
args : nodeRange + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userIdRange
- + ';nodehm.mgt=zvm' + ';groups=' + group,
+ + ';nodehm.mgt=zvm'
+ + ';groups=' + group,
msg : 'cmd=nodeadd;inst=1/1;out=' + statBarId
+ ';node=' + nodeRange
},
- success : updateCloneStatus
+ success : updateZCloneStatus
});
}
@@ -252,8 +251,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
$('#' + statBarId).append(loader);
$('#' + statBarId).show();
- // Stop this function from executing again
- // Unbind event
+ // Disable clone button
$(this).unbind(event);
$(this).css( {
'background-color' : '#F2F2F2',
@@ -297,7 +295,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
var statBarId = node + 'StatusBar';
var statBar = createStatusBar(statBarId);
- // Add loader to status bar, but hide it
+ // Add loader to status bar and hide it
loaderId = node + 'StatusBarLoader';
var loader = createLoader(loaderId);
statBar.append(loader);
@@ -305,8 +303,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
statBar.hide();
// Create array of property keys
- var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv',
- 'memory', 'proc', 'disk', 'nic');
+ var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'nic');
// Create hash table for property names
var attrNames = new Object();
@@ -364,18 +361,18 @@ zvmPlugin.prototype.loadInventory = function(data) {
// Change text
$(this).text('Show inventory');
- // Stop this function from executing again
- // Unbind event
+ // Disable toggle link
$(this).unbind(event);
});
+ // Align toggle link to the right
var toggleLnkDiv = $('
').css( {
'text-align' : 'right'
});
toggleLnkDiv.append(toggleLink);
/**
- * General info
+ * General info section
*/
var fieldSet = $(' ');
var legend = $('General ');
@@ -400,13 +397,12 @@ zvmPlugin.prototype.loadInventory = function(data) {
oList.append(item);
}
-
// Append to inventory form
fieldSet.append(oList);
invDiv.append(fieldSet);
/**
- * Hardware info
+ * Hardware info section
*/
var hwList, hwItem;
fieldSet = $(' ');
@@ -425,7 +421,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
hwItem = $(' ');
/**
- * Privilege
+ * Privilege section
*/
if (keys[k] == 'priv') {
// Create a label - Property name
@@ -456,7 +452,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
}
/**
- * Memory
+ * Memory section
*/
else if (keys[k] == 'memory') {
// Create a label - Property name
@@ -475,7 +471,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
}
/**
- * Processor
+ * Processor section
*/
else if (keys[k] == 'proc') {
// Create a label - Property name
@@ -563,15 +559,17 @@ zvmPlugin.prototype.loadInventory = function(data) {
var addProcLink = $('Add processor ');
addProcLink.bind('click', function(event) {
var procForm = '';
+ + 'Processor for:
'
+ + 'Processor address:
'
+ + 'Processor type: '
+ + ''
+ + 'CP '
+ + 'IFL '
+ + 'ZAAP '
+ + 'ZIIP '
+ + ' '
+ + '
'
+ + '';
$.prompt(procForm, {
callback : addProcessor,
@@ -589,7 +587,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
}
/**
- * Disk
+ * Disk section
*/
else if (keys[k] == 'disk') {
// Create a label - Property name
@@ -612,8 +610,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
}
}];
- // Table columns - Virtual Device, Type, VolID, Type of Access, and
- // Size
+ // Table columns - Virtual Device, Type, VolID, Type of Access, and Size
var dasdTabRow = $(' Virtual Device # Type VolID Type of Access Size ');
dasdTable.append(dasdTabRow);
var dasdVDev, dasdType, dasdVolId, dasdAccess, dasdSize;
@@ -670,17 +667,13 @@ zvmPlugin.prototype.loadInventory = function(data) {
selectPool = selectPool + '';
var dasdForm = '';
+ + 'Disk for:
'
+ + 'Disk type: 3390
'
+ + 'Disk address:
'
+ + 'Disk size:
'
+ + 'Disk pool: ' + selectPool + '
'
+ + 'Disk password:
'
+ + '';
$.prompt(dasdForm, {
callback : addDisk,
@@ -698,7 +691,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
}
/**
- * NIC
+ * NIC section
*/
else if (keys[k] == 'nic') {
// Create a label - Property name
@@ -712,7 +705,8 @@ zvmPlugin.prototype.loadInventory = function(data) {
/**
* Remove NIC
- */contextMenu = [ {
+ */
+ contextMenu = [ {
'Remove' : function(menuItem, menu) {
if (confirm('Are you sure?')) {
removeNic(node, $(this).text());
@@ -720,8 +714,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
}
} ];
- // Table columns - Virtual device, Adapter Type, Port Name, # of
- // Devices, MAC Address, and LAN Name
+ // Table columns - Virtual device, Adapter Type, Port Name, # of Devices, MAC Address, and LAN Name
var nicTabRow = $('Virtual Device # Adapter Type Port Name # of Devices LAN Name ');
nicTable.append(nicTabRow);
var nicVDev, nicType, nicPortName, nicNumOfDevs, nicMacAddr, nicLanName;
@@ -730,8 +723,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
for (l = 0; l < attrs[keys[k]].length; l = l + 2) {
args = attrs[keys[k]][l].split(' ');
- // Get NIC virtual device, type, port name, and number of
- // devices
+ // Get NIC virtual device, type, port name, and number of devices
nicVDev = $(' ');
nicLink = $('' + args[1] + ' ');
@@ -780,41 +772,34 @@ zvmPlugin.prototype.loadInventory = function(data) {
// Get VSwitches
if (network[0] == 'VSWITCH') {
- vswitches = vswitches + '' + network[0]
- + ' ' + network[1] + ' ';
+ vswitches = vswitches + '' + network[0] + ' ' + network[1] + ' ';
}
// Get Guest LAN
else if (network[0] == 'LAN') {
- gLans = gLans + '' + network[0] + ' '
- + network[1] + ' ';
+ gLans = gLans + '' + network[0] + ' ' + network[1] + ' ';
}
}
vswitches = vswitches + '';
gLans = gLans + '';
var nicTypeForm = '';
- var configGuestLanForm = '';
- var configVSwitchForm = '';
+ + ''
+ + 'Guest LAN '
+ + 'Virtual Switch ' + ' '
+ + ''
+ + '';
+ var configGuestLanForm = '';
+ var configVSwitchForm = '';
var states = {
// Select NIC type
@@ -939,7 +924,7 @@ zvmPlugin.prototype.loadProvisionPage = function(tabId) {
// Error message string
var errMsg;
- // zVM provision tab instance
+ // Get provision tab instance
var inst = tabId.replace('zvmProvisionTab', '');
// Create provision form
diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js
index b242c9792..1e0928bc9 100644
--- a/xCAT-UI/js/custom/zvmUtils.js
+++ b/xCAT-UI/js/custom/zvmUtils.js
@@ -754,7 +754,7 @@ function updateZNodeStatus(data) {
* Data returned from HTTP request
* @return Nothing
*/
-function updateCloneStatus(data) {
+function updateZCloneStatus(data) {
var rsp = data.rsp;
var args = data.msg.split(';');
var cmd = args[0].replace('cmd=', '');
@@ -1534,12 +1534,12 @@ function connect2GuestLan(data) {
var lanName = args[2].replace('lan=', '');
var lanOwner = args[3].replace('owner=', '');
- var statusId = node + 'StatusBar';
+ var statBarId = node + 'StatusBar';
// Write ajax response to status bar
- var prg = writeRsp(rsp, '[A-Za-z0-9._-]+:');
+ var prg = writeRsp(rsp, node + ': ');
$('#' + statBarId).append(prg);
-
+
// Connect NIC to Guest LAN
$.ajax( {
url : 'lib/cmd.php',
@@ -1573,7 +1573,7 @@ function connect2VSwitch(data) {
var statBarId = node + 'StatusBar';
// Write ajax response to status bar
- var prg = writeRsp(rsp, '[A-Za-z0-9._-]+:');
+ var prg = writeRsp(rsp, node + ': ');
$('#' + statBarId).append(prg);
// Connect NIC to VSwitch
@@ -1629,106 +1629,8 @@ function createZProvisionExisting(inst) {
var thisGroup = $(this).val();
// If a valid group is selected
if (thisGroup) {
- // Get group nodes
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'lsdef',
- tgt : '',
- args : thisGroup,
- msg : 'nodesDatatableDIV' + inst
- },
-
- /**
- * Load nodes datatable
- *
- * @param data
- * Data returned from HTTP request
- * @return Nothing
- */
- success : function(data) {
- // Data returned
- var rsp = data.rsp;
- // Output ID
- var outId = data.msg;
- // Datatable ID
- var dTableId = outId.replace('nodesDatatableDIV', 'nodesDatatable');
- // Node attributes hash
- var attrs = new Object();
- // Node attributes
- var headers = new Object();
-
- // Clear nodes datatable division
- $('#' + outId).children().remove();
-
- // 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('Select', '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 = ' ';
- 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)
- });
- } // End of if (thisGroup)
+ createNodesDatatable(thisGroup, 'zNodesDatatableDIV' + inst);
+ }
});
} else {
// If no groups are cookied
@@ -1740,7 +1642,7 @@ function createZProvisionExisting(inst) {
// Create node input
var node = $('
');
var nodeLabel = $('Nodes: ');
- var nodeDatatable = $('Select a group to view its nodes
');
+ var nodeDatatable = $('Select a group to view its nodes
');
node.append(nodeLabel);
node.append(nodeDatatable);
provExisting.append(node);
diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js
index 88d472087..8be49aaef 100644
--- a/xCAT-UI/js/nodes/nodes.js
+++ b/xCAT-UI/js/nodes/nodes.js
@@ -400,31 +400,6 @@ function loadNodes(data) {
actionMenu.superfish();
actionsDIV.append(actionMenu);
actionBar.append(actionsDIV);
-
- /*
- * Select all or none
- */
- var selectDIV = $('
');
- actionBar.append(selectDIV);
-
- // Select all
- var selectLabel = $('Select: ');
- var selectAllLnk = $('All ');
- selectAllLnk.bind('click', function(event) {
- var nodes = $('#nodesDataTable input[type=checkbox]');
- nodes.attr('checked', true);
- });
-
- // Select none
- var selectNoneLnk = $('None ');
- selectNoneLnk.bind('click', function(event) {
- var nodes = $('#nodesDataTable input[type=checkbox]');
- nodes.attr('checked', false);
- });
-
- selectDIV.append(selectLabel);
- selectDIV.append(selectAllLnk);
- selectDIV.append(selectNoneLnk);
$('#nodesTab').append(actionBar);
// Insert table
@@ -2148,8 +2123,20 @@ function getRowNum(nodeName){
return -1;
}
-function selectAllCheckbox(event, obj){
+/**
+ * Select all checkboxes in a given datatable
+ *
+ * @param event
+ * Event on element
+ * @param obj
+ * Object triggering event
+ * @return Nothing
+ */
+function selectAllCheckbox(event, obj) {
+ // Get datatable ID
+ // This will ascend from
+ var datatableId = obj.parent().parent().parent().parent().attr('id');
var status = obj.attr('checked');
- $('#nodesDataTable :checkbox').attr('checked', status);
+ $('#' + datatableId + ' :checkbox').attr('checked', status);
event.stopPropagation();
}
\ No newline at end of file
diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js
index 552147d9a..fa95bf6ac 100644
--- a/xCAT-UI/js/ui.js
+++ b/xCAT-UI/js/ui.js
@@ -416,6 +416,7 @@ function initPage() {
includeJs("js/custom/ipmi.js");
includeJs("js/custom/ivm.js");
includeJs("js/custom/zvm.js");
+ includeJs("js/custom/customUtils.js");
// Get the page being loaded
var url = window.location.pathname;