diff --git a/xCAT-UI/js/configure/configure.js b/xCAT-UI/js/configure/configure.js
index 11498acb9..2adcd2cec 100644
--- a/xCAT-UI/js/configure/configure.js
+++ b/xCAT-UI/js/configure/configure.js
@@ -7,36 +7,30 @@ var configDatatables = new Object(); // Datatables on the config page
/**
* Set the datatable
*
- * @param id
- * The ID of the datatable
- * @param obj
- * Datatable object
- * @return Nothing
+ * @param id The ID of the datatable
+ * @param obj Datatable object
*/
function setConfigDatatable(id, obj) {
- configDatatables[id] = obj;
+ configDatatables[id] = obj;
}
/**
* Get the datatable with the given ID
*
- * @param id
- * The ID of the datatable
+ * @param id The ID of the datatable
* @return Datatable object
*/
function getConfigDatatable(id) {
- return configDatatables[id];
+ return configDatatables[id];
}
/**
* Set the configure tab
*
- * @param obj
- * Tab object
- * @return Nothing
+ * @param obj Tab object
*/
function setConfigTab(obj) {
- configTabs = obj;
+ configTabs = obj;
}
/**
@@ -46,462 +40,449 @@ function setConfigTab(obj) {
* @return Tab object
*/
function getConfigTab() {
- return configTabs;
+ return configTabs;
}
/**
* Load configure page
- *
- * @return Nothing
*/
function loadConfigPage() {
- // If the configure page has already been loaded
- if ($('#content').children().length) {
- // Do not reload configure page
- return;
- }
+ // If the configure page has already been loaded
+ if ($('#content').children().length) {
+ // Do not reload configure page
+ return;
+ }
- // Create configure tab
- var tab = new Tab();
- setConfigTab(tab);
- tab.init();
- $('#content').append(tab.object());
+ // Create configure tab
+ var tab = new Tab();
+ setConfigTab(tab);
+ tab.init();
+ $('#content').append(tab.object());
- // Create loader
- var loader = $('
').append(createLoader());
+ // Create loader
+ var loader = $('
').append(createLoader());
- // Add tab to configure xCAT tables
- tab.add('configTablesTab', 'Tables', loader, false);
+ // Add tab to configure xCAT tables
+ tab.add('configTablesTab', 'Tables', loader, false);
- // Add the update tab
- tab.add('updateTab', 'Update', '', false);
-
- // Add the discover tab
- tab.add('discoverTab', 'Discover', '', false);
-
- // Add the self-service tab
- tab.add('serviceTab', 'Service', '', false);
+ // Add the update tab
+ tab.add('updateTab', 'Update', '', false);
+
+ // Add the discover tab
+ tab.add('discoverTab', 'Discover', '', false);
+
+ // Add the self-service tab
+ tab.add('serviceTab', 'Service', '', false);
- // Get list of tables and their descriptions
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : '-d',
- msg : ''
- },
+ // Get list of tables and their descriptions
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : '-d',
+ msg : ''
+ },
- success : loadTableNames
- });
+ success : loadTableNames
+ });
- loadUpdatePage();
- loadDiscoverPage();
- loadServicePage();
+ loadUpdatePage();
+ loadDiscoverPage();
+ loadServicePage();
}
/**
* Load xCAT database table names and their descriptions
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function loadTableNames(data) {
- // Get output
- var tables = data.rsp;
+ // Get output
+ var tables = data.rsp;
- // Remove loader
- var tabId = 'configTablesTab';
- $('#' + tabId).find('img').hide();
+ // Remove loader
+ var tabId = 'configTablesTab';
+ $('#' + tabId).find('img').hide();
- // Create a groups division
- var tablesDIV = $('');
- $('#' + tabId).append(tablesDIV);
+ // Create a groups division
+ var tablesDIV = $('');
+ $('#' + tabId).append(tablesDIV);
- // Create info bar
- var infoBar = createInfoBar('Select a table to view or edit.');
- tablesDIV.append(infoBar);
+ // Create info bar
+ var infoBar = createInfoBar('Select a table to view or edit.');
+ tablesDIV.append(infoBar);
- // Create a list for the tables
- var list = $('
');
- // Loop through each table
- for ( var i = 0; i < tables.length; i++) {
- // Create a link for each table
- var args = tables[i].split(':');
- var link = $('' + args[0] + '');
+ // Create a list for the tables
+ var list = $('
');
+ // Loop through each table
+ for ( var i = 0; i < tables.length; i++) {
+ // Create a link for each table
+ var args = tables[i].split(':');
+ var link = $('' + args[0] + '');
- // Open table on click
- link.bind('click', function(e) {
- // Get table ID that was clicked
- var id = (e.target) ? e.target.id : e.srcElement.id;
+ // Open table on click
+ link.bind('click', function(e) {
+ // Get table ID that was clicked
+ var id = (e.target) ? e.target.id : e.srcElement.id;
- // Create loader
- var loader = $('
').append(createLoader());
+ // Create loader
+ var loader = $('
').append(createLoader());
- // Add a new tab for this table
- var configTab = getConfigTab();
- if (!$('#' + id + 'Tab').length) {
- configTab.add(id + 'Tab', id, loader, true);
+ // Add a new tab for this table
+ var configTab = getConfigTab();
+ if (!$('#' + id + 'Tab').length) {
+ configTab.add(id + 'Tab', id, loader, true);
- // Get contents of selected table
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : id,
- msg : id
- },
+ // Get contents of selected table
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : id,
+ msg : id
+ },
- success : loadTable
- });
- }
+ success : loadTable
+ });
+ }
- // Select new tab
- configTab.select(id + 'Tab');
- });
+ // Select new tab
+ configTab.select(id + 'Tab');
+ });
- var item = $('');
- item.append(link);
+ var item = $('');
+ item.append(link);
- // Append the table description
- item.append(': ' + args[1]);
+ // Append the table description
+ item.append(': ' + args[1]);
- // Append item to list
- list.append(item);
- }
+ // Append item to list
+ list.append(item);
+ }
- tablesDIV.append(list);
+ tablesDIV.append(list);
}
/**
* Load a given database table
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function loadTable(data) {
- // Get response
- var rsp = data.rsp;
- // Get table ID
- var id = data.msg;
+ // Get response
+ var rsp = data.rsp;
+ // Get table ID
+ var id = data.msg;
- // Remove loader
- var tabId = id + 'Tab';
- $('#' + tabId).find('img').remove();
+ // Remove loader
+ var tabId = id + 'Tab';
+ $('#' + tabId).find('img').remove();
- // Create info bar
- var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are satisfied with how the table looks, click on Save.');
- $('#' + tabId).append(infoBar);
+ // Create info bar
+ var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are satisfied with how the table looks, click on Save.');
+ $('#' + tabId).append(infoBar);
- // Create action bar
- var actionBar = $('');
- $('#' + tabId).append(actionBar);
+ // Create action bar
+ var actionBar = $('');
+ $('#' + tabId).append(actionBar);
- // Get table headers
- var args = rsp[0].replace('#', '');
- var headers = args.split(',');
+ // Get table headers
+ var args = rsp[0].replace('#', '');
+ var headers = args.split(',');
- // Create container for original table contents
- var origCont = new Array(); // Original table content
- origCont[0] = rsp[0].split(','); // Headers
+ // Create container for original table contents
+ var origCont = new Array(); // Original table content
+ origCont[0] = rsp[0].split(','); // Headers
- // Create container for new table contents
- var newCont = new Object();
- var tmp = new Object();
- tmp[0] = '#' + headers[0]; // Put a # in front of the header
- for ( var i = 1; i < headers.length; i++) {
- tmp[i] = headers[i];
- }
- newCont[0] = tmp;
+ // Create container for new table contents
+ var newCont = new Object();
+ var tmp = new Object();
+ tmp[0] = '#' + headers[0]; // Put a # in front of the header
+ for ( var i = 1; i < headers.length; i++) {
+ tmp[i] = headers[i];
+ }
+ newCont[0] = tmp;
- // Create a new datatable
- var tableId = id + 'Datatable';
- var table = new DataTable(tableId);
+ // Create a new datatable
+ var tableId = id + 'Datatable';
+ var table = new DataTable(tableId);
- // Add column for the remove row button
- headers.unshift('');
- table.init(headers);
- headers.shift();
+ // Add column for the remove row button
+ headers.unshift('');
+ table.init(headers);
+ headers.shift();
- // Append datatable to tab
- $('#' + tabId).append(table.object());
+ // Append datatable to tab
+ $('#' + tabId).append(table.object());
- // Data table
- var dTable;
+ // Add table rows
+ // Start with the 2nd row (1st row is the headers)
+ for ( var i = 1; i < rsp.length; i++) {
+ // Split into columns
+ var cols = rsp[i].split(',');
- // Add table rows
- // Start with the 2nd row (1st row is the headers)
- for ( var i = 1; i < rsp.length; i++) {
- // Split into columns
- var cols = rsp[i].split(',');
+ // Go through each column
+ for ( var j = 0; j < cols.length; j++) {
- // Go through each column
- for ( var j = 0; j < cols.length; j++) {
+ // If the column is not complete
+ if (cols[j].count('"') == 1) {
+ while (cols[j].count('"') != 2) {
+ // Merge this column with the adjacent one
+ cols[j] = cols[j] + "," + cols[j + 1];
- // If the column is not complete
- if (cols[j].count('"') == 1) {
- while (cols[j].count('"') != 2) {
- // Merge this column with the adjacent one
- cols[j] = cols[j] + "," + cols[j + 1];
+ // Remove merged row
+ cols.splice(j + 1, 1);
+ }
+ }
- // Remove merged row
- cols.splice(j + 1, 1);
- }
- }
+ // Replace quote
+ cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
+ }
- // Replace quote
- cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
- }
+ // Add remove button
+ cols.unshift('');
- // Add remove button
- cols.unshift('');
+ // Add row
+ table.add(cols);
- // Add row
- table.add(cols);
+ // Save original table content
+ origCont[i] = cols;
+ }
- // Save original table content
- origCont[i] = cols;
- }
+ // Turn table into datatable
+ var dTable = $('#' + id + 'Datatable').dataTable({
+ 'iDisplayLength': 50,
+ 'bLengthChange': false,
+ "sScrollX": "100%",
+ "bAutoWidth": true
+ });
- /**
- * Enable editable columns
- */
- // Do not make 1st column editable
- $('#' + tableId + ' td:not(td:nth-child(1))').editable(
- function(value, settings) {
- // Get column index
- var colPos = this.cellIndex;
- // Get row index
- var rowPos = dTable.fnGetPosition(this.parentNode);
+ /**
+ * Enable editable columns
+ */
+ // Do not make 1st column editable
+ $('#' + tableId + ' td:not(td:nth-child(1))').editable(
+ function(value, settings) {
+ // Get column index
+ var colPos = this.cellIndex;
+ // Get row index
+ var rowPos = dTable.fnGetPosition(this.parentNode);
- // Update datatable
- dTable.fnUpdate(value, rowPos, colPos);
+ // Update datatable
+ dTable.fnUpdate(value, rowPos, colPos);
- return (value);
- }, {
- onblur : 'submit', // Clicking outside editable area submits changes
- type : 'textarea',
- placeholder: ' ',
- height : '30px' // The height of the text area
- });
+ return (value);
+ }, {
+ onblur : 'submit', // Clicking outside editable area submits changes
+ type : 'textarea',
+ placeholder: ' ',
+ height : '30px' // The height of the text area
+ });
+
+ // Create action bar
+ var actionBar = $('');
+
+ var saveLnk = $('Save');
+ saveLnk.click(function() {
+ // Get table ID and name
+ var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
+ var tableName = tableId.replace('Datatable', '');
+
+ // Get datatable
+ var dTable = $('#' + tableId).dataTable();
+ // Get the nodes from the table
+ var dRows = dTable.fnGetNodes();
- // Turn table into datatable
- dTable = $('#' + id + 'Datatable').dataTable({
- 'iDisplayLength': 50,
- 'bLengthChange': false,
- "sScrollX": "100%",
- "bAutoWidth": true
- });
+ // Go through each row
+ for ( var i = 0; i < dRows.length; i++) {
+ // If there is row with values
+ if (dRows[i]) {
+ // Go through each column
+ // Ignore the 1st column because it is a button
+ var cols = dRows[i].childNodes;
+ var vals = new Object();
+ for ( var j = 1; j < cols.length; j++) {
+ var val = cols.item(j).firstChild.nodeValue;
+
+ // Insert quotes
+ if (val == ' ') {
+ vals[j - 1] = '';
+ } else {
+ vals[j - 1] = val;
+ }
+ }
- // Create action bar
- var actionBar = $('');
-
- var saveLnk = $('Save');
- saveLnk.click(function() {
- // Get table ID and name
- var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
- var tableName = tableId.replace('Datatable', '');
-
- // Get datatable
- var dTable = $('#' + tableId).dataTable();
- // Get the nodes from the table
- var dRows = dTable.fnGetNodes();
+ // Save row
+ newCont[i + 1] = vals;
+ }
+ }
+
+ // Update xCAT table
+ $.ajax({
+ type : 'POST',
+ url : 'lib/tabRestore.php',
+ dataType : 'json',
+ data : {
+ table : tableName,
+ cont : newCont
+ },
+ success : function(data) {
+ // Create info message
+ var dialog = $('').append(createInfoBar('Changes saved!'));
+
+ // Open dialog
+ dialog.dialog({
+ modal: true,
+ title: 'Info',
+ width: 400,
+ buttons: {
+ "Ok": function(){
+ $(this).dialog("close");
+ }
+ }
+ });
+ }
+ });
+ });
+
+ var undoLnk = $('Undo');
+ undoLnk.click(function() {
+ // Get table ID
+ var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
+
+ // Get datatable
+ var dTable = $('#' + tableId).dataTable();
+
+ // Clear entire datatable
+ dTable.fnClearTable();
- // Go through each row
- for ( var i = 0; i < dRows.length; i++) {
- // If there is row with values
- if (dRows[i]) {
- // Go through each column
- // Ignore the 1st column because it is a button
- var cols = dRows[i].childNodes;
- var vals = new Object();
- for ( var j = 1; j < cols.length; j++) {
- var val = cols.item(j).firstChild.nodeValue;
-
- // Insert quotes
- if (val == ' ') {
- vals[j - 1] = '';
- } else {
- vals[j - 1] = val;
- }
- }
+ // Add original content back into datatable
+ for ( var i = 1; i < origCont.length; i++) {
+ dTable.fnAddData(origCont[i], true);
+ }
- // Save row
- newCont[i + 1] = vals;
- }
- }
-
- // Update xCAT table
- $.ajax( {
- type : 'POST',
- url : 'lib/tabRestore.php',
- dataType : 'json',
- data : {
- table : tableName,
- cont : newCont
- },
- success : function(data) {
- // Create info message
- var dialog = $('').append(createInfoBar('Changes saved!'));
-
- // Open dialog
- dialog.dialog({
- modal: true,
- title: 'Info',
- width: 400,
- buttons: {
- "Ok": function(){
- $(this).dialog("close");
- }
- }
- });
- }
- });
- });
-
- var undoLnk = $('Undo');
- undoLnk.click(function() {
- // Get table ID
- var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
-
- // Get datatable
- var dTable = $('#' + tableId).dataTable();
-
- // Clear entire datatable
- dTable.fnClearTable();
+ // Enable editable columns (again)
+ // Do not make 1st column editable
+ $('#' + tableId + ' td:not(td:nth-child(1))').editable(
+ function(value, settings) {
+ // Get column index
+ var colPos = this.cellIndex;
+ // Get row index
+ var rowPos = dTable.fnGetPosition(this.parentNode);
- // Add original content back into datatable
- for ( var i = 1; i < origCont.length; i++) {
- dTable.fnAddData(origCont[i], true);
- }
+ // Update datatable
+ dTable.fnUpdate(value, rowPos, colPos);
- // Enable editable columns (again)
- // Do not make 1st column editable
- $('#' + tableId + ' td:not(td:nth-child(1))').editable(
- function(value, settings) {
- // Get column index
- var colPos = this.cellIndex;
- // Get row index
- var rowPos = dTable.fnGetPosition(this.parentNode);
+ return (value);
+ }, {
+ onblur : 'submit', // Clicking outside editable area submits changes
+ type : 'textarea',
+ placeholder: ' ',
+ height : '30px' // The height of the text area
+ });
+ });
+
+ var addLnk = $('Add row');
+ addLnk.click(function() {
+ // Create an empty row
+ var row = new Array();
- // Update datatable
- dTable.fnUpdate(value, rowPos, colPos);
+ /**
+ * Remove button
+ */
+ row.push('');
+ for ( var i = 0; i < headers.length; i++) {
+ row.push('');
+ }
- return (value);
- }, {
- onblur : 'submit', // Clicking outside editable area submits changes
- type : 'textarea',
- placeholder: ' ',
- height : '30px' // The height of the text area
- });
- });
-
- var addLnk = $('Add row');
- addLnk.click(function() {
- // Create an empty row
- var row = new Array();
+ // Get table ID and name
+ var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
+
+ // Get datatable
+ var dTable = $('#' + tableId).dataTable();
+
+ // Add the row to the data table
+ dTable.fnAddData(row);
- /**
- * Remove button
- */
- row.push('');
- for ( var i = 0; i < headers.length; i++) {
- row.push('');
- }
+ // Enable editable columns (again)
+ // Do not make 1st column editable
+ $('#' + tableId + ' td:not(td:nth-child(1))').editable(
+ function(value, settings) {
+ // Get column index
+ var colPos = this.cellIndex;
+ // Get row index
+ var rowPos = dTable.fnGetPosition(this.parentNode);
- // Get table ID and name
- var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
- var tableName = tableId.replace('Datatable', '');
-
- // Get datatable
- var dTable = $('#' + tableId).dataTable();
-
- // Add the row to the data table
- dTable.fnAddData(row);
+ // Update datatable
+ dTable.fnUpdate(value, rowPos, colPos);
- // Enable editable columns (again)
- // Do not make 1st column editable
- $('#' + tableId + ' td:not(td:nth-child(1))').editable(
- function(value, settings) {
- // Get column index
- var colPos = this.cellIndex;
- // Get row index
- var rowPos = dTable.fnGetPosition(this.parentNode);
-
- // Update datatable
- dTable.fnUpdate(value, rowPos, colPos);
-
- return (value);
- }, {
- onblur : 'submit', // Clicking outside editable area submits changes
- type : 'textarea',
- placeholder: ' ',
- height : '30px' // The height of the text area
- });
- });
-
- // Create an action menu
- var actionsMenu = createMenu([saveLnk, undoLnk, addLnk]);
- actionsMenu.superfish();
- actionsMenu.css('display', 'inline-block');
- actionBar.append(actionsMenu);
-
- // Set correct theme for action menu
- actionsMenu.find('li').hover(function() {
- setMenu2Theme($(this));
- }, function() {
- setMenu2Normal($(this));
- });
-
- // Create a division to hold actions menu
- var menuDiv = $('');
- $('#' + id + 'Datatable_wrapper').prepend(menuDiv);
- menuDiv.append(actionBar);
- $('#' + id + 'Datatable_filter').appendTo(menuDiv);
+ return (value);
+ }, {
+ onblur : 'submit', // Clicking outside editable area submits changes
+ type : 'textarea',
+ placeholder: ' ',
+ height : '30px' // The height of the text area
+ });
+ });
+
+ // Create an action menu
+ var actionsMenu = createMenu([saveLnk, undoLnk, addLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + id + 'Datatable_wrapper').prepend(menuDiv);
+ menuDiv.append(actionBar);
+ $('#' + id + 'Datatable_filter').appendTo(menuDiv);
}
/**
* Delete a row in the data table
*
- * @param obj
- * The object that was clicked
- * @return Nothing
+ * @param obj The object that was clicked
*/
function deleteRow(obj) {
- // Get table ID
- var tableId = $(obj).parents('table').attr('id');
+ // Get table ID
+ var tableId = $(obj).parents('table').attr('id');
- // Get datatable
- var dTable = $('#' + tableId).dataTable();
+ // Get datatable
+ var dTable = $('#' + tableId).dataTable();
- // Get all nodes within the datatable
- var rows = dTable.fnGetNodes();
- // Get target row
- var tgtRow = $(obj).parent().parent().get(0);
+ // Get all nodes within the datatable
+ var rows = dTable.fnGetNodes();
+ // Get target row
+ var tgtRow = $(obj).parent().parent().get(0);
- // Find the target row in the datatable
- for ( var i in rows) {
- // If the row matches the target row
- if (rows[i] == tgtRow) {
- // Remove row
- dTable.fnDeleteRow(i, null, true);
- break;
- }
- }
+ // Find the target row in the datatable
+ for ( var i in rows) {
+ // If the row matches the target row
+ if (rows[i] == tgtRow) {
+ // Remove row
+ dTable.fnDeleteRow(i, null, true);
+ break;
+ }
+ }
}
/**
* Count the number of occurrences of a specific character in a string
*
- * @param c
- * Character to count
+ * @param c Character to count
* @return The number of occurrences
*/
String.prototype.count = function(c) {
- return (this.length - this.replace(new RegExp(c, 'g'), '').length)/c.length;
+ return (this.length - this.replace(new RegExp(c, 'g'), '').length)/c.length;
};
\ No newline at end of file
diff --git a/xCAT-UI/js/configure/discover.js b/xCAT-UI/js/configure/discover.js
index 82e212be5..a94aeddd2 100644
--- a/xCAT-UI/js/configure/discover.js
+++ b/xCAT-UI/js/configure/discover.js
@@ -1,408 +1,372 @@
-/*associate the step name with step number*/
-var steps = ['Platform', 'Complete'];
+// Associate the step name with step number
+var steps = [ 'Platform', 'Complete' ];
-/*associate the function with step number*/
-var initFunctions = [initSelectPlatform, complete];
+// Associate the function with step number
+var initFunctions = [ initSelectPlatform, complete ];
+var nextFunctions = [ getPlatform, undefined ];
-/*associate the function witch should be called before the page changed(when click next or back)
- *if there is no need to call functions, use undefined.*/
-var nextFunctions = [getPlatform, undefined];
-
-/*save current step number*/
+// Save current step number
var currentStep = 0;
-/*save user's input*/
+// Save user's input
var discoverEnv;
/**
- * create the discover page
- *
- * @return nothing
+ * Create the discovery page
*/
-function loadDiscoverPage(){
- currentStep = 0;
- discoverEnv = new Object();
-
- $('#discoverTab').append('
');
+ initSelectPlatform();
}
/**
- * create the navigator buttons on the bottom of discover page
- *
- * @param
- *
- * @return nothing
+ * Create the navigation buttons on the bottom of discovery page
*/
-function createDiscoverButtons(){
- var buttonDiv = $('');
- var backButton = createBackButton();
- var nextButton = createNextButton();
- var cancelButton = createCancelButton();
-
- if (backButton)
- buttonDiv.append(backButton);
-
- if (nextButton)
- buttonDiv.append(nextButton);
-
- if (cancelButton)
- buttonDiv.append(cancelButton);
+function createDiscoverButtons() {
+ var buttonDiv = $('');
+ var backButton = createBackButton();
+ var nextButton = createNextButton();
+ var cancelButton = createCancelButton();
- $('#discoverContentDiv').append(buttonDiv);
+ if (backButton)
+ buttonDiv.append(backButton);
+
+ if (nextButton)
+ buttonDiv.append(nextButton);
+
+ if (cancelButton)
+ buttonDiv.append(cancelButton);
+
+ $('#discoverContentDiv').append(buttonDiv);
}
-function createCancelButton(){
- if (0 == currentStep)
- return undefined;
-
- if ((steps.length - 1) == currentStep)
- return undefined;
-
- var cancelbutton = createButton('Cancel');
- cancelbutton.bind('click', function(){
- $('#discoverTab').empty();
- for (var name in discoverEnv)
- removeDiscoverEnv(name);
- loadDiscoverPage();
- });
-
- return cancelbutton;
+function createCancelButton() {
+ if (0 == currentStep)
+ return undefined;
+
+ if ((steps.length - 1) == currentStep)
+ return undefined;
+
+ var cancelbutton = createButton('Cancel');
+ cancelbutton.bind('click', function() {
+ $('#discoverTab').empty();
+ for (var name in discoverEnv)
+ removeDiscoverEnv(name);
+ loadDiscoverPage();
+ });
+
+ return cancelbutton;
}
/**
- * create the next button base on the currentStep, the last step does not need this button
- *
- * @return nothing
+ * Create the next button base on the current step,
+ * the last step does not need this button
*/
-function createNextButton(){
- var tempFlag = true;
- if ((steps.length - 1) == currentStep)
- return undefined;
-
- var nextButton = createButton('Next');
- nextButton.bind('click', function(){
- if (nextFunctions[currentStep])
- tempFlag = nextFunctions[currentStep]('next');
-
- if (!tempFlag)
- return;
- currentStep ++;
- initFunctions[currentStep]('next');
- });
-
- return nextButton;
+function createNextButton() {
+ var tempFlag = true;
+ if ((steps.length - 1) == currentStep)
+ return undefined;
+
+ var nextButton = createButton('Next');
+ nextButton.bind('click', function() {
+ if (nextFunctions[currentStep])
+ tempFlag = nextFunctions[currentStep]('next');
+
+ if (!tempFlag)
+ return;
+ currentStep++;
+ initFunctions[currentStep]('next');
+ });
+
+ return nextButton;
}
/**
- * create the next button base on the currentStep, the first step does not need this button
- *
- * @return nothing
+ * Create the next button base on the current step,
+ * the first step does not need this button
*/
-function createBackButton(){
- var tempFlag = true;
- if (0 == currentStep)
- return undefined;
-
- var backButton = createButton('Back');
- backButton.bind('click', function(){
- if (nextFunctions[currentStep])
- tempFlag = nextFunctions[currentStep]('back');
-
- if (!tempFlag)
- return;
-
- currentStep--;
+function createBackButton() {
+ var tempFlag = true;
+ if (0 == currentStep)
+ return undefined;
- initFunctions[currentStep]('back');
- });
-
- return backButton;
+ var backButton = createButton('Back');
+ backButton.bind('click', function() {
+ if (nextFunctions[currentStep])
+ tempFlag = nextFunctions[currentStep]('back');
+
+ if (!tempFlag)
+ return;
+
+ currentStep--;
+
+ initFunctions[currentStep]('back');
+ });
+
+ return backButton;
}
/**
- * get the input value on discover page
+ * Get the input value on discovery page
*
- * @param envName
- * value's name(discoverEnv's key)
- * @return
- * if there is assciate value, return the value.
- * else return null.
+ * @param envName Value name (discoverEnv key)
+ * @return If there is an associate value, return the value, else return NULL
*/
-function getDiscoverEnv(envName){
- if (discoverEnv[envName])
- return discoverEnv[envName];
- else
- return '';
+function getDiscoverEnv(envName) {
+ if (discoverEnv[envName])
+ return discoverEnv[envName];
+ else
+ return '';
}
/**
- * set the input value on discover page
+ * Set the input value on discovery page
*
- * @param envName
- * value's name(discoverEnv's key)
- * @param envValue
- * value
- * @return nothing
+ * @param envName Value name (discoverEnv key)
+ * @param envValue Value
*/
-function setDiscoverEnv(envName, envValue){
- if (envName)
- discoverEnv[envName] = envValue;
+function setDiscoverEnv(envName, envValue) {
+ if (envName)
+ discoverEnv[envName] = envValue;
}
/**
- * delete the input value on discover page
+ * Delete the input value on discovery page
*
- * @param envName
- * value's name(discoverEnv's key)
- * @return nothing
+ * @param envName Value name (discoverEnv's key)
*/
-function removeDiscoverEnv(envName){
- if (discoverEnv[envName])
- delete discoverEnv[envName];
+function removeDiscoverEnv(envName) {
+ if (discoverEnv[envName])
+ delete discoverEnv[envName];
}
/**
- * Expand the noderange into node names.
+ * Expand the noderange into node names
*
- * @param nodeRange
- * @return node names array
+ * @param nodeRange Node range
+ * @return Array of node names
*/
-function expandNR(nodeRange){
- var retArray = new Array();
- var tempResult;
- if ('' == nodeRange)
- return retArray;
-
- tempResult = nodeRange.match(/(.*?)\[(.*?)\](.*)/);
- if (null != tempResult){
- var parts = tempResult[2].split('-');
- if (2 > parts.length)
- return retArray;
-
- var start = Number(parts[0]);
- var end = Number(parts[1]);
- var len = parts[0].length;
- for (var i = parts[0]; i <= parts[1]; i++){
- var ts = i.toString();
- if (ts.length < len)
- ts = "000000".substring(0, (len - ts.length)) + ts;
+function expandNR(nodeRange) {
+ var retArray = new Array();
+ var tempResult;
+ if ('' == nodeRange)
+ return retArray;
- retArray = retArray.concat(expandNR(tempResult[1] + ts + tempResult[3]));
- }
- return retArray;
- }
-
- var tempArray = nodeRange.split('-');
- if (2 > tempArray.length){
- retArray.push(nodeRange);
- return retArray;
- }
-
- var begin = tempArray[0].match(/^(\D+)(\d+)$/);
- if (2 > begin){
- retArray.push(nodeRange);
- return retArray;
- }
-
- var end = tempArray[1].match(/^(\D+)(\d+)$/);
- if (2 > end){
- retArray.push(nodeRange);
- return retArray;
- }
-
- if (begin[1] != end[1]){
- retArray.push(nodeRange);
- return retArray;
- }
-
- var prefix = begin[1];
- var len = begin[2].length;
- for (var i = begin[2]; i <= end[2]; i++){
- var ts = i.toString();
- if (ts.length < len)
- ts = "000000".substring(0, (len - ts.length)) + ts;
- retArray.push(prefix + ts);
- }
-
- return retArray;
+ tempResult = nodeRange.match(/(.*?)\[(.*?)\](.*)/);
+ if (null != tempResult) {
+ var parts = tempResult[2].split('-');
+ if (2 > parts.length)
+ return retArray;
+
+ var len = parts[0].length;
+ for (var i = parts[0]; i <= parts[1]; i++) {
+ var ts = i.toString();
+ if (ts.length < len)
+ ts = "000000".substring(0, (len - ts.length)) + ts;
+
+ retArray = retArray.concat(expandNR(tempResult[1] + ts
+ + tempResult[3]));
+ }
+
+ return retArray;
+ }
+
+ var tempArray = nodeRange.split('-');
+ if (2 > tempArray.length) {
+ retArray.push(nodeRange);
+ return retArray;
+ }
+
+ var begin = tempArray[0].match(/^(\D+)(\d+)$/);
+ if (2 > begin) {
+ retArray.push(nodeRange);
+ return retArray;
+ }
+
+ var end = tempArray[1].match(/^(\D+)(\d+)$/);
+ if (2 > end) {
+ retArray.push(nodeRange);
+ return retArray;
+ }
+
+ if (begin[1] != end[1]) {
+ retArray.push(nodeRange);
+ return retArray;
+ }
+
+ var prefix = begin[1];
+ var len = begin[2].length;
+ for (var i = begin[2]; i <= end[2]; i++) {
+ var ts = i.toString();
+ if (ts.length < len)
+ ts = "000000".substring(0, (len - ts.length)) + ts;
+ retArray.push(prefix + ts);
+ }
+
+ return retArray;
}
/**
- * collect all inputs' value from the page
+ * Collect all input values from the page
*
- * @return true: this step is correct, can go to the next page
- * false: this step contains error.
+ * @return True if this step is correct and can go to the next page, false if this step contains error
*/
-function collectInputValue(){
- $('#discoverContentDiv input[type=text]').each(function(){
- var name = $(this).attr('name');
- var value = $(this).attr('value');
- if ('' != value)
- setDiscoverEnv(name, value);
- else
- removeDiscoverEnv(name);
- });
-
- return true;
+function collectInputValue() {
+ $('#discoverContentDiv input[type=text]').each(function() {
+ var name = $(this).attr('name');
+ var value = $(this).attr('value');
+ if ('' != value)
+ setDiscoverEnv(name, value);
+ else
+ removeDiscoverEnv(name);
+ });
+
+ return true;
}
/**
- * verify the ip address,
+ * Verify the IP address
*
- * @param
- *
- * @return true: for valid IP address
- * false : for invalid IP address
+ * @param ip IP address
+ * @return True if IP address is valid, false otherwise
*/
-function verifyIp(ip){
+function verifyIp(ip) {
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-4])$/;
return reg.test(ip);
}
/**
- * transfer ip into decimal
+ * Transalate IP into decimal
*
- * @param
- *
- * @return decimal type ip address
+ * @param ip IP address
+ * @return Decimal type for IP address
*/
-function ip2Decimal(ip){
+function ip2Decimal(ip) {
if (!verifyIp(ip))
return 0;
-
+
var retIp = 0;
var tempArray = ip.split('.');
- for (var i = 0; i < 4; i++){
+ for (var i = 0; i < 4; i++) {
retIp = (retIp << 8) | parseInt(tempArray[i]);
}
-
- //change the int into unsigned int type
+
+ // Change the int into unsigned int type
retIp = retIp >>> 0;
return retIp;
}
/**
- * calculate the end IP address by start IP and the number of IP range.
- *
- * @param
- *
- * @return
+ * Calculate the ending IP address from the starting IP address and the IP range number.
*/
-function calcEndIp(ipStart, num){
+function calcEndIp(ipStart, num) {
var sum = 0;
var tempNum = Number(num);
var temp = /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
var ipArray = temp.exec(ipStart);
-
+
ipArray.shift();
sum = Number(ipArray[3]) + tempNum;
- if (sum <= 254){
+ if (sum <= 254) {
ipArray[3] = sum;
return (ipArray.join('.'));
}
-
+
ipArray[3] = sum % 254;
-
+
sum = Number(ipArray[2]) + parseInt(sum / 254);
- if (sum <= 255){
+ if (sum <= 255) {
ipArray[2] = sum;
return (ipArray.join('.'));
}
-
+
ipArray[2] = sum % 255;
-
+
sum = Number(ipArray[1]) + parseInt(sum / 255);
- if (sum <= 255){
+ if (sum <= 255) {
ipArray[1] = sum;
return (ipArray.join('.'));
}
-
+
ipArray[1] = sum % 255;
ipArray[0] = ipArray[0] + parseInt(sum / 255);
return (ipArray.join('.'));
}
/**
- * Step 1: show the wizard's function
- * platform selector(system P or system X)
- *
- * @return nothing
+ * Step 1: Show the wizard's function platform selector (System p or System x)
*/
-function initSelectPlatform(){
- var type = '';
-
- $('#discoverContentDiv').empty();
- $('.tooltip').remove();
-
- var selectPlatform = $('
' + steps[currentStep] + '
');
-
- var infoMsg = 'This wizard will guide you through the process of defining the naming conventions within' +
- 'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT' +
- 'database. Choose which type of hardware you want to discover, and then click Next.';
- var info = createInfoBar(infoMsg);
- selectPlatform.append(info);
-
- var hwList = $('Platforms available:');
- hwList.append('');
- hwList.append('
BladeCenter
');
- hwList.append('
System p hardware (P7 IH)
');
- hwList.append('
System p hardware (Non P7 IH)
');
-
- hwList.find('li').css('padding', '2px 10px');
- selectPlatform.append(hwList);
-
- $('#discoverContentDiv').append(selectPlatform);
-
- if (getDiscoverEnv('machineType'))
- type = getDiscoverEnv('machineType');
- else
- type = 'ih';
-
- $('#discoverContentDiv #' + type).attr('checked', 'checked');
- createDiscoverButtons();
+function initSelectPlatform() {
+ var type = '';
+
+ $('#discoverContentDiv').empty();
+ $('.tooltip').remove();
+
+ var selectPlatform = $('
' + steps[currentStep] + '
');
+
+ var infoMsg = 'This wizard will guide you through the process of defining the naming conventions within'
+ + 'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT'
+ + 'database. Choose which type of hardware you want to discover, and then click Next.';
+ var info = createInfoBar(infoMsg);
+ selectPlatform.append(info);
+
+ var hwList = $('Platforms available:');
+ hwList.append('');
+ hwList.append('
BladeCenter
');
+ hwList.append('
System p hardware (P7 IH)
');
+ hwList.append('
System p hardware (Non P7 IH)
');
+
+ hwList.find('li').css('padding', '2px 10px');
+ selectPlatform.append(hwList);
+
+ $('#discoverContentDiv').append(selectPlatform);
+
+ if (getDiscoverEnv('machineType'))
+ type = getDiscoverEnv('machineType');
+ else
+ type = 'ih';
+
+ $('#discoverContentDiv #' + type).attr('checked', 'checked');
+ createDiscoverButtons();
}
/**
* Step 1: Get the platform type
- *
- * @return true
*/
-function getPlatform(){
- var radioValue = $('#discoverContentDiv :checked').attr('id');
- var platformObj;
- switch(radioValue){
- case 'ih':
- case 'nonih':
- platformObj = new hmcPlugin();
- break;
- case 'idataplex':
- platformObj = new ipmiPlugin();
- break;
- case 'blade':
- break;
- }
-
- steps = ['Platform'].concat(platformObj.getStep(), 'compelte');
- initFunctions = [initSelectPlatform].concat(platformObj.getInitFunction(), complete);
- nextFunctions = [getPlatform].concat(platformObj.getNextFunction(), undefined);
- setDiscoverEnv('machineType', radioValue);
- return true;
+function getPlatform() {
+ var radioValue = $('#discoverContentDiv :checked').attr('id');
+ var platformObj = null;
+ switch (radioValue) {
+ case 'ih':
+ case 'nonih':
+ platformObj = new hmcPlugin();
+ break;
+ case 'idataplex':
+ platformObj = new ipmiPlugin();
+ break;
+ case 'blade':
+ break;
+ }
+
+ steps = [ 'Platform' ].concat(platformObj.getStep(), 'compelte');
+ initFunctions = [ initSelectPlatform ].concat(platformObj.getInitFunction(), complete);
+ nextFunctions = [ getPlatform ].concat(platformObj.getNextFunction(), undefined);
+ setDiscoverEnv('machineType', radioValue);
+ return true;
}
/**
- * last step: complete
- *
- * @param
- *
- * @return
+ * Last step: Complete
*/
-function complete(){
- $('#discoverContentDiv').empty();
- $('.tooltip').remove();
- var showStr = '
' + steps[currentStep] + '
';
- showStr += 'You can go to the nodes page to check nodes which were defined just now.';
- $('#discoverContentDiv').append(showStr);
-
- createDiscoverButtons();
+function complete() {
+ $('#discoverContentDiv').empty();
+ $('.tooltip').remove();
+ var showStr = '
' + steps[currentStep] + '
';
+ showStr += 'You can go to the nodes page to check nodes which were defined just now.';
+ $('#discoverContentDiv').append(showStr);
+
+ createDiscoverButtons();
}
\ No newline at end of file
diff --git a/xCAT-UI/js/configure/service.js b/xCAT-UI/js/configure/service.js
index db749c145..ddd422034 100644
--- a/xCAT-UI/js/configure/service.js
+++ b/xCAT-UI/js/configure/service.js
@@ -6,360 +6,352 @@ var topPriority = 0;
/**
* Load the service portal's provision page
*
- * @param tabId
- * Tab ID where page will reside
- * @return Nothing
+ * @param tabId Tab ID where page will reside
*/
function loadServicePage(tabId) {
- // Create info bar
- var infoBar = createInfoBar('Select a platform to configure, then click Ok.');
-
- // Create self-service portal page
- var tabId = 'serviceTab';
- var servicePg = $('');
- $('#' + tabId).append(infoBar, servicePg);
+ // Create info bar
+ var infoBar = createInfoBar('Select a platform to configure, then click Ok.');
+
+ // Create self-service portal page
+ var tabId = 'serviceTab';
+ var servicePg = $('');
+ $('#' + tabId).append(infoBar, servicePg);
- // Create radio buttons for platforms
- var hwList = $('Platforms available:');
- var esx = $('
ESX
');
- var kvm = $('
KVM
');
- var zvm = $('
z\/VM
');
-
- hwList.append(esx);
- hwList.append(kvm);
- hwList.append(zvm);
- servicePg.append(hwList);
+ // Create radio buttons for platforms
+ var hwList = $('Platforms available:');
+ var esx = $('
ESX
');
+ var kvm = $('
KVM
');
+ var zvm = $('
z\/VM
');
+
+ hwList.append(esx);
+ hwList.append(kvm);
+ hwList.append(zvm);
+ servicePg.append(hwList);
- /**
- * Ok
- */
- var okBtn = createButton('Ok');
- okBtn.bind('click', function(event) {
- var configTabs = getConfigTab();
-
- // Get hardware that was selected
- var hw = $(this).parent().find('input[name="hw"]:checked').val();
- var newTabId = hw + 'ProvisionTab';
+ /**
+ * Ok
+ */
+ var okBtn = createButton('Ok');
+ okBtn.bind('click', function(event) {
+ var configTabs = getConfigTab();
+
+ // Get hardware that was selected
+ var hw = $(this).parent().find('input[name="hw"]:checked').val();
+ var newTabId = hw + 'ProvisionTab';
- if ($('#' + newTabId).size() > 0){
- configTabs.select(newTabId);
- } else {
- var title = '';
-
- // Create an instance of the plugin
- var plugin;
- switch (hw) {
- case "kvm":
- plugin = new kvmPlugin();
- title = 'KVM';
- break;
- case "esx":
- plugin = new esxPlugin();
- title = 'ESX';
- break;
- case "zvm":
- plugin = new zvmPlugin();
- title = 'z/VM';
-
- // Get zVM host names
- if (!$.cookie('srv_zvm')){
- $.ajax( {
- url : 'lib/srv_cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webportal',
- tgt : '',
- args : 'lszvm',
- msg : ''
- },
+ if ($('#' + newTabId).size() > 0){
+ configTabs.select(newTabId);
+ } else {
+ var title = '';
+
+ // Create an instance of the plugin
+ var plugin = null;
+ switch (hw) {
+ case "kvm":
+ plugin = new kvmPlugin();
+ title = 'KVM';
+ break;
+ case "esx":
+ plugin = new esxPlugin();
+ title = 'ESX';
+ break;
+ case "zvm":
+ plugin = new zvmPlugin();
+ title = 'z/VM';
+
+ // Get zVM host names
+ if (!$.cookie('srv_zvm')){
+ $.ajax( {
+ url : 'lib/srv_cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webportal',
+ tgt : '',
+ args : 'lszvm',
+ msg : ''
+ },
- success : function(data) {
- setzVMCookies(data);
- }
- });
- }
-
- break;
- }
+ success : function(data) {
+ setzVMCookies(data);
+ }
+ });
+ }
+
+ break;
+ }
- // Select tab
- configTabs.add(newTabId, title, '', true);
- configTabs.select(newTabId);
- plugin.loadConfigPage(newTabId);
- }
- });
-
- servicePg.append(okBtn);
+ // Select tab
+ configTabs.add(newTabId, title, '', true);
+ configTabs.select(newTabId);
+ plugin.loadConfigPage(newTabId);
+ }
+ });
+
+ servicePg.append(okBtn);
}
/**
* Load the user panel where users can be created, modified, or deleted
*
- * @param panelId
- * Panel ID
- * @return Nothing
+ * @param panelId Panel ID
*/
function loadUserPanel(panelId) {
- // Get users list
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'passwd',
- msg : panelId
- },
+ // Get users list
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'passwd',
+ msg : panelId
+ },
- success : loadUserTable
- });
+ success : loadUserTable
+ });
}
/**
* Load user datatable
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function loadUserTable(data) {
- // Get response
- var rsp = data.rsp;
- // Get panel ID
- var panelId = data.msg;
-
- // Wipe panel clean
- $('#' + panelId).empty();
-
- // Add info bar
- $('#' + panelId).append(createInfoBar('Create, edit, and delete users for the self-service portal. Double-click on a cell to edit a users properties. Click outside the table to save changes. Hit the Escape key to ignore changes.'));
-
- // Get table headers
- // The table headers in the passwd table are: key, username, password, cryptmethod, comments, and disable
- var headers = new Array('priority', 'username', 'password', 'max-vm');
+ // Get response
+ var rsp = data.rsp;
+ // Get panel ID
+ var panelId = data.msg;
+
+ // Wipe panel clean
+ $('#' + panelId).empty();
+
+ // Add info bar
+ $('#' + panelId).append(createInfoBar('Create, edit, and delete users for the self-service portal. Double-click on a cell to edit a users properties. Click outside the table to save changes. Hit the Escape key to ignore changes.'));
+
+ // Get table headers
+ // The table headers in the passwd table are: key, username, password, cryptmethod, comments, and disable
+ var headers = new Array('priority', 'username', 'password', 'max-vm');
- // Create a new datatable
- var tableId = 'userDatatable';
- var table = new DataTable(tableId);
+ // Create a new datatable
+ var tableId = 'userDatatable';
+ var table = new DataTable(tableId);
- // Add column for the checkbox
- headers.unshift('');
- table.init(headers);
- headers.shift();
+ // Add column for the checkbox
+ headers.unshift('');
+ table.init(headers);
+ headers.shift();
- // Append datatable to panel
- $('#' + panelId).append(table.object());
+ // Append datatable to panel
+ $('#' + panelId).append(table.object());
- // Add table rows
- // Start with the 2nd row (1st row is the headers)
- for ( var i = 1; i < rsp.length; i++) {
- // Split into columns
- var tmp = rsp[i].split(',');
-
- // Go through each column
- for (var j = 0; j < tmp.length; j++) {
- // Replace quote
- tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
- }
-
- // Only add users having the key = xcat
- if (tmp[0] == 'xcat') {
- // Columns are: priority, username, password, and max-vm
- var cols = new Array('', tmp[1], tmp[2], '');
-
- // Add remove button where id = user name
- cols.unshift('');
-
- // Add row
- table.add(cols);
- }
- }
+ // Add table rows
+ // Start with the 2nd row (1st row is the headers)
+ for ( var i = 1; i < rsp.length; i++) {
+ // Split into columns
+ var tmp = rsp[i].split(',');
+
+ // Go through each column
+ for (var j = 0; j < tmp.length; j++) {
+ // Replace quote
+ tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
+ }
+
+ // Only add users having the key = xcat
+ if (tmp[0] == 'xcat') {
+ // Columns are: priority, username, password, and max-vm
+ var cols = new Array('', tmp[1], tmp[2], '');
+
+ // Add remove button where id = user name
+ cols.unshift('');
+
+ // Add row
+ table.add(cols);
+ }
+ }
- // Turn table into datatable
- $('#' + tableId).dataTable({
- 'iDisplayLength': 50,
- 'bLengthChange': false,
- "sScrollX": "100%",
- "bAutoWidth": true
- });
+ // Turn table into datatable
+ $('#' + tableId).dataTable({
+ 'iDisplayLength': 50,
+ 'bLengthChange': false,
+ "sScrollX": "100%",
+ "bAutoWidth": true
+ });
- // Create action bar
- var actionBar = $('');
-
- var createLnk = $('Create');
- createLnk.click(function() {
- openCreateUserDialog();
- });
-
- var deleteLnk = $('Delete');
- deleteLnk.click(function() {
- var users = getNodesChecked(tableId);
- if (users) {
- openDeleteUserDialog(users);
- }
- });
-
- var refreshLnk = $('Refresh');
- refreshLnk.click(function() {
- loadUserPanel(panelId);
- });
-
- // Create an action menu
- var actionsMenu = createMenu([createLnk, deleteLnk, refreshLnk]);
- actionsMenu.superfish();
- actionsMenu.css('display', 'inline-block');
- actionBar.append(actionsMenu);
-
- // Set correct theme for action menu
- actionsMenu.find('li').hover(function() {
- setMenu2Theme($(this));
- }, function() {
- setMenu2Normal($(this));
- });
-
- // Create a division to hold actions menu
- var menuDiv = $('');
- $('#' + tableId + '_wrapper').prepend(menuDiv);
- menuDiv.append(actionBar);
- $('#' + tableId + '_filter').appendTo(menuDiv);
-
- // Get policy data
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'policy',
- msg : tableId
- },
+ // Create action bar
+ var actionBar = $('');
+
+ var createLnk = $('Create');
+ createLnk.click(function() {
+ openCreateUserDialog();
+ });
+
+ var deleteLnk = $('Delete');
+ deleteLnk.click(function() {
+ var users = getNodesChecked(tableId);
+ if (users) {
+ openDeleteUserDialog(users);
+ }
+ });
+
+ var refreshLnk = $('Refresh');
+ refreshLnk.click(function() {
+ loadUserPanel(panelId);
+ });
+
+ // Create an action menu
+ var actionsMenu = createMenu([createLnk, deleteLnk, refreshLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + tableId + '_wrapper').prepend(menuDiv);
+ menuDiv.append(actionBar);
+ $('#' + tableId + '_filter').appendTo(menuDiv);
+
+ // Get policy data
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'policy',
+ msg : tableId
+ },
- success : loadUserTable4Policy
- });
-
- /**
- * Enable editable cells
- */
- // Do not make 1st or 2nd column editable
- $('#' + tableId + ' td:not(td:nth-child(1),td:nth-child(2))').editable(
- function(value, settings) {
- // If users did not make changes, return the value directly
- // jeditable saves the old value in this.revert
- if ($(this).attr('revert') == value){
- return value;
- }
-
- var panelId = $(this).parents('.ui-accordion-content').attr('id');
-
- // Get column index
- var colPos = this.cellIndex;
-
- // Get row index
- var dTable = $('#' + tableId).dataTable();
- var rowPos = dTable.fnGetPosition(this.parentNode);
-
- // Update datatable
- dTable.fnUpdate(value, rowPos, colPos, false);
-
- // Get table headers
- var headers = $('#' + nodesTableId).parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th');
-
- // Get user attributes
- var priority = $(this).parent().find('td:eq(1)').text();
- var user = $(this).parent().find('td:eq(2)').text();
- var password = $(this).parent().find('td:eq(3)').text();
- var maxVM = $(this).parent().find('td:eq(4)').text();
-
- // Send command to change user attributes
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
- msg : panelId
- },
- success : updatePanel
- });
+ success : loadUserTable4Policy
+ });
+
+ /**
+ * Enable editable cells
+ */
+ // Do not make 1st or 2nd column editable
+ $('#' + tableId + ' td:not(td:nth-child(1),td:nth-child(2))').editable(
+ function(value, settings) {
+ // If users did not make changes, return the value directly
+ // jeditable saves the old value in this.revert
+ if ($(this).attr('revert') == value){
+ return value;
+ }
+
+ var panelId = $(this).parents('.ui-accordion-content').attr('id');
+
+ // Get column index
+ var colPos = this.cellIndex;
+
+ // Get row index
+ var dTable = $('#' + tableId).dataTable();
+ var rowPos = dTable.fnGetPosition(this.parentNode);
+
+ // Update datatable
+ dTable.fnUpdate(value, rowPos, colPos, false);
+
+ // Get table headers
+ var headers = $('#' + nodesTableId).parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th');
+
+ // Get user attributes
+ var priority = $(this).parent().find('td:eq(1)').text();
+ var user = $(this).parent().find('td:eq(2)').text();
+ var password = $(this).parent().find('td:eq(3)').text();
+ var maxVM = $(this).parent().find('td:eq(4)').text();
+
+ // Send command to change user attributes
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
+ msg : panelId
+ },
+ success : updatePanel
+ });
- return value;
- }, {
- onblur : 'submit', // Clicking outside editable area submits changes
- type : 'textarea',
- placeholder: ' ',
- event : "dblclick", // Double click and edit
- height : '30px' // The height of the text area
- });
-
- // Resize accordion
- $('#' + tableId).parents('.ui-accordion').accordion('resize');
+ return value;
+ }, {
+ onblur : 'submit', // Clicking outside editable area submits changes
+ type : 'textarea',
+ placeholder: ' ',
+ event : "dblclick", // Double click and edit
+ height : '30px' // The height of the text area
+ });
+
+ // Resize accordion
+ $('#' + tableId).parents('.ui-accordion').accordion('resize');
}
/**
* Update user datatable for policy
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function loadUserTable4Policy(data) {
- // Get response
- var rsp = data.rsp;
- // Get datatable ID
- var tableId = data.msg;
-
- // Get datatable
- var datatable = $('#' + tableId).dataTable();
+ // Get response
+ var rsp = data.rsp;
+ // Get datatable ID
+ var tableId = data.msg;
+
+ // Get datatable
+ var datatable = $('#' + tableId).dataTable();
- // Update max-vm column
- // The data coming back contains: priority, name, host, commands, noderange, parameters, time, rule, comments, disable
-
- // Start with the 2nd row (1st row is the headers)
- topPriority = 0;
- for ( var i = 1; i < rsp.length; i++) {
- // Split into columns
- var tmp = rsp[i].split(',');
-
- // Go through each column
- for (var j = 0; j < tmp.length; j++) {
- // Replace quote
- tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
- }
-
- // Get the row containing the user name
- var rowPos = -1;
- if (tmp[1])
- rowPos = findRow(tmp[1], '#' + tableId, 2);
-
- // Update the priority and max-vm columns
- if (rowPos > -1) {
- var maxVM = tmp[8].replace('max-vm:', '');
- maxVM = maxVM.replace(';', '');
- datatable.fnUpdate(maxVM, rowPos, 4, false);
-
- var priority = tmp[0];
- datatable.fnUpdate(priority, rowPos, 1, false);
-
- // Set the highest priority
- if (priority > topPriority)
- topPriority = priority;
- }
- }
-
- // Adjust column sizes
- adjustColumnSize(tableId);
-
- // Resize accordion
- $('#' + tableId).parents('.ui-accordion').accordion('resize');
+ // Update max-vm column
+ // The data coming back contains: priority, name, host, commands, noderange, parameters, time, rule, comments, disable
+
+ // Start with the 2nd row (1st row is the headers)
+ topPriority = 0;
+ for ( var i = 1; i < rsp.length; i++) {
+ // Split into columns
+ var tmp = rsp[i].split(',');
+
+ // Go through each column
+ for (var j = 0; j < tmp.length; j++) {
+ // Replace quote
+ tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
+ }
+
+ // Get the row containing the user name
+ var rowPos = -1;
+ if (tmp[1])
+ rowPos = findRow(tmp[1], '#' + tableId, 2);
+
+ // Update the priority and max-vm columns
+ if (rowPos > -1) {
+ var maxVM = tmp[8].replace('max-vm:', '');
+ maxVM = maxVM.replace(';', '');
+ datatable.fnUpdate(maxVM, rowPos, 4, false);
+
+ var priority = tmp[0];
+ datatable.fnUpdate(priority, rowPos, 1, false);
+
+ // Set the highest priority
+ if (priority > topPriority)
+ topPriority = priority;
+ }
+ }
+
+ // Adjust column sizes
+ adjustColumnSize(tableId);
+
+ // Resize accordion
+ $('#' + tableId).parents('.ui-accordion').accordion('resize');
}
/**
* Open a dialog to create a user
*/
function openCreateUserDialog() {
- var dialogId = 'createUser';
- var dialog = $('');
+ var dialogId = 'createUser';
+ var dialog = $('');
var info = createInfoBar('Create an xCAT user. A priority will be generated for the new user.');
dialog.append(info);
@@ -369,57 +361,57 @@ function openCreateUserDialog() {
// Create node inputs
dialog.append($(''));
- dialog.append($(''));
- dialog.append($(''));
- dialog.append($(''));
+ dialog.append($(''));
+ dialog.append($(''));
+ dialog.append($(''));
dialog.dialog({
- title: 'Create user',
+ title: 'Create user',
modal: true,
width: 400,
close: function(){
- $(this).remove();
+ $(this).remove();
},
buttons: {
"OK" : function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Change dialog buttons
- $('#' + dialogId).dialog('option', 'buttons', {
- 'Close':function(){
- $(this).dialog('close');
- }
- });
-
- var priority = $(this).find('input[name="priority"]').val();
- var user = $(this).find('input[name="username"]').val();
- var password = $(this).find('input[name="password"]').val();
- var maxVM = $(this).find('input[name="maxvm"]').val();
-
- // Verify inputs are provided
- if (!user || !password || !maxVM) {
- var warn = createWarnBar('Please provide a value for each missing field!');
- warn.prependTo($(this));
- } else {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
- msg : dialogId
- },
- success : updatePanel
- });
-
- // Update highest priority
- topPriority = priority;
- }
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Change dialog buttons
+ $('#' + dialogId).dialog('option', 'buttons', {
+ 'Close':function(){
+ $(this).dialog('close');
+ }
+ });
+
+ var priority = $(this).find('input[name="priority"]').val();
+ var user = $(this).find('input[name="username"]').val();
+ var password = $(this).find('input[name="password"]').val();
+ var maxVM = $(this).find('input[name="maxvm"]').val();
+
+ // Verify inputs are provided
+ if (!user || !password || !maxVM) {
+ var warn = createWarnBar('Please provide a value for each missing field!');
+ warn.prependTo($(this));
+ } else {
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
+ msg : dialogId
+ },
+ success : updatePanel
+ });
+
+ // Update highest priority
+ topPriority = priority;
+ }
},
"Cancel": function(){
- $(this).dialog('close');
+ $(this).dialog('close');
}
}
});
@@ -428,110 +420,104 @@ function openCreateUserDialog() {
/**
* Update dialog
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function updatePanel(data) {
- var dialogId = data.msg;
- var infoMsg;
+ var dialogId = data.msg;
+ var infoMsg;
- // Create info message
- if (jQuery.isArray(data.rsp)) {
- infoMsg = '';
- for (var i in data.rsp) {
- infoMsg += data.rsp[i] + '';
- }
- } else {
- infoMsg = data.rsp;
- }
-
- // Create info bar with close button
- var infoBar = $('').css('margin', '5px 0px');
- var icon = $('').css({
- 'display': 'inline-block',
- 'margin': '10px 5px'
- });
-
- // Create close button to close info bar
- var close = $('').css({
- 'display': 'inline-block',
- 'float': 'right'
- }).click(function() {
- $(this).parent().remove();
- });
-
- var msg = $('
' + infoMsg + '
').css({
- 'display': 'inline-block',
- 'width': '85%'
- });
-
- infoBar.append(icon, msg, close);
- infoBar.prependTo($('#' + dialogId));
+ // Create info message
+ if (jQuery.isArray(data.rsp)) {
+ infoMsg = '';
+ for (var i in data.rsp) {
+ infoMsg += data.rsp[i] + '';
+ }
+ } else {
+ infoMsg = data.rsp;
+ }
+
+ // Create info bar with close button
+ var infoBar = $('').css('margin', '5px 0px');
+ var icon = $('').css({
+ 'display': 'inline-block',
+ 'margin': '10px 5px'
+ });
+
+ // Create close button to close info bar
+ var close = $('').css({
+ 'display': 'inline-block',
+ 'float': 'right'
+ }).click(function() {
+ $(this).parent().remove();
+ });
+
+ var msg = $('
' + infoMsg + '
').css({
+ 'display': 'inline-block',
+ 'width': '85%'
+ });
+
+ infoBar.append(icon, msg, close);
+ infoBar.prependTo($('#' + dialogId));
}
/**
* Open dialog to confirm user delete
*
- * @param users
- * Users to delete
- * @return Nothing
+ * @param users Users to delete
*/
function openDeleteUserDialog(users) {
- // Create form to delete disk to pool
- var dialogId = 'deleteUser';
- var deleteForm = $('');
-
- // Create info bar
- var info = createInfoBar('Are you sure you want to delete ' + users.replace(new RegExp(',', 'g'), ', ') + '?');
- deleteForm.append(info);
-
- // Open dialog to delete user
- deleteForm.dialog({
- title:'Delete user',
- modal: true,
- width: 400,
- close: function(){
- $(this).remove();
+ // Create form to delete disk to pool
+ var dialogId = 'deleteUser';
+ var deleteForm = $('');
+
+ // Create info bar
+ var info = createInfoBar('Are you sure you want to delete ' + users.replace(new RegExp(',', 'g'), ', ') + '?');
+ deleteForm.append(info);
+
+ // Open dialog to delete user
+ deleteForm.dialog({
+ title:'Delete user',
+ modal: true,
+ width: 400,
+ close: function(){
+ $(this).remove();
},
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Delete user
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'deleteuser;' + users,
- msg : dialogId
- },
- success : updatePanel
- });
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Delete user
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'deleteuser;' + users,
+ msg : dialogId
+ },
+ success : updatePanel
+ });
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Round a floating point to a given precision
*
- * @param value
- * Floating point
- * @param precision
- * Decimal precision
- * @returns Floating point number
+ * @param value Floating point
+ * @param precision Decimal precision
+ * @returns Floating point number
*/
function toFixed(value, precision) {
var power = Math.pow(10, precision || 0);
diff --git a/xCAT-UI/js/configure/update.js b/xCAT-UI/js/configure/update.js
index 0478576f5..c8e41db07 100644
--- a/xCAT-UI/js/configure/update.js
+++ b/xCAT-UI/js/configure/update.js
@@ -1,321 +1,310 @@
/**
* Load update page
- *
- * @return Nothing
*/
function loadUpdatePage() {
- var repositoryDiv = $('');
- var rpmDiv = $('');
- var statusDiv = createStatusBar("update");
- statusDiv.hide();
+ var repositoryDiv = $('');
+ var rpmDiv = $('');
+ var statusDiv = createStatusBar("update");
+ statusDiv.hide();
- $('#updateTab').append(statusDiv);
- $('#updateTab').append(' ');
- $('#updateTab').append(repositoryDiv);
- $('#updateTab').append(rpmDiv);
+ $('#updateTab').append(statusDiv);
+ $('#updateTab').append(' ');
+ $('#updateTab').append(repositoryDiv);
+ $('#updateTab').append(rpmDiv);
- var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.');
- repositoryDiv.append(infoBar);
+ var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.');
+ repositoryDiv.append(infoBar);
- repositoryDiv.append("");
- $.ajax( {
- url : 'lib/systemcmd.php',
- dataType : 'json',
- data : {
- cmd : 'ostype'
- },
+ repositoryDiv.append("");
+ $.ajax( {
+ url : 'lib/systemcmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'ostype'
+ },
- success : showRepository
- });
+ success : showRepository
+ });
- rpmDiv.append("");
- $.ajax( {
- url : 'lib/systemcmd.php',
- dataType : 'json',
- data : {
- cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
- },
+ rpmDiv.append("");
+ $.ajax( {
+ url : 'lib/systemcmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
+ },
- success : showRpmInfo
- });
+ success : showRpmInfo
+ });
}
/**
- * Show the RPM Repository, it can use user's last choice and input
+ * Show the RPM repository (it can use the user's last choice and input)
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function showRepository(data) {
- var develRepository = "";
- var stableRepository = "";
- var show = "";
+ var develRepository = "";
+ var stableRepository = "";
+ var show = "";
- // Get the corresponding repository by OS Type
- if (data.rsp == "aix") {
- // No repository exists for AIX on sourceforge!
- develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
- stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
- } else {
- develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
- stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
- }
+ // Get the corresponding repository by OS Type
+ if (data.rsp == "aix") {
+ // No repository exists for AIX on Sourceforge!
+ develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
+ stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
+ } else {
+ develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
+ stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
+ }
- var repoList = $('');
+ var repoList = $('');
- // Display the Devel Repository, remember user's last selection
- show = show + "
";
- show = show + "Development: " + develRepository + "
";
- repoList.append(show);
+ // Display the Devel Repository, remember user's last selection
+ show = show + "
";
+ show = show + "Development: " + develRepository + "
";
+ repoList.append(show);
- // Display the Stable Repository, remember user's last selection
- show = "
";
- show = show + "Stable: " + stableRepository + "
";
- repoList.append(show);
+ // Display the Stable Repository, remember user's last selection
+ show = "
";
+ show = show + "Stable: " + stableRepository + "
";
+ repoList.append(show);
- // Display the Input Repository, remember user's last selection
- if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1)
- && ($.cookie('xcatrepository') != 2)) {
- show = "
Other: ";
- show += "";
- } else {
- show = "
Other: ";
- show += "";
- }
- repoList.append(show);
-
- $('#repository fieldset').append(repoList);
+ // Display the Input Repository, remember user's last selection
+ if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1)
+ && ($.cookie('xcatrepository') != 2)) {
+ show = "
Other: ";
+ show += "";
+ } else {
+ show = "
Other: ";
+ show += "";
+ }
+ repoList.append(show);
+
+ $('#repository fieldset').append(repoList);
}
/**
* Show all xCAT RPMs
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function showRpmInfo(data) {
- var rpms = null;
- var show = "";
- var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc",
- "xCAT-UI");
- var temp = 0;
- if (null == data.rsp) {
- $('#rpm fieldset').append("Error getting RPMs!");
- return;
- }
+ var rpms = null;
+ var show = "";
+ var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc",
+ "xCAT-UI");
+ var temp = 0;
+ if (null == data.rsp) {
+ $('#rpm fieldset').append("Error getting RPMs!");
+ return;
+ }
- rpms = data.rsp.split(/\n/);
-
- // No rpm installed, return
- if (1 > rpms.length) {
- $('#rpm fieldset').append("No RPMs installed!");
- return;
- }
+ rpms = data.rsp.split(/\n/);
+
+ // No rpm installed, return
+ if (1 > rpms.length) {
+ $('#rpm fieldset').append("No RPMs installed!");
+ return;
+ }
- // Clear the old data
- $('#rpm fieldset').children().remove();
- $('#rpm fieldset').append("");
- show = "
";
- show += "
";
- show += "
";
- show += "
Package Name
Version
";
- show += "
";
- for (temp = 0; temp < rpms.length; temp++) {
- // Empty line continue
- if (!rpms[temp]) {
- continue;
- }
+ // Clear the old data
+ $('#rpm fieldset').children().remove();
+ $('#rpm fieldset').append("");
+ show = "
";
+ show += "
";
+ show += "
";
+ show += "
Package Name
Version
";
+ show += "
";
+ for (temp = 0; temp < rpms.length; temp++) {
+ // Empty line continue
+ if (!rpms[temp]) {
+ continue;
+ }
- // The RPM is not installed, continue
- if (rpms[temp].indexOf("not") != -1) {
- continue;
- }
+ // The RPM is not installed, continue
+ if (rpms[temp].indexOf("not") != -1) {
+ continue;
+ }
- // Show the version in table
- show += "
');
+ break;
+ case 'scan':
+ settingsFS.append('');
+
+ // Change dialog width
+ $('#addBladeCenter').dialog('option', 'width', '650');
+ break;
}
-
- // Do not continue if node type is AMM
- if ($(this).val() == 'amm') {
- return;
- }
-
- // Gather AMM nodes
- settingsFS.find('select:eq(0)').after(createLoader());
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'lsdef',
- tgt : '',
- args : '-t;node;-w;mgt==blade;-w;id==0',
- msg : nodeType
- },
- success : function(data) {
- var position = 0;
- var tmp = '';
- var options = '';
-
- // Remove the loading image
- settingsFS.find('img').remove();
+
+ // Do not continue if node type is AMM
+ if ($(this).val() == 'amm') {
+ return;
+ }
+
+ // Gather AMM nodes
+ settingsFS.find('select:eq(0)').after(createLoader());
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsdef',
+ tgt : '',
+ args : '-t;node;-w;mgt==blade;-w;id==0',
+ msg : nodeType
+ },
+ success : function(data) {
+ var position = 0;
+ var tmp = '';
+ var options = '';
+
+ // Remove the loading image
+ settingsFS.find('img').remove();
- // Do not continue if no AMM nodes are found
- if (data.rsp.length < 1) {
- $('#addBladeCenter').prepend(createWarnBar('Please define an AMM node before continuing'));
- return;
- }
+ // Do not continue if no AMM nodes are found
+ if (data.rsp.length < 1) {
+ $('#addBladeCenter').prepend(createWarnBar('Please define an AMM node before continuing'));
+ return;
+ }
- // Create options for AMM nodes
- for (var i in data.rsp){
- tmp = data.rsp[i];
- position = tmp.indexOf(' ');
- tmp = tmp.substring(0, position);
- options += '';
- }
+ // Create options for AMM nodes
+ for (var i in data.rsp){
+ tmp = data.rsp[i];
+ position = tmp.indexOf(' ');
+ tmp = tmp.substring(0, position);
+ options += '';
+ }
- // Select the first AMM node
- settingsFS.find('select:eq(0)').append(options);
- if (data.msg != 'scan') {
- return;
- }
-
- // Create Scan button
- var scan = createButton('Scan');
- scan.bind('click', function(){
- var ammName = settingsFS.find('select:eq(0)').val();
- settingsFS.prepend(createLoader());
- $('#bcSettings button').attr('disabled', 'disabled');
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'rscan',
- tgt : ammName,
- args : '',
- msg : ''
- },
-
- /**
- * Show scanned results for AMM
- *
- * @param data Data returned from HTTP request
- */
- success: function(data){
- showScanAmmResult(data.rsp[0]);
- }
- });
- });
-
- settingsFS.find('select:eq(0)').after(scan);
- }
- });
+ // Select the first AMM node
+ settingsFS.find('select:eq(0)').append(options);
+ if (data.msg != 'scan') {
+ return;
+ }
+
+ // Create Scan button
+ var scan = createButton('Scan');
+ scan.bind('click', function(){
+ var ammName = settingsFS.find('select:eq(0)').val();
+ settingsFS.prepend(createLoader());
+ $('#bcSettings button').attr('disabled', 'disabled');
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'rscan',
+ tgt : ammName,
+ args : '',
+ msg : ''
+ },
+
+ /**
+ * Show scanned results for AMM
+ *
+ * @param data Data returned from HTTP request
+ */
+ success: function(data){
+ showScanAmmResult(data.rsp[0]);
+ }
+ });
+ });
+
+ settingsFS.find('select:eq(0)').after(scan);
+ }
+ });
});
- // Create dialog for BladeCenter
+ // Create dialog for BladeCenter
addNodeForm.dialog({
modal : true,
width : 400,
@@ -342,7 +326,7 @@ bladePlugin.prototype.addNode = function() {
$(".ui-dialog-titlebar-close").hide();
},
close : function(){
- $(this).remove();
+ $(this).remove();
},
buttons : {
'Ok' : function() {
@@ -355,7 +339,7 @@ bladePlugin.prototype.addNode = function() {
} else if(addMethod == "blade") {
addBladeNode();
} else{
- addMmScanNode();
+ addMmScanNode();
}
},
'Cancel' : function() {
@@ -372,27 +356,27 @@ bladePlugin.prototype.addNode = function() {
* Add AMM node
*/
function addAmmNode(){
- var args = '';
- var errorMsg = '';
+ var args = '';
+ var errorMsg = '';
- // Check for missing inputs
- $('#addBladeCenter input').each(function(){
- if (!$(this).val()) {
- errorMsg = 'Please provide a value for each missing field!';
- }
-
- args += $(this).val() + ',';
- });
-
- // Do not continue if error was found
- if (errorMsg) {
- $('#addBladeCenter').prepend(createWarnBar(errorMsg));
- return;
- }
+ // Check for missing inputs
+ $('#addBladeCenter input').each(function(){
+ if (!$(this).val()) {
+ errorMsg = 'Please provide a value for each missing field!';
+ }
+
+ args += $(this).val() + ',';
+ });
+
+ // Do not continue if error was found
+ if (errorMsg) {
+ $('#addBladeCenter').prepend(createWarnBar(errorMsg));
+ return;
+ }
- args = args.substring(0, args.length - 1);
+ args = args.substring(0, args.length - 1);
- // Add the loader
+ // Add the loader
$('#addBladeCenter').append(createLoader());
$('.ui-dialog-buttonpane .ui-button').attr('disabled', true);
$.ajax( {
@@ -405,7 +389,7 @@ function addAmmNode(){
msg : ''
},
success : function(data) {
- // Remove loader
+ // Remove loader
$('#addBladeCenter').find('img').remove();
$('#addBladeCenter').prepend(createInfoBar('AMM node was successfully added'));
$('#addBladeCenter').dialog("option", "buttons", {
@@ -421,7 +405,7 @@ function addAmmNode(){
* Add blade node
*/
function addBladeNode(){
- // Get blade node attributes
+ // Get blade node attributes
var name = $('#bcSettings input[name="bladeName"]').val();
var group = $('#bcSettings input[name="bladeGroup"]').val();
var id = $('#bcSettings input[name="bladeId"]').val();
@@ -429,10 +413,10 @@ function addBladeNode(){
var mpa = $('#bcSettings select[name="bladeMpa"]').val();
var args = '-t;node;-o;' + name
- + ';id=' + id
- + ';nodetype=osi;groups=' + group
- + ';mgt=blade;mpa=' + mpa
- + ';serialflow=hard';
+ + ';id=' + id
+ + ';nodetype=osi;groups=' + group
+ + ';mgt=blade;mpa=' + mpa
+ + ';serialflow=hard';
// Set the serial speed and port for LS series blade
if (series != 'js') {
@@ -458,7 +442,7 @@ function addBladeNode(){
msg : ''
},
success : function(data) {
- // Remove loader
+ // Remove loader
$('#addBladeCenter').find('img').remove();
// Gather response and display it
@@ -484,106 +468,104 @@ function addBladeNode(){
/**
* Show rscan results
*
- * @param results
- * Results from rscan of blade MPA
- * @return Nothing
+ * @param results Results from rscan of blade MPA
*/
function showScanAmmResult(results){
- var rSection = $('');
-
- // Create table to hold results
- var rTable = $('
');
-
- // Reset scan results area
- $('#addBladeCenter #scanResults').remove();
- $('#bcSettings img').remove();
- $('#bcSettings button').attr('disabled', '');
- if (!results)
- return;
-
- // Do not continue if there are no results
- var rows = results.split("\n");
- if (rows.length < 2){
- $('#bcSettings').prepend(createWarnBar(rows[0]));
- return;
- }
-
- // Add the table header
- var fields = rows[0].match(/\S+/g);
- var column = fields.length;
- var row = $('
');
- row.append('
');
- for(var i in fields){
- row.append('
' + fields[i] + '
');
- }
- rTable.append(row);
-
- // Add table body
- var line;
- for (var i = 1; i < rows.length; i++) {
- line = rows[i];
-
- if (!line)
- continue;
-
- var fields = line.match(/\S+/g);
- if (fields[0] == 'mm')
- continue;
-
- // Create a row for each result
- var row = $('
');
- row.append('
');
-
- // Add column for each field
- for (var j = 0; j < column; j++){
- if (fields[j]) {
- if (j == 1) {
- row.append('
');
- } else {
- row.append('
' + fields[j] + '
');
- }
- } else {
- row.append('
');
- }
- }
-
- // Append row to table
- rTable.append(row);
- }
-
- rSection.append(rTable);
- $('#bcSettings').prepend(rSection);
+ var rSection = $('');
+
+ // Create table to hold results
+ var rTable = $('
');
+
+ // Reset scan results area
+ $('#addBladeCenter #scanResults').remove();
+ $('#bcSettings img').remove();
+ $('#bcSettings button').attr('disabled', '');
+ if (!results)
+ return;
+
+ // Do not continue if there are no results
+ var rows = results.split("\n");
+ if (rows.length < 2){
+ $('#bcSettings').prepend(createWarnBar(rows[0]));
+ return;
+ }
+
+ // Add the table header
+ var fields = rows[0].match(/\S+/g);
+ var column = fields.length;
+ var row = $('
');
+ row.append('
');
+ for(var i in fields){
+ row.append('
' + fields[i] + '
');
+ }
+ rTable.append(row);
+
+ // Add table body
+ var line;
+ for (var i = 1; i < rows.length; i++) {
+ line = rows[i];
+
+ if (!line)
+ continue;
+
+ var fields = line.match(/\S+/g);
+ if (fields[0] == 'mm')
+ continue;
+
+ // Create a row for each result
+ var row = $('
');
+ row.append('
');
+
+ // Add column for each field
+ for (var j = 0; j < column; j++){
+ if (fields[j]) {
+ if (j == 1) {
+ row.append('
'));
- nodeFS.append(nodeAttr);
-
- // Create image fieldset
- var imgFS = $('');
- var imgLegend = $('');
- imgFS.append(imgLegend);
-
- var imgAttr = $('');
- imgFS.append($('
'));
- imgFS.append(imgAttr);
-
- provExisting.append(nodeFS, imgFS);
-
- // Create group input
- var group = $('');
- var groupLabel = $('');
- group.append(groupLabel);
+ // Create node fieldset
+ var nodeFS = $('');
+ var nodeLegend = $('');
+ nodeFS.append(nodeLegend);
+
+ var nodeAttr = $('');
+ nodeFS.append($('
'));
+ nodeFS.append(nodeAttr);
+
+ // Create image fieldset
+ var imgFS = $('');
+ var imgLegend = $('');
+ imgFS.append(imgLegend);
+
+ var imgAttr = $('');
+ imgFS.append($('
'));
+ imgFS.append(imgAttr);
+
+ provExisting.append(nodeFS, imgFS);
+
+ // Create group input
+ var group = $('');
+ var groupLabel = $('');
+ group.append(groupLabel);
- // Turn on auto complete for group
- var dTableDivId = 'bladeNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
- var groupNames = $.cookie('groups');
- if (groupNames) {
- // Split group names into an array
- var tmp = groupNames.split(',');
+ // Turn on auto complete for group
+ var dTableDivId = 'bladeNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
+ var groupNames = $.cookie('groups');
+ if (groupNames) {
+ // Split group names into an array
+ var tmp = groupNames.split(',');
- // Create drop down for groups
- var groupSelect = $('');
- groupSelect.append('');
- for ( var i in tmp) {
- // Add group into drop down
- var opt = $('');
- groupSelect.append(opt);
- }
- group.append(groupSelect);
+ // Create drop down for groups
+ var groupSelect = $('');
+ groupSelect.append('');
+ for ( var i in tmp) {
+ // Add group into drop down
+ var opt = $('');
+ 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);
- }
- nodeAttr.append(group);
+ // 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);
+ }
+ nodeAttr.append(group);
- // Create node input
- var node = $('');
- var nodeLabel = $('');
- var nodeDatatable = $('
Select a group to view its nodes
');
- node.append(nodeLabel);
- node.append(nodeDatatable);
- nodeAttr.append(node);
+ // Create node input
+ var node = $('');
+ var nodeLabel = $('');
+ var nodeDatatable = $('
Select a group to view its nodes
');
+ node.append(nodeLabel);
+ node.append(nodeDatatable);
+ nodeAttr.append(node);
- // Create boot method drop down
- var method = $('');
- var methodLabel = $('');
- var methodSelect = $('');
- methodSelect.append(''
- + ''
- + ''
- + ''
- + ''
- + ''
- );
- method.append(methodLabel);
- method.append(methodSelect);
- imgAttr.append(method);
-
- // Create operating system input
- var os = $('');
- var osLabel = $('');
- var osInput = $('');
- osInput.one('focus', function() {
- var tmp = $.cookie('osvers');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- os.append(osLabel);
- os.append(osInput);
- imgAttr.append(os);
+ // Create boot method drop down
+ var method = $('');
+ var methodLabel = $('');
+ var methodSelect = $('');
+ methodSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ method.append(methodLabel);
+ method.append(methodSelect);
+ imgAttr.append(method);
+
+ // Create operating system input
+ var os = $('');
+ var osLabel = $('');
+ var osInput = $('');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('osvers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ imgAttr.append(os);
- // Create architecture input
- var arch = $('');
- var archLabel = $('');
- var archInput = $('');
- archInput.one('focus', function() {
- var tmp = $.cookie('osarchs');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- imgAttr.append(arch);
+ // Create architecture input
+ var arch = $('');
+ var archLabel = $('');
+ var archInput = $('');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('osarchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ imgAttr.append(arch);
- // Create profile input
- var profile = $('');
- var profileLabel = $('');
- var profileInput = $('');
- profileInput.one('focus', function() {
- var tmp = $.cookie('profiles');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- imgAttr.append(profile);
+ // Create profile input
+ var profile = $('');
+ var profileLabel = $('');
+ var profileInput = $('');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ imgAttr.append(profile);
- /**
- * Provision existing
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Remove any warning messages
- $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
- var ready = true;
- var errorMessage = '';
+ /**
+ * Provision existing
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // Remove any warning messages
+ $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
+ var ready = true;
+ var errorMessage = '';
- // Get provision tab ID
- var thisTabId = 'bladeProvisionTab' + inst;
-
- // Get nodes that were checked
- var dTableId = 'bladeNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
- if (!tgts) {
- errorMessage += 'You need to select a node. ';
- ready = false;
- }
-
- // Check booth method
- var boot = $('#' + thisTabId + ' select[name=bootMethod]');
- if (!boot.val()) {
- errorMessage += 'You need to select a boot method. ';
- boot.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- boot.css('border', 'solid #BDBDBD 1px');
- }
-
- // Check operating system image
- var os = $('#' + thisTabId + ' input[name=os]');
- if (!os.val()) {
- errorMessage += 'You need to select a operating system image. ';
- os.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- os.css('border', 'solid #BDBDBD 1px');
- }
-
- // Check architecture
- var arch = $('#' + thisTabId + ' input[name=arch]');
- if (!arch.val()) {
- errorMessage += 'You need to select an architecture. ';
- arch.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- arch.css('border', 'solid #BDBDBD 1px');
- }
-
- // Check profile
- var profile = $('#' + thisTabId + ' input[name=profile]');
- if (!profile.val()) {
- errorMessage += 'You need to select a profile. ';
- profile.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- profile.css('border', 'solid #BDBDBD 1px');
- }
-
- // If all inputs are valid, ready to provision
- if (ready) {
- // Disable provision button
- $(this).attr('disabled', 'true');
-
- // Prepend status bar
- var statBar = createStatusBar('bladeProvisionStatBar' + inst);
- statBar.append(createLoader(''));
- statBar.prependTo($('#' + thisTabId));
+ // Get provision tab ID
+ var thisTabId = 'bladeProvisionTab' + inst;
+
+ // Get nodes that were checked
+ var dTableId = 'bladeNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+ if (!tgts) {
+ errorMessage += 'You need to select a node. ';
+ ready = false;
+ }
+
+ // Check booth method
+ var boot = $('#' + thisTabId + ' select[name=bootMethod]');
+ if (!boot.val()) {
+ errorMessage += 'You need to select a boot method. ';
+ boot.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ boot.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check operating system image
+ var os = $('#' + thisTabId + ' input[name=os]');
+ if (!os.val()) {
+ errorMessage += 'You need to select a operating system image. ';
+ os.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ os.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check architecture
+ var arch = $('#' + thisTabId + ' input[name=arch]');
+ if (!arch.val()) {
+ errorMessage += 'You need to select an architecture. ';
+ arch.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ arch.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check profile
+ var profile = $('#' + thisTabId + ' input[name=profile]');
+ if (!profile.val()) {
+ errorMessage += 'You need to select a profile. ';
+ profile.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ profile.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // If all inputs are valid, ready to provision
+ if (ready) {
+ // Disable provision button
+ $(this).attr('disabled', 'true');
+
+ // Prepend status bar
+ var statBar = createStatusBar('bladeProvisionStatBar' + inst);
+ statBar.append(createLoader(''));
+ statBar.prependTo($('#' + thisTabId));
- // Disable all inputs
- var inputs = $('#' + thisTabId + ' input');
- inputs.attr('disabled', 'disabled');
-
- // Disable all selects
- var selects = $('#' + thisTabId + ' select');
- selects.attr('disabled', 'disabled');
-
- /**
- * (1) Set operating system
- */
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeadd',
- tgt : '',
- args : tgts + ';noderes.netboot=xnba;nodetype.os=' + os.val() + ';nodetype.arch=' + arch.val() + ';nodetype.profile=' + profile.val() + ';nodetype.provmethod=' + boot.val(),
- msg : 'cmd=nodeadd;out=' + inst
- },
+ // Disable all inputs
+ var inputs = $('#' + thisTabId + ' input');
+ inputs.attr('disabled', 'disabled');
+
+ // Disable all selects
+ var selects = $('#' + thisTabId + ' select');
+ selects.attr('disabled', 'disabled');
+
+ /**
+ * (1) Set operating system
+ */
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeadd',
+ tgt : '',
+ args : tgts + ';noderes.netboot=xnba;nodetype.os=' + os.val() + ';nodetype.arch=' + arch.val() + ';nodetype.profile=' + profile.val() + ';nodetype.provmethod=' + boot.val(),
+ msg : 'cmd=nodeadd;out=' + inst
+ },
- success : updateBladeProvisionExistingStatus
- });
- } else {
- // Show warning message
- var warn = createWarnBar(errorMessage);
- warn.prependTo($(this).parent().parent());
- }
- });
- provExisting.append(provisionBtn);
+ success : updateBladeProvisionExistingStatus
+ });
+ } else {
+ // Show warning message
+ var warn = createWarnBar(errorMessage);
+ warn.prependTo($(this).parent().parent());
+ }
+ });
+ provExisting.append(provisionBtn);
- return provExisting;
+ return provExisting;
}
/**
* Update the provision existing node status
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function updateBladeProvisionExistingStatus(data) {
- // Get ajax response
- var rsp = data.rsp;
- var args = data.msg.split(';');
+ // Get ajax response
+ var rsp = data.rsp;
+ var args = data.msg.split(';');
- // Get command invoked
- var cmd = args[0].replace('cmd=', '');
- // Get provision tab instance
- var inst = args[1].replace('out=', '');
-
- // Get provision tab and status bar ID
- var statBarId = 'bladeProvisionStatBar' + inst;
- var tabId = 'bladeProvisionTab' + inst;
-
- /**
- * (2) Remote install
- */
- if (cmd == 'nodeadd') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
+ // Get command invoked
+ var cmd = args[0].replace('cmd=', '');
+ // Get provision tab instance
+ var inst = args[1].replace('out=', '');
+
+ // Get provision tab and status bar ID
+ var statBarId = 'bladeProvisionStatBar' + inst;
+ var tabId = 'bladeProvisionTab' + inst;
+
+ /**
+ * (2) Remote install
+ */
+ if (cmd == 'nodeadd') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
- // Get parameters
- var os = $('#' + tabId + ' input[name="os"]').val();
- var profile = $('#' + tabId + ' input[name="profile"]').val();
- var arch = $('#' + tabId + ' input[name="arch"]').val();
-
- // Get nodes that were checked
- var dTableId = 'bladeNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
-
- // Begin installation
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'rbootseq',
- tgt : tgts,
- args : 'net,hd',
- msg : 'cmd=rbootseq;out=' + inst
- },
+ // Get parameters
+ var os = $('#' + tabId + ' input[name="os"]').val();
+ var profile = $('#' + tabId + ' input[name="profile"]').val();
+ var arch = $('#' + tabId + ' input[name="arch"]').val();
+
+ // Get nodes that were checked
+ var dTableId = 'bladeNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+
+ // Begin installation
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'rbootseq',
+ tgt : tgts,
+ args : 'net,hd',
+ msg : 'cmd=rbootseq;out=' + inst
+ },
- success : updateBladeProvisionExistingStatus
- });
- }
-
- /**
- * (3) Prepare node for boot
- */
- if (cmd == 'nodeadd') {
- // Get provision method
- var bootMethod = $('#' + tabId + ' select[name=bootMethod]').val();
-
- // Get nodes that were checked
- var dTableId = 'bladeNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
-
- // Prepare node for boot
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeset',
- tgt : tgts,
- args : bootMethod,
- msg : 'cmd=nodeset;out=' + inst
- },
+ success : updateBladeProvisionExistingStatus
+ });
+ }
+
+ /**
+ * (3) Prepare node for boot
+ */
+ if (cmd == 'nodeadd') {
+ // Get provision method
+ var bootMethod = $('#' + tabId + ' select[name=bootMethod]').val();
+
+ // Get nodes that were checked
+ var dTableId = 'bladeNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+
+ // Prepare node for boot
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeset',
+ tgt : tgts,
+ args : bootMethod,
+ msg : 'cmd=nodeset;out=' + inst
+ },
- success : updateBladeProvisionExistingStatus
- });
- }
-
- /**
- * (4) Power on node
- */
- if (cmd == 'nodeset') {
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
-
- // Get nodes that were checked
- var dTableId = 'bladeNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
-
- // Prepare node for boot
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'rpower',
- tgt : tgts,
- args : 'boot',
- msg : 'cmd=rpower;out=' + inst
- },
+ success : updateBladeProvisionExistingStatus
+ });
+ }
+
+ /**
+ * (4) Power on node
+ */
+ if (cmd == 'nodeset') {
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+
+ // Get nodes that were checked
+ var dTableId = 'bladeNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+
+ // Prepare node for boot
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'rpower',
+ tgt : tgts,
+ args : 'boot',
+ msg : 'cmd=rpower;out=' + inst
+ },
- success : updateBladeProvisionExistingStatus
- });
- }
-
- /**
- * (5) Done
- */
- else if (cmd == 'rpower') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
- $('#' + statBarId).find('img').remove();
-
- // If installation was successful
- if (prg.html().indexOf('Error') == -1) {
- $('#' + statBarId).find('div').append('
It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
');
- }
- }
+ success : updateBladeProvisionExistingStatus
+ });
+ }
+
+ /**
+ * (5) Done
+ */
+ else if (cmd == 'rpower') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+ $('#' + statBarId).find('img').remove();
+
+ // If installation was successful
+ if (prg.html().indexOf('Error') == -1) {
+ $('#' + statBarId).find('div').append('
It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
');
+ }
+ }
}
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js
index cb97008ef..add88765e 100644
--- a/xCAT-UI/js/custom/customUtils.js
+++ b/xCAT-UI/js/custom/customUtils.js
@@ -1,409 +1,400 @@
/**
* Create nodes datatable for a given group
*
- * @param group
- * Group name
- * @param outId
- * Division ID to append datatable
+ * @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
- },
+ // 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;
+ /**
+ * Create nodes datatable
+ *
+ * @param data Data returned from HTTP request
+ */
+ success : function(data) {
+ // Data returned
+ var rsp = data.rsp;
- // Get output ID
- var outId = data.msg;
- // Get datatable ID
- var dTableId = outId.replace('DIV', '');
+ // Get output ID
+ var outId = data.msg;
+ // Get datatable ID
+ var dTableId = outId.replace('DIV', '');
- // Node attributes hash
- var attrs = new Object();
- // Node attributes
- var headers = new Object();
+ // Node attributes hash
+ var attrs = new Object();
+ // Node attributes
+ var headers = new Object();
- // Clear nodes datatable division
- $('#' + outId).empty();
+ // Clear nodes datatable division
+ $('#' + outId).empty();
- // Create nodes datatable
- var node, args;
- for ( var i in rsp) {
- // Get node
- var pos = rsp[i].indexOf('Object name:');
- if (pos > -1) {
- var temp = rsp[i].split(': ');
- node = jQuery.trim(temp[1]);
+ // Create nodes datatable
+ var node = null;
+ var 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++;
- }
+ // 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]);
+ // 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;
- }
+ // 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();
+ // 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');
+ // Add column for check box and node
+ sorted.unshift('', 'node');
- // Create nodes datatable
- var dTable = new DataTable(dTableId);
- dTable.init(sorted);
+ // 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 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('');
- }
- }
+ // 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);
- }
+ // Add row to table
+ dTable.add(row);
+ }
- $('#' + outId).append(dTable.object());
- $('#' + dTableId).dataTable();
- } // End of function(data)
- });
+ $('#' + 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
+ * @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 provision existing division and hide it
+ var provExisting = $('').hide();
- // Create group input
- var group = $('');
- var groupLabel = $('');
- group.append(groupLabel);
+ // Create group input
+ var group = $('');
+ var groupLabel = $('');
+ 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(',');
+ // 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 = $('');
- groupSelect.append(opt);
- }
- group.append(groupSelect);
+ // Create drop down for groups
+ var groupSelect = $('');
+ groupSelect.append('');
+ for ( var i in tmp) {
+ // Add group into drop down
+ var opt = $('');
+ 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 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 = $('');
- var nodeDatatable = $('
Select a group to view its nodes
');
- node.append(nodeLabel);
- node.append(nodeDatatable);
- provExisting.append(node);
+ // Create node input
+ var node = $('');
+ var nodeLabel = $('');
+ 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 = $('');
- var methodSelect = $('');
- methodSelect.append(''
- + ''
- + ''
- + ''
- + ''
- );
- method.append(methodLabel);
- method.append(methodSelect);
- provExisting.append(method);
+ // Create boot method drop down
+ var method = $('');
+ var methodLabel = $('');
+ var methodSelect = $('');
+ methodSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ method.append(methodLabel);
+ method.append(methodSelect);
+ provExisting.append(method);
- // Create boot type drop down
- var type = $('');
- var typeLabel = $('');
- var typeSelect = $('');
- typeSelect.append(''
- + ''
- + ''
- );
- type.append(typeLabel);
- type.append(typeSelect);
- provExisting.append(type);
+ // Create boot type drop down
+ var type = $('');
+ var typeLabel = $('');
+ var typeSelect = $('');
+ typeSelect.append(''
+ + ''
+ + ''
+ );
+ type.append(typeLabel);
+ type.append(typeSelect);
+ provExisting.append(type);
- // Create operating system input
- var os = $('');
- var osLabel = $('');
- var osInput = $('');
- osInput.one('focus', function() {
- var tmp = $.cookie('osvers');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provExisting.append(os);
+ // Create operating system input
+ var os = $('');
+ var osLabel = $('');
+ var osInput = $('');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('osvers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ provExisting.append(os);
- // Create architecture input
- var arch = $('');
- var archLabel = $('');
- var archInput = $('');
- archInput.one('focus', function() {
- var tmp = $.cookie('osarchs');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provExisting.append(arch);
+ // Create architecture input
+ var arch = $('');
+ var archLabel = $('');
+ var archInput = $('');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('osarchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ provExisting.append(arch);
- // Create profile input
- var profile = $('');
- var profileLabel = $('');
- var profileInput = $('');
- profileInput.one('focus', function() {
- var tmp = $.cookie('profiles');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provExisting.append(profile);
+ // Create profile input
+ var profile = $('');
+ var profileLabel = $('');
+ var profileInput = $('');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ provExisting.append(profile);
- /**
- * Provision existing
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // TODO Insert provision code here
- openDialog('info', 'Not yet supported');
- });
- provExisting.append(provisionBtn);
+ /**
+ * Provision existing
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // TODO Insert provision code here
+ openDialog('info', 'Not yet supported');
+ });
+ provExisting.append(provisionBtn);
- return provExisting;
+ return provExisting;
}
/**
* Create provision new node division
*
- * @param inst
- * Provision tab instance
+ * @param inst Provision tab instance
* @return Provision new node division
*/
function createProvisionNew(plugin, inst) {
- // Create provision new node division
- var provNew = $('');
+ // Create provision new node division
+ var provNew = $('');
- // Create node input
- var nodeName = $('');
- provNew.append(nodeName);
+ // Create node input
+ var nodeName = $('');
+ provNew.append(nodeName);
- // Create group input
- var group = $('');
- var groupLabel = $('');
- var groupInput = $('');
- groupInput.one('focus', function() {
- var groupNames = $.cookie('groups');
- if (groupNames) {
- // Turn on auto complete
- $(this).autocomplete({
- source: groupNames.split(',')
- });
- }
- });
- group.append(groupLabel);
- group.append(groupInput);
- provNew.append(group);
+ // Create group input
+ var group = $('');
+ var groupLabel = $('');
+ var groupInput = $('');
+ groupInput.one('focus', function() {
+ var groupNames = $.cookie('groups');
+ if (groupNames) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: groupNames.split(',')
+ });
+ }
+ });
+ group.append(groupLabel);
+ group.append(groupInput);
+ provNew.append(group);
- // Create boot method drop down
- var method = $('');
- var methodLabel = $('');
- var methodSelect = $('');
- methodSelect.append(''
- + ''
- + ''
- + ''
- + ''
- );
- method.append(methodLabel);
- method.append(methodSelect);
- provNew.append(method);
+ // Create boot method drop down
+ var method = $('');
+ var methodLabel = $('');
+ var methodSelect = $('');
+ methodSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ method.append(methodLabel);
+ method.append(methodSelect);
+ provNew.append(method);
- // Create boot type drop down
- var type = $('');
- var typeLabel = $('');
- var typeSelect = $('');
- typeSelect.append(''
- + ''
- + ''
- );
- type.append(typeLabel);
- type.append(typeSelect);
- provNew.append(type);
+ // Create boot type drop down
+ var type = $('');
+ var typeLabel = $('');
+ var typeSelect = $('');
+ typeSelect.append(''
+ + ''
+ + ''
+ );
+ type.append(typeLabel);
+ type.append(typeSelect);
+ provNew.append(type);
- // Create operating system input
- var os = $('');
- var osLabel = $('');
- var osInput = $('');
- osInput.one('focus', function() {
- var tmp = $.cookie('osvers');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- os.append(osLabel);
- os.append(osInput);
- provNew.append(os);
+ // Create operating system input
+ var os = $('');
+ var osLabel = $('');
+ var osInput = $('');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('osvers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ provNew.append(os);
- // Create architecture input
- var arch = $('');
- var archLabel = $('');
- var archInput = $('');
- archInput.one('focus', function() {
- var tmp = $.cookie('osarchs');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- provNew.append(arch);
+ // Create architecture input
+ var arch = $('');
+ var archLabel = $('');
+ var archInput = $('');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('osarchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ provNew.append(arch);
- // Create profile input
- var profile = $('');
- var profileLabel = $('');
- var profileInput = $('');
- profileInput.one('focus', function() {
- var tmp = $.cookie('profiles');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- provNew.append(profile);
+ // Create profile input
+ var profile = $('');
+ var profileLabel = $('');
+ var profileInput = $('');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ provNew.append(profile);
- /**
- * Provision new node
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // TODO Insert provision code here
- openDialog('info', 'Not yet supported');
- });
- provNew.append(provisionBtn);
+ /**
+ * Provision new node
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // TODO Insert provision code here
+ openDialog('info', 'Not yet supported');
+ });
+ provNew.append(provisionBtn);
- return provNew;
+ return provNew;
}
/**
* Create section to provision node
*
- * @param plugin
- * Plugin name
- * @param container
- * Container to hold provision section
- * @return Nothing
+ * @param plugin Plugin name
+ * @param container Container to hold provision section
*/
function appendProvisionSection(plugin, container) {
- // Get provision tab ID
+ // Get provision tab ID
var tabId = container.parents('.tab').attr('id');
- if (plugin == 'quick')
- appendProvision4Url(container); // For provisioning based on argmunents found in URL
+ if (plugin == 'quick')
+ appendProvision4Url(container); // For provisioning based on argmunents found in URL
else
- appendProvision4NoUrl(plugin, container);
+ appendProvision4NoUrl(plugin, container);
// Add provision button
var provisionBtn = createButton('Provision');
provisionBtn.bind('click', function(){
- provisionNode(tabId);
+ provisionNode(tabId);
});
container.append(provisionBtn);
@@ -451,34 +442,30 @@ function appendProvisionSection(plugin, container) {
/**
* Create provision node section using URL
*
- * @param container
- * Container to hold provision section
+ * @param container Container to hold provision section
* @returns Nothing
*/
-function appendProvision4Url(container){
- // Get provision tab ID
- var tabId = container.parents('.tab').attr('id');
+function appendProvision4Url(container){
+ // Create node fieldset
+ var nodeFS = $('');
+ var nodeLegend = $('');
+ nodeFS.append(nodeLegend);
+ container.append(nodeFS);
+
+ var nodeAttr = $('');
+ nodeFS.append($('
'));
+ imgFS.append(imgAttr);
+
+ // Select group name
var group = $('').append('');
var groupSelect = $('');
group.append(groupSelect);
@@ -557,26 +541,26 @@ function appendProvision4NoUrl(plugin, container){
var tmp = groupNames.split(',');
groupSelect.append(''); // Append empty group name
for (var i in tmp)
- groupSelect.append('');
+ groupSelect.append('');
}
nodeAttr.append(group);
// Select node from table
var nodes = $('');
- var nodesTable = $('
');
+ }
+ }
});
}
/**
* Create nodes table
*
- * @param group
- * Group name
- * @param outId
- * Output section ID
- * @return Nothing
+ * @param group Group name
+ * @param outId Output section ID
*/
-function createNodesTable(group, outId) {
+function createNodesTable(group, outId) {
// Get group nodes
$.ajax({
url : 'lib/cmd.php',
@@ -755,9 +730,9 @@ function createNodesTable(group, outId) {
outId.empty().append(nTable);
if (nodes.length > 10)
- outId.css('height', '300px');
+ outId.css('height', '300px');
else
- outId.css('height', 'auto');
+ outId.css('height', 'auto');
}
});
}
@@ -765,8 +740,7 @@ function createNodesTable(group, outId) {
/**
* Get select element names
*
- * @param obj
- * Object to get selected element names
+ * @param obj Object to get selected element names
* @return Nodes name seperate by a comma
*/
function getCheckedByObj(obj) {
@@ -789,17 +763,14 @@ function getCheckedByObj(obj) {
/**
* Select all checkboxes in the table
*
- * @param event
- * Event on element
- * @param obj
- * Object triggering event
- * @return Nothing
+ * @param event Event on element
+ * @param obj Object triggering event
*/
function selectAll4Table(event, obj) {
- // Get datatable ID
- // This will ascend from
- var tableObj = obj.parents('table').find('tbody');
- var status = obj.attr('checked');
- tableObj.find(' :checkbox').attr('checked', status);
- event.stopPropagation();
+ // Get datatable ID
+ // This will ascend from
+ var tableObj = obj.parents('table').find('tbody');
+ var status = obj.attr('checked');
+ tableObj.find(' :checkbox').attr('checked', status);
+ event.stopPropagation();
}
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js
index 2caa2bb5b..105769dfc 100644
--- a/xCAT-UI/js/custom/esx.js
+++ b/xCAT-UI/js/custom/esx.js
@@ -2,7 +2,7 @@
* Execute when the DOM is fully loaded
*/
$(document).ready(function() {
- // Load utility scripts (if any)
+ // Load utility scripts (if any)
});
/**
@@ -17,508 +17,496 @@ var esxPlugin = function() {
/**
* Configure self-service page
*/
-esxPlugin.prototype.loadConfigPage = function(tabId) {
- var configAccordion = $('');
-
- // Create accordion panel for user
- var userSection = $('');
- var userLnk = $('
').click(function () {
- // Do not load panel again if it is already loaded
- if ($('#esxConfigUser').find('.dataTables_wrapper').length)
- return;
- else
- $('#esxConfigUser').append(createLoader(''));
-
- // Get user data
- loadUserPanel('esxConfigUser');
- });
-
- // Create accordion panel for profiles
- var profileSection = $('');
- profileSection.append(createInfoBar('Create, edit, and delete virtual machine profiles used in the self-service portal'));
- var profileLnk = $('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#esxConfigUser').find('.dataTables_wrapper').length)
+ return;
+ else
+ $('#esxConfigUser').append(createLoader(''));
+
+ // Get user data
+ loadUserPanel('esxConfigUser');
+ });
+
+ // Create accordion panel for profiles
+ var profileSection = $('');
+ profileSection.append(createInfoBar('Create, edit, and delete virtual machine profiles used in the self-service portal'));
+ var profileLnk = $('
').click(function () {
+
+ });
+
+ configAccordion.append(userLnk, userSection, profileLnk, profileSection, groupsLnk, groupsSection, nodeLnk, nodeSection);
+ $('#' + tabId).append(configAccordion);
+ configAccordion.accordion();
+
+ userLnk.trigger('click');
};
/**
* Clone node (service page)
*
- * @param node
- * Node to clone
- * @return Nothing
+ * @param node Node to clone
*/
esxPlugin.prototype.serviceClone = function(node) {
- openDialog('info', 'Not yet supported');
+ openDialog('info', 'Not yet supported');
};
/**
* Load provision page (service page)
*
* @param tabId
- * Tab ID where page will reside
+ * Tab ID where page will reside
* @return Nothing
*/
esxPlugin.prototype.loadServiceProvisionPage = function(tabId) {
- $('#' + tabId).append(createInfoBar('Not yet supported'));
+ $('#' + tabId).append(createInfoBar('Not yet supported'));
};
/**
* Show node inventory (service page)
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
esxPlugin.prototype.loadServiceInventory = function(data) {
-
+
};
/**
* Load node inventory
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
esxPlugin.prototype.loadInventory = function(data) {
- var args = data.msg.split(',');
- var tabId = args[0].replace('out=', '');
- var node = args[1].replace('node=', '');
-
- // Get node inventory
- var inv = data.rsp;
+ var args = data.msg.split(',');
+ var tabId = args[0].replace('out=', '');
+ var node = args[1].replace('node=', '');
+
+ // Get node inventory
+ var inv = data.rsp;
- // Remove loader
- $('#' + tabId).find('img').remove();
+ // Remove loader
+ $('#' + tabId).find('img').remove();
- // Create division to hold inventory
- var invDivId = tabId + 'Inventory';
- var invDiv = $('');
-
- // Create a fieldset
- var fieldSet = $('');
- var legend = $('');
- fieldSet.append(legend);
-
- var oList = $('');
- fieldSet.append(oList);
- invDiv.append(fieldSet);
+ // Create division to hold inventory
+ var invDivId = tabId + 'Inventory';
+ var invDiv = $('');
+
+ // Create a fieldset
+ var fieldSet = $('');
+ var legend = $('');
+ fieldSet.append(legend);
+
+ var oList = $('');
+ fieldSet.append(oList);
+ invDiv.append(fieldSet);
- // Loop through each line
- var item;
- for (var k = 0; k < inv.length; k++) {
- // Remove node name
- var attr = inv[k].replace(node + ': ', '');
- attr = jQuery.trim(attr);
+ // Loop through each line
+ var item;
+ for (var k = 0; k < inv.length; k++) {
+ // Remove node name
+ var attr = inv[k].replace(node + ': ', '');
+ attr = jQuery.trim(attr);
- // Append attribute to list
- item = $('');
- item.append(attr);
- oList.append(item);
- }
+ // Append attribute to list
+ item = $('');
+ item.append(attr);
+ oList.append(item);
+ }
- // Append to inventory form
- $('#' + tabId).append(invDiv);
+ // Append to inventory form
+ $('#' + tabId).append(invDiv);
};
/**
* Load clone page
*
- * @param node
- * Source node to clone
- * @return Nothing
+ * @param node Source node to clone
*/
esxPlugin.prototype.loadClonePage = function(node) {
- // Get nodes tab
- var tab = getNodesTab();
- var newTabId = node + 'CloneTab';
+ // Get nodes tab
+ var tab = getNodesTab();
+ var newTabId = node + 'CloneTab';
- // If there is no existing clone tab
- if (!$('#' + newTabId).length) {
- // Create info bar
- var infoBar = createInfoBar('Not yet supported');
+ // If there is no existing clone tab
+ if (!$('#' + newTabId).length) {
+ // Create info bar
+ var infoBar = createInfoBar('Not yet supported');
- // Create clone form
- var cloneForm = $('');
- cloneForm.append(infoBar);
+ // Create clone form
+ var cloneForm = $('');
+ cloneForm.append(infoBar);
- // Add clone tab
- tab.add(newTabId, 'Clone', cloneForm, true);
- }
-
- tab.select(newTabId);
+ // Add clone tab
+ tab.add(newTabId, 'Clone', cloneForm, true);
+ }
+
+ tab.select(newTabId);
};
/**
* Load provision page
*
- * @param tabId
- * The provision tab ID
- * @return Nothing
+ * @param tabId The provision tab ID
*/
esxPlugin.prototype.loadProvisionPage = function(tabId) {
- // Get OS image names
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'osimage',
- msg : ''
- },
+ // Get OS image names
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'osimage',
+ msg : ''
+ },
- success : setOSImageCookies
- });
+ success : setOSImageCookies
+ });
- // Get groups
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'extnoderange',
- tgt : '/.*',
- args : 'subgroups',
- msg : ''
- },
+ // Get groups
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'extnoderange',
+ tgt : '/.*',
+ args : 'subgroups',
+ msg : ''
+ },
- success : setGroupsCookies
- });
+ success : setGroupsCookies
+ });
- // Create provision form
- var provForm = $('');
+ // Create provision form
+ var provForm = $('');
- // Create info bar
- var infoBar = createInfoBar('Provision an ESX virtual machine.');
- provForm.append(infoBar);
+ // Create info bar
+ var infoBar = createInfoBar('Provision an ESX virtual machine.');
+ provForm.append(infoBar);
- // Append to provision tab
- $('#' + tabId).append(provForm);
-
- // Create VM fieldset
- var vmFS = $('');
- var vmLegend = $('');
- vmFS.append(vmLegend);
-
- var vmAttr = $('');
- vmFS.append($('
'));
- vmFS.append(vmAttr);
-
- // Create hardware fieldset
- var hwFS = $('');
- var hwLegend = $('');
- hwFS.append(hwLegend);
-
- var hwAttr = $('');
- hwFS.append($('
'));
- hwFS.append(hwAttr);
-
- // Create image fieldset
- var imgFS = $('');
- var imgLegend = $('');
- imgFS.append(imgLegend);
-
- var imgAttr = $('');
- imgFS.append($('
'));
- imgFS.append(imgAttr);
-
- provForm.append(vmFS, hwFS, imgFS);
-
- // Create hypervisor input
- var host = $('');
- var hostLabel = $('');
- host.append(hostLabel);
- var hostInput = $('');
- host.append(hostInput);
- vmAttr.append(host);
-
- // Create group input
- var group = $('');
- var groupLabel = $('');
- group.append(groupLabel);
+ // Append to provision tab
+ $('#' + tabId).append(provForm);
+
+ // Create VM fieldset
+ var vmFS = $('');
+ var vmLegend = $('');
+ vmFS.append(vmLegend);
+
+ var vmAttr = $('');
+ vmFS.append($('
'));
+ vmFS.append(vmAttr);
+
+ // Create hardware fieldset
+ var hwFS = $('');
+ var hwLegend = $('');
+ hwFS.append(hwLegend);
+
+ var hwAttr = $('');
+ hwFS.append($('
'));
+ hwFS.append(hwAttr);
+
+ // Create image fieldset
+ var imgFS = $('');
+ var imgLegend = $('');
+ imgFS.append(imgLegend);
+
+ var imgAttr = $('');
+ imgFS.append($('
'));
+ imgFS.append(imgAttr);
+
+ provForm.append(vmFS, hwFS, imgFS);
+
+ // Create hypervisor input
+ var host = $('');
+ var hostLabel = $('');
+ host.append(hostLabel);
+ var hostInput = $('');
+ host.append(hostInput);
+ vmAttr.append(host);
+
+ // Create group input
+ var group = $('');
+ var groupLabel = $('');
+ group.append(groupLabel);
- // Turn on auto complete for group
- var groupNames = $.cookie('groups');
- if (groupNames) {
- // Split group names into an array
- var tmp = groupNames.split(',');
+ // Turn on auto complete for group
+ 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 = $('');
- groupSelect.append(opt);
- }
- group.append(groupSelect);
- } else {
- // If no groups are cookied
- var groupInput = $('');
- group.append(groupInput);
- }
- vmAttr.append(group);
+ // Create drop down for groups
+ var groupSelect = $('');
+ groupSelect.append('');
+ for ( var i in tmp) {
+ // Add group into drop down
+ var opt = $('');
+ groupSelect.append(opt);
+ }
+ group.append(groupSelect);
+ } else {
+ // If no groups are cookied
+ var groupInput = $('');
+ group.append(groupInput);
+ }
+ vmAttr.append(group);
- // Create node input
- var node = $('');
- var nodeLabel = $('');
- var nodeInput = $('');
- node.append(nodeLabel);
- node.append(nodeInput);
- vmAttr.append(node);
+ // Create node input
+ var node = $('');
+ var nodeLabel = $('');
+ var nodeInput = $('');
+ node.append(nodeLabel);
+ node.append(nodeInput);
+ vmAttr.append(node);
- // Create memory input
- var memory = $('');
- var memoryLabel = $('');
- var memoryInput = $('');
- memory.append(memoryLabel);
- memory.append(memoryInput);
- hwAttr.append(memory);
-
- // Create processor dropdown
- var cpu = $('');
- var cpuLabel = $('');
- var cpuSelect = $('');
- cpuSelect.append(''
- + ''
- + ''
- + ''
- + ''
- + ''
- + ''
- + ''
- );
- cpu.append(cpuLabel);
- cpu.append(cpuSelect);
- hwAttr.append(cpu);
-
- // Create NIC dropdown
- var nic = $('');
- var nicLabel = $('');
- var nicInput = $('');
- nic.append(nicLabel);
- nic.append(nicInput);
- hwAttr.append(nic);
-
- // Create disk input
- var disk = $('');
- var diskLabel = $('');
- var diskInput = $('');
- var diskSizeSelect = $('');
- diskSizeSelect.append('' +
- ''
- );
- disk.append(diskLabel, diskInput, diskSizeSelect);
- hwAttr.append(disk);
-
- // Create disk storage input
- var storage = $('');
- var storageLabel = $('');
- var storageInput = $('');
- storage.append(storageLabel);
- storage.append(storageInput);
- hwAttr.append(storage);
-
- // Create operating system input
- var os = $('');
- var osLabel = $('');
- var osInput = $('');
- osInput.one('focus', function() {
- var tmp = $.cookie('osvers');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- os.append(osLabel);
- os.append(osInput);
- imgAttr.append(os);
-
- // Create architecture input
- var arch = $('');
- var archLabel = $('');
- var archInput = $('');
- archInput.one('focus', function() {
- var tmp = $.cookie('osarchs');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- imgAttr.append(arch);
-
- // Create profile input
- var profile = $('');
- var profileLabel = $('');
- var profileInput = $('');
- profileInput.one('focus', function() {
- var tmp = $.cookie('profiles');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- imgAttr.append(profile);
-
- // Create boot method dropdown
- var method = $('');
- var methodLabel = $('');
- var methodSelect = $('');
- methodSelect.append(''
- + ''
- + ''
- + ''
- + ''
- + ''
- );
- method.append(methodLabel);
- method.append(methodSelect);
- imgAttr.append(method);
+ // Create memory input
+ var memory = $('');
+ var memoryLabel = $('');
+ var memoryInput = $('');
+ memory.append(memoryLabel);
+ memory.append(memoryInput);
+ hwAttr.append(memory);
+
+ // Create processor dropdown
+ var cpu = $('');
+ var cpuLabel = $('');
+ var cpuSelect = $('');
+ cpuSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ cpu.append(cpuLabel);
+ cpu.append(cpuSelect);
+ hwAttr.append(cpu);
+
+ // Create NIC dropdown
+ var nic = $('');
+ var nicLabel = $('');
+ var nicInput = $('');
+ nic.append(nicLabel);
+ nic.append(nicInput);
+ hwAttr.append(nic);
+
+ // Create disk input
+ var disk = $('');
+ var diskLabel = $('');
+ var diskInput = $('');
+ var diskSizeSelect = $('');
+ diskSizeSelect.append('' +
+ ''
+ );
+ disk.append(diskLabel, diskInput, diskSizeSelect);
+ hwAttr.append(disk);
+
+ // Create disk storage input
+ var storage = $('');
+ var storageLabel = $('');
+ var storageInput = $('');
+ storage.append(storageLabel);
+ storage.append(storageInput);
+ hwAttr.append(storage);
+
+ // Create operating system input
+ var os = $('');
+ var osLabel = $('');
+ var osInput = $('');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('osvers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ imgAttr.append(os);
+
+ // Create architecture input
+ var arch = $('');
+ var archLabel = $('');
+ var archInput = $('');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('osarchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ imgAttr.append(arch);
+
+ // Create profile input
+ var profile = $('');
+ var profileLabel = $('');
+ var profileInput = $('');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: tmp.split(',')
+ });
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ imgAttr.append(profile);
+
+ // Create boot method dropdown
+ var method = $('');
+ var methodLabel = $('');
+ var methodSelect = $('');
+ methodSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ method.append(methodLabel);
+ method.append(methodSelect);
+ imgAttr.append(method);
- /**
- * Provision existing
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Remove any warning messages
- $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
- var ready = true;
-
- // Get tab ID
- var tabId = $(this).parents('.ui-tabs-panel').attr('id');
-
- // Check if fields are properly filled in
- var inputs = $('#' + tabId + ' input:visible');
- for ( var i = 0; i < inputs.length; i++) {
- if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'storage') {
- inputs.eq(i).css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- inputs.eq(i).css('border', 'solid #BDBDBD 1px');
- }
- }
-
- var selects = $('#' + tabId + ' select:visible');
- for ( var i = 0; i < selects.length; i++) {
- if (!selects.eq(i).val()) {
- selects.eq(i).css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- selects.eq(i).css('border', 'solid #BDBDBD 1px');
- }
- }
-
- if (ready) {
- var inst = tabId.replace('kvmProvisionTab', '');
-
- // Prepend status bar
- var statBar = createStatusBar('kvmProvisionStatBar' + inst);
- statBar.append(createLoader(''));
- statBar.prependTo($('#' + tabId));
-
- var host = $('#' + tabId + ' input[name=host]').val();
- var group = $('#' + tabId + ' select[name=group]').val();
- var node = $('#' + tabId + ' input[name=node]').val();
-
- var memory = $('#' + tabId + ' input[name=memory]').val();
- var cpu = $('#' + tabId + ' select[name=cpu]').val();
- var nic = $('#' + tabId + ' input[name=nic]').val();
- var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
- var storage = $('#' + tabId + ' input[name=storage]').val();
-
- var os = $('#' + tabId + ' input[name=os]').val();
- var arch = $('#' + tabId + ' input[name=arch]').val();
- var profile = $('#' + tabId + ' input[name=profile]').val();
- var boot = $('#' + tabId + ' select[name=bootMethod]').val();
-
- /**
- * (1) Define node
- */
- var args = '-t;node;-o;' + node +
- ';vmhost=' + host +
- ';groups=' + group +
- ';vmmemory=' + memory +
- ';vmcpus=' + cpu +
- ';vmnics=' + nic +
- ';vmstorage=' + storage +
- ';os=' + os +
- ';arch=' + arch +
- ';profile=' + profile +
- ';netboot=xnba' +
- ';nodetype=osi' +
- ';serialport=0' +
- ';serialspeed=115200' +
- ';mgt=esx';
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chdef',
- tgt : '',
- args : args,
- msg : 'cmd=chdef;out=' + inst
- },
+ /**
+ * Provision existing
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // Remove any warning messages
+ $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
+ var ready = true;
+
+ // Get tab ID
+ var tabId = $(this).parents('.ui-tabs-panel').attr('id');
+
+ // Check if fields are properly filled in
+ var inputs = $('#' + tabId + ' input:visible');
+ for ( var i = 0; i < inputs.length; i++) {
+ if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'storage') {
+ inputs.eq(i).css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ inputs.eq(i).css('border', 'solid #BDBDBD 1px');
+ }
+ }
+
+ var selects = $('#' + tabId + ' select:visible');
+ for ( var i = 0; i < selects.length; i++) {
+ if (!selects.eq(i).val()) {
+ selects.eq(i).css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ selects.eq(i).css('border', 'solid #BDBDBD 1px');
+ }
+ }
+
+ if (ready) {
+ var inst = tabId.replace('kvmProvisionTab', '');
+
+ // Prepend status bar
+ var statBar = createStatusBar('kvmProvisionStatBar' + inst);
+ statBar.append(createLoader(''));
+ statBar.prependTo($('#' + tabId));
+
+ var host = $('#' + tabId + ' input[name=host]').val();
+ var group = $('#' + tabId + ' select[name=group]').val();
+ var node = $('#' + tabId + ' input[name=node]').val();
+
+ var memory = $('#' + tabId + ' input[name=memory]').val();
+ var cpu = $('#' + tabId + ' select[name=cpu]').val();
+ var nic = $('#' + tabId + ' input[name=nic]').val();
+ var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
+ var storage = $('#' + tabId + ' input[name=storage]').val();
+
+ var os = $('#' + tabId + ' input[name=os]').val();
+ var arch = $('#' + tabId + ' input[name=arch]').val();
+ var profile = $('#' + tabId + ' input[name=profile]').val();
+ var boot = $('#' + tabId + ' select[name=bootMethod]').val();
+
+ /**
+ * (1) Define node
+ */
+ var args = '-t;node;-o;' + node +
+ ';vmhost=' + host +
+ ';groups=' + group +
+ ';vmmemory=' + memory +
+ ';vmcpus=' + cpu +
+ ';vmnics=' + nic +
+ ';vmstorage=' + storage +
+ ';os=' + os +
+ ';arch=' + arch +
+ ';profile=' + profile +
+ ';netboot=xnba' +
+ ';nodetype=osi' +
+ ';serialport=0' +
+ ';serialspeed=115200' +
+ ';mgt=esx';
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chdef',
+ tgt : '',
+ args : args,
+ msg : 'cmd=chdef;out=' + inst
+ },
- success : updateESXProvisionStatus
- });
- } else {
- // Show warning message
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this).parent().parent());
- }
- });
- provForm.append(provisionBtn);
+ success : updateESXProvisionStatus
+ });
+ } else {
+ // Show warning message
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this).parent().parent());
+ }
+ });
+ provForm.append(provisionBtn);
};
/**
* Load resources
- *
- * @return Nothing
*/
esxPlugin.prototype.loadResources = function() {
- // Get resource tab ID
- var tabId = 'esxResourceTab';
- // Remove loader
- $('#' + tabId).find('img').remove();
-
- // Create info bar
- var infoBar = createInfoBar('Not yet supported');
+ // Get resource tab ID
+ var tabId = 'esxResourceTab';
+ // Remove loader
+ $('#' + tabId).find('img').remove();
+
+ // Create info bar
+ var infoBar = createInfoBar('Not yet supported');
- // Create resource form
- var resrcForm = $('');
- resrcForm.append(infoBar);
-
- $('#' + tabId).append(resrcForm);
+ // Create resource form
+ var resrcForm = $('');
+ resrcForm.append(infoBar);
+
+ $('#' + tabId).append(resrcForm);
};
/**
@@ -531,12 +519,12 @@ esxPlugin.prototype.addNode = function() {
// Create node inputs
dialog.append($(''));
- dialog.append($(''));
- dialog.append($(''));
- dialog.append($(''));
+ dialog.append($(''));
+ dialog.append($(''));
+ dialog.append($(''));
dialog.dialog({
- title: 'Add node',
+ title: 'Add node',
modal: true,
width: 400,
close: function(){$(this).remove();},
@@ -551,7 +539,7 @@ esxPlugin.prototype.addNode = function() {
* Add ESX node
*/
function addEsxNode(){
- var attr, args;
+ var attr, args;
var errorMessage = '';
// Remove existing warnings
@@ -580,17 +568,17 @@ function addEsxNode(){
// Change dialog buttons
$('#addEsx').dialog('option', 'buttons', {
- 'Close':function(){
- $('#addEsx').dialog('close');
- }
+ 'Close':function(){
+ $('#addEsx').dialog('close');
+ }
});
// Generate chdef arguments
args = '-t;node;-o;' + $('#addEsx input[name="node"]').val()
- + ';ip=' + $('#addEsx input[name="ip"]').val()
- + ';groups=' + $('#addEsx input[name="groups"]').val()
- + ';vmhost=' + $('#addEsx input[name="vmhost"]').val()
- + ';mgt=esx;netboot=xnba;nodetype=osi;profile=compute';
+ + ';ip=' + $('#addEsx input[name="ip"]').val()
+ + ';groups=' + $('#addEsx input[name="groups"]').val()
+ + ';vmhost=' + $('#addEsx input[name="vmhost"]').val()
+ + ';mgt=esx;netboot=xnba;nodetype=osi;profile=compute';
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -601,19 +589,19 @@ function addEsxNode(){
msg : ''
},
success: function(data) {
- // Update /etc/hosts
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'makehosts',
- tgt : '',
- args : '',
- msg : ''
- }
- });
-
- // Remove loader
+ // Update /etc/hosts
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'makehosts',
+ tgt : '',
+ args : '',
+ msg : ''
+ }
+ });
+
+ // Remove loader
$('#addEsx img').remove();
// Get return message
@@ -632,112 +620,110 @@ function addEsxNode(){
/**
* Update the provision node status
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function updateESXProvisionStatus(data) {
- // Get ajax response
- var rsp = data.rsp;
- var args = data.msg.split(';');
+ // Get ajax response
+ var rsp = data.rsp;
+ var args = data.msg.split(';');
- // Get command invoked
- var cmd = args[0].replace('cmd=', '');
- // Get provision tab instance
- var inst = args[1].replace('out=', '');
-
- // Get provision tab and status bar ID
- var statBarId = 'kvmProvisionStatBar' + inst;
- var tabId = 'kvmProvisionTab' + inst;
-
- var node = $('#' + tabId + ' input[name=node]').val();
-
- /**
- * (2) Create virtual machine
- */
- if (cmd == 'chdef') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
+ // Get command invoked
+ var cmd = args[0].replace('cmd=', '');
+ // Get provision tab instance
+ var inst = args[1].replace('out=', '');
+
+ // Get provision tab and status bar ID
+ var statBarId = 'kvmProvisionStatBar' + inst;
+ var tabId = 'kvmProvisionTab' + inst;
+
+ var node = $('#' + tabId + ' input[name=node]').val();
+
+ /**
+ * (2) Create virtual machine
+ */
+ if (cmd == 'chdef') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
- // Get parameters
- var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
-
- // Begin installation
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'mkvm',
- tgt : '',
- args : node + ';-s;' + disk,
- msg : 'cmd=mkvm;out=' + inst
- },
+ // Get parameters
+ var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
+
+ // Begin installation
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'mkvm',
+ tgt : '',
+ args : node + ';-s;' + disk,
+ msg : 'cmd=mkvm;out=' + inst
+ },
- success : updateESXProvisionStatus
- });
- }
-
- /**
- * (3) Prepare node for boot
- */
- if (cmd == 'mkvm') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
-
- // Get provision method
- var boot = $('#' + tabId + ' select[name=bootMethod]').val();
-
- // Prepare node for boot
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeset',
- tgt : node,
- args : boot,
- msg : 'cmd=nodeset;out=' + inst
- },
+ success : updateESXProvisionStatus
+ });
+ }
+
+ /**
+ * (3) Prepare node for boot
+ */
+ if (cmd == 'mkvm') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+
+ // Get provision method
+ var boot = $('#' + tabId + ' select[name=bootMethod]').val();
+
+ // Prepare node for boot
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeset',
+ tgt : node,
+ args : boot,
+ msg : 'cmd=nodeset;out=' + inst
+ },
- success : updateESXProvisionStatus
- });
- }
-
- /**
- * (4) Power on node
- */
- if (cmd == 'nodeset') {
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
-
- // Prepare node for boot
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'rpower',
- tgt : node,
- args : 'on',
- msg : 'cmd=rpower;out=' + inst
- },
+ success : updateESXProvisionStatus
+ });
+ }
+
+ /**
+ * (4) Power on node
+ */
+ if (cmd == 'nodeset') {
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+
+ // Prepare node for boot
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'rpower',
+ tgt : node,
+ args : 'on',
+ msg : 'cmd=rpower;out=' + inst
+ },
- success : updateESXProvisionStatus
- });
- }
-
- /**
- * (5) Done
- */
- else if (cmd == 'rpower') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
- $('#' + statBarId).find('img').remove();
-
- // If installation was successful
- if (prg.html().indexOf('Error') == -1) {
- $('#' + statBarId).find('div').append('
It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
');
- }
- }
+ success : updateESXProvisionStatus
+ });
+ }
+
+ /**
+ * (5) Done
+ */
+ else if (cmd == 'rpower') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+ $('#' + statBarId).find('img').remove();
+
+ // If installation was successful
+ if (prg.html().indexOf('Error') == -1) {
+ $('#' + statBarId).find('div').append('
It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
');
+ }
+ }
}
\ No newline at end of file
diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js
index 33e7df115..29de5e6bd 100644
--- a/xCAT-UI/js/custom/hmc.js
+++ b/xCAT-UI/js/custom/hmc.js
@@ -2,7 +2,7 @@
* Execute when the DOM is fully loaded
*/
$(document).ready(function() {
- // Load utility scripts
+ // Load utility scripts
});
/**
@@ -19,45 +19,27 @@ var hmcPlugin = function() {
*
* @return Discovery steps
*/
-hmcPlugin.prototype.getStep = function(){
- return ['Basic patterns',
- 'Supernode',
- 'More patterns',
- 'Power on hardware',
- 'Discover frames',
- 'Management node',
- 'Update definitions',
- 'Create LPARs'];
+hmcPlugin.prototype.getStep = function() {
+ return [ 'Basic patterns', 'Supernode', 'More patterns',
+ 'Power on hardware', 'Discover frames', 'Management node',
+ 'Update definitions', 'Create LPARs' ];
};
-hmcPlugin.prototype.getInitFunction = function(){
- return [powerInitBasicPattern,
- powerInitSupernode,
- powerInitSiteTable,
- powerInitPoweronHardware,
- powerInitDiscoverFrames,
- powerInitConfig,
- powerInitUpdateDefinition,
- powerInitCreateLpar];
+hmcPlugin.prototype.getInitFunction = function() {
+ return [ powerInitBasicPattern, powerInitSupernode, powerInitSiteTable,
+ powerInitPoweronHardware, powerInitDiscoverFrames, powerInitConfig,
+ powerInitUpdateDefinition, powerInitCreateLpar ];
};
-hmcPlugin.prototype.getNextFunction = function(){
- return [checkBasicPattern,
- checkSupernode,
- checkSiteTable,
- undefined,
- checkFrameMtms,
- undefined,
- undefined,
- collectInputValue];
+hmcPlugin.prototype.getNextFunction = function() {
+ return [ checkBasicPattern, checkSupernode, checkSiteTable, undefined,
+ checkFrameMtms, undefined, undefined, collectInputValue ];
};
/**
* Clone node (service page)
*
- * @param node
- * Node to clone
- * @return Nothing
+ * @param node Node to clone
*/
hmcPlugin.prototype.serviceClone = function(node) {
@@ -66,127 +48,122 @@ hmcPlugin.prototype.serviceClone = function(node) {
/**
* Load provision page (service page)
*
- * @param tabId
- * Tab ID where page will reside
- * @return Nothing
+ * @param tabId Tab ID where page will reside
*/
hmcPlugin.prototype.loadServiceProvisionPage = function(tabId) {
-
+
};
/**
* Show node inventory (service page)
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
hmcPlugin.prototype.loadServiceInventory = function(data) {
-
+
};
/**
* Load node inventory
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
hmcPlugin.prototype.loadInventory = function(data) {
- // Get arguments
- 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;
+ // Get arguments
+ 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;
- // Remove loader
- $('#' + tabId).find('img').remove();
+ // Remove loader
+ $('#' + tabId).find('img').remove();
- // Create division to hold inventory
- var invDivId = tabId + 'Inventory';
- var invDiv = $('');
+ // Create division to hold inventory
+ var invDivId = tabId + 'Inventory';
+ var invDiv = $('');
- // Loop through each line
- var fieldSet, legend, oList, item;
- for (var k = 0; k < inv.length; k++) {
- // Remove node name in front
- var str = inv[k].replace(node + ': ', '');
- str = jQuery.trim(str);
+ // Loop through each line
+ var fieldSet = null;
+ var legend = null;
+ var oList = null;
+ var item = null;
+ for (var k = 0; k < inv.length; k++) {
+ // Remove node name in front
+ var str = inv[k].replace(node + ': ', '');
+ str = jQuery.trim(str);
- // If string is a header
- if (str.indexOf('I/O Bus Information') > -1 || str.indexOf('Machine Configuration Info') > -1) {
- // Create a fieldset
- fieldSet = $('');
- legend = $('');
- fieldSet.append(legend);
- oList = $('');
- fieldSet.append(oList);
- invDiv.append(fieldSet);
- } else {
- // If no fieldset is defined
- if (!fieldSet) {
- // Define general fieldset
- fieldSet = $('');
- legend = $('');
- fieldSet.append(legend);
- oList = $('');
- fieldSet.append(oList);
- invDiv.append(fieldSet);
- }
+ // If string is a header
+ if (str.indexOf('I/O Bus Information') > -1
+ || str.indexOf('Machine Configuration Info') > -1) {
+ // Create a fieldset
+ fieldSet = $('');
+ legend = $('');
+ fieldSet.append(legend);
+ oList = $('');
+ fieldSet.append(oList);
+ invDiv.append(fieldSet);
+ } else {
+ // If no fieldset is defined
+ if (!fieldSet) {
+ // Define general fieldset
+ fieldSet = $('');
+ legend = $('');
+ fieldSet.append(legend);
+ oList = $('');
+ fieldSet.append(oList);
+ invDiv.append(fieldSet);
+ }
- // Append the string to a list
- item = $('');
- item.append(str);
- oList.append(item);
- }
- }
+ // Append the string to a list
+ item = $('');
+ item.append(str);
+ oList.append(item);
+ }
+ }
- // Append to inventory form
- $('#' + tabId).append(invDiv);
+ // Append to inventory form
+ $('#' + tabId).append(invDiv);
};
/**
* Load clone page
*
- * @param node
- * Source node to clone
- * @return Nothing
+ * @param node Source node to clone
*/
hmcPlugin.prototype.loadClonePage = function(node) {
- // Get nodes tab
- var tab = getNodesTab();
- var newTabId = node + 'CloneTab';
+ // 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';
- var statBar = $('').hide();
+ // If there is no existing clone tab
+ if (!$('#' + newTabId).length) {
+ // Create status bar and hide it
+ var statBarId = node + 'CloneStatusBar';
+ var statBar = $('')
+ .hide();
- // Create info bar
- var infoBar = createInfoBar('Not yet supported');
+ // Create info bar
+ var infoBar = createInfoBar('Not yet supported');
- // Create clone form
- var cloneForm = $('');
- cloneForm.append(statBar);
- cloneForm.append(infoBar);
+ // Create clone form
+ var cloneForm = $('');
+ cloneForm.append(statBar);
+ cloneForm.append(infoBar);
- // Add clone tab
- tab.add(newTabId, 'Clone', cloneForm, true);
- }
+ // Add clone tab
+ tab.add(newTabId, 'Clone', cloneForm, true);
+ }
- tab.select(newTabId);
+ tab.select(newTabId);
};
/**
* Load provision page
*
- * @param tabId
- * The provision tab ID
- * @return Nothing
+ * @param tabId The provision tab ID
*/
hmcPlugin.prototype.loadProvisionPage = function(tabId) {
// Create provision form
@@ -198,138 +175,144 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) {
// Append to provision tab
$('#' + tabId).append(provForm);
-
+
// Append provisioning section for HMC
appendProvisionSection('hmc', provForm);
};
/**
* Load resources
- *
- * @return Nothing
*/
hmcPlugin.prototype.loadResources = function() {
- // Get resource tab ID
- var tabId = 'hmcResourceTab';
- // Remove loader
- $('#' + tabId).find('img').remove();
+ // Get resource tab ID
+ var tabId = 'hmcResourceTab';
+ // Remove loader
+ $('#' + tabId).find('img').remove();
- // Create info bar
- var infoBar = createInfoBar('Not yet supported');
+ // Create info bar
+ var infoBar = createInfoBar('Not yet supported');
- // Create resource form
- var resrcForm = $('');
- resrcForm.append(infoBar);
+ // Create resource form
+ var resrcForm = $('');
+ resrcForm.append(infoBar);
- $('#' + tabId).append(resrcForm);
+ $('#' + tabId).append(resrcForm);
};
/**
* Add node range
*/
hmcPlugin.prototype.addNode = function() {
- var dialog = $('');
- dialog.append(createInfoBar('Add a System p node range'));
-
- // Create option to select node type
- dialog.append('
' +
- '
');
- dialog.append('');
-
- // Show dialog
- dialog.dialog({
+ var dialog = $('');
+ dialog.append(createInfoBar('Add a System p node range'));
+
+ // Create option to select node type
+ dialog.append('
');
-
- // Empty node settings section
- $('#nodeSettings div').remove();
- if (!results)
- return;
-
- var lines = results.split("\n");
- // Do not continue if no results are found
- if (lines.length < 2) {
- return;
- }
-
- var fields = lines[0].match(tmpRegex);
- var cols = fields.length;
-
- // Add table header
- var tHead = $('').append('
');
- for(var i in fields) {
- tHead.append('
' + fields[i] + '
');
- }
- rTable.append(tHead);
-
- // Add table body
- var tBody = $('');
- rTable.append(tBody);
- for (var i = 1; i < lines.length; i++) {
- var row = $('
');
-
- // Go to next row if there is nothing
- if (!lines[i])
- continue;
-
- fields = lines[i].match(tmpRegex);
-
- // Go to next row if this row is the HMC
- if (fields[0] == 'hmc')
- continue;
-
- // If the 3rd field is empty, create an empty column
- if (!idRegex.test(fields[2]))
- fields = [fields[0], fields[1], ''].concat(fields.slice(2));
- row.append('
');
-
- // Go through each field and add it to the row as a column
- for(var j = 0; j < cols; j++) {
- var col = $('
');
- if (fields[j]) {
- if (j == 1)
- col.append('');
- else
- col.append(fields[j]);
- }
- }
-
- tBody.append(row);
- }
-
- rSection.append(rTable);
- $('#nodeSettings').append(rSection);
+function drawRscanResult(results) {
+ var tmpRegex = /\S+/g;
+ var idRegex = /^\d+$/;
+ var rSection = $('');
+ var rTable = $('
');
+
+ // Empty node settings section
+ $('#nodeSettings div').remove();
+ if (!results)
+ return;
+
+ var lines = results.split("\n");
+ // Do not continue if no results are found
+ if (lines.length < 2) {
+ return;
+ }
+
+ var fields = lines[0].match(tmpRegex);
+ var cols = fields.length;
+
+ // Add table header
+ var tHead = $('').append('
');
+ for (var i in fields) {
+ tHead.append('
' + fields[i] + '
');
+ }
+ rTable.append(tHead);
+
+ // Add table body
+ var tBody = $('');
+ rTable.append(tBody);
+ for (var i = 1; i < lines.length; i++) {
+ var row = $('
');
+
+ // Go to next row if there is nothing
+ if (!lines[i])
+ continue;
+
+ fields = lines[i].match(tmpRegex);
+
+ // Go to next row if this row is the HMC
+ if (fields[0] == 'hmc')
+ continue;
+
+ // If the 3rd field is empty, create an empty column
+ if (!idRegex.test(fields[2]))
+ fields = [ fields[0], fields[1], '' ].concat(fields.slice(2));
+ row.append('
');
+
+ // Go through each field and add it to the row as a column
+ for (var j = 0; j < cols; j++) {
+ var col = $('
');
+ if (fields[j]) {
+ if (j == 1)
+ col.append('');
+ else
+ col.append(fields[j]);
+ }
+ }
+
+ tBody.append(row);
+ }
+
+ rSection.append(rTable);
+ $('#nodeSettings').append(rSection);
}
/**
- * Add System p node, contains frame, cec, lpar
- *
- * @return Nothing
+ * Add System p node (contains frame, CEC, LPAR)
*/
-function addPNode(){
- // Get the HMC name
- var hmcname = $('#nodeSettings select').val();
- var nodename = '';
- // Get checked nodes
- $('#nodeSettings :checked').each(function() {
- if ($(this).attr('name')) {
- nodename += $(this).attr('name') + ',';
- nodename += $(this).parents('tr').find('input').eq(1).val() + ',';
- }
- });
-
- if (!nodename) {
- alert('You should select nodes first!');
- return;
- }
-
- // Disabled the button
- $('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
-
- nodename = nodename.substr(0, nodename.length - 1);
- $('#nodeSettings').append(createLoader());
- // Send the add request
- $.ajax({
- url : 'lib/cmd.php',
+function addPNode() {
+ // Get the HMC name
+ var hmcname = $('#nodeSettings select').val();
+ var nodename = '';
+
+ // Get checked nodes
+ $('#nodeSettings :checked').each(function() {
+ if ($(this).attr('name')) {
+ nodename += $(this).attr('name') + ',';
+ nodename += $(this).parents('tr').find('input').eq(1).val() + ',';
+ }
+ });
+
+ if (!nodename) {
+ alert('You should select nodes first!');
+ return;
+ }
+
+ // Disabled the button
+ $('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
+
+ nodename = nodename.substr(0, nodename.length - 1);
+ $('#nodeSettings').append(createLoader());
+ // Send the add request
+ $.ajax({
+ url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
@@ -509,110 +491,94 @@ function addPNode(){
msg : ''
},
success : function(data) {
- // Refresh the area on the right side
- $('#addHmc').dialog('close');
- $('.selectgroup').trigger('click');
+ // Refresh the area on the right side
+ $('#addHmc').dialog('close');
+ $('.selectgroup').trigger('click');
}
- });
+ });
}
/**
- * Select all checkbox in a table
- *
- * @return Nothing
+ * Select all checkbox in a table
*/
-function selectAllRscanNode(obj){
- var status = $(obj).attr('checked');
- $(obj).parents('table').find(':checkbox').attr('checked', status);
+function selectAllRscanNode(obj) {
+ var status = $(obj).attr('checked');
+ $(obj).parents('table').find(':checkbox').attr('checked', status);
}
/**
- * Step 2: Cluster basic patterns
- * users can input the switches' name range, the number of port, start ip and port prefix
- * hmcs' name range, number and start ip
- * frames' name range, number and start ip
- * drawers' name range, number and start ip
- *
- * @param
- *
- * @return
+ * Step 2: Cluster basic patterns
*/
-function powerInitBasicPattern(){
+function powerInitBasicPattern() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
+
var showString = '
' + steps[currentStep] + '
';
showString += '
';
- //Frame title
+
showString += '
Frames:
';
- //Frame Name
- showString += '
Name Range:
';
- //use the super node configure file to calculate the cec's number
+ showString += '
Name Range:
';
+
+ // Use the super node to configure file and calculate the CEC's number
showString += '
';
- //CEC title
showString += '
Drawers:
';
- //CEC name
- showString += '
Name Range:
';
- //Number of LPARs per Drawer:
- showString += '
Number of LPARs per Drawer:
';
+ showString += '
Name Range:
';
+
+ showString += '
Number of LPARs per Drawer:
';
- //Lpar title
showString += '
Lpars:
';
- //lpar name
- showString += '
Name Range:
';
-
- //hmc title
+ showString += '
Name Range:
';
+
showString += '
HMCs:
';
- //hmc name
- showString += '
Name Range:
';
- //Number of Frames per HMC
- showString += '
Number of Frames per HMC:
';
+ showString += '
Name Range:
';
+
+ showString += '
Number of Frames per HMC:
';
showString += '
Hardware Managment:
HMC ';
showString += 'DFM
';
showString += '
';
-
+
$('#discoverContentDiv').append(showString);
-
+
$('#discoverContentDiv [title]').tooltip({
- position: "center right",
- offset: [-2, 10],
- effect: "fade",
- opacity: 1
+ position : "center right",
+ offset : [ -2, 10 ],
+ effect : "fade",
+ opacity : 1
});
-
- //change the radio inputs' checked status
- if (getDiscoverEnv('hmcFlag')){
+
+ // Change the radio input checked status
+ if (getDiscoverEnv('hmcFlag')) {
$('#discoverContentDiv :radio[value=hmc]').attr('checked', 'checked');
- }
- else{
+ } else {
$('#discoverContentDiv :radio[value=dfm]').attr('checked', 'checked');
}
-
+
createDiscoverButtons();
}
/**
- * Step 2: check basic patterns
- * when user input the basic patterns, we should check if the input is correct.
- * @param
- *
- * @return
+ * Step 2: Check basic patterns when user input the basic patterns
*/
-function checkBasicPattern(operType){
+function checkBasicPattern(operType) {
collectInputValue();
- //click back button, do not need check, only collect input value is ok.
- if ('back' == operType){
+ if ('back' == operType) {
return true;
}
-
+
$('#patternDiv .ui-state-error').remove();
-
+
var errMessage = '';
var tempName = '';
var frameNum = 0;
@@ -622,87 +588,85 @@ function checkBasicPattern(operType){
var cecNumPerFrame = getDiscoverEnv('cecNumPerFrame');
var frameNumPerHmc = getDiscoverEnv('frameNumPerHmc');
var lparNumPerCec = getDiscoverEnv('lparNumPerCec');
-
- //check the frame name
+
+ // Check the frame name
tempName = getDiscoverEnv('frameName');
- if (!tempName){
+ if (!tempName) {
errMessage += 'Input the Frame Name Range. ';
- }
- else{
+ } else {
frameNum = expandNR(tempName).length;
}
-
- //check the cec name
+
+ // Check the CEC name
tempName = getDiscoverEnv('cecName');
- if (!tempName){
+ if (!tempName) {
errMessage += 'Input the CEC Name Range. ';
- }
- else{
+ } else {
cecNum = expandNR(tempName).length;
}
-
- //lpar number per cec
- if (!lparNumPerCec){
+
+ // LPAR number per CEC
+ if (!lparNumPerCec) {
errMessage += 'Input the Lpar Number Per Drawer. ';
}
-
- //check the lpar name
+
+ // Check the LPAR name
tempName = getDiscoverEnv('lparName');
- if (!tempName){
+ if (!tempName) {
errMessage += 'Input the Lpar Name Range. ';
- }
- else{
+ } else {
lparNum = expandNR(tempName).length;
}
-
- //check the hmc name
+
+ // Check the HMC name
tempName = getDiscoverEnv('hmcName');
- if (!tempName){
+ if (!tempName) {
errMessage += 'Input the HMC Name Range. ';
- }
- else{
+ } else {
hmcNum = expandNR(tempName).length;
}
-
- //frame number per hmc
- if (!frameNumPerHmc){
+
+ // Frame number per HMC
+ if (!frameNumPerHmc) {
errMessage += 'Input the Frame Number Per HMC. ';
}
-
- //the hardware management type is hmc.
- if ('hmc' == $('#discoverContentDiv :checked').attr('value')){
+
+ // Hardware management type is HMC
+ if ('hmc' == $('#discoverContentDiv :checked').attr('value')) {
setDiscoverEnv('hmcFlag', true);
- }
- else{
+ } else {
removeDiscoverEnv('hmcFlag');
}
-
- //the input value check is finished.
- if ('' != errMessage){
+
+ // Input value check is finished
+ if ('' != errMessage) {
var warnBar = createWarnBar(errMessage);
$('#patternDiv').prepend(warnBar);
return false;
}
-
- //check the connections between all numbers.
- if (getDiscoverEnv('hmcFlag')){
- if ((Number(frameNumPerHmc) * hmcNum) < frameNum){
- errMessage += 'The frame number should less than ' + Number(cecNumPerFrame) * frameNum +
- ' ("the number of hmc" * "the number of frame managed by per hmc")';
+
+ // Check the connections between all numbers
+ if (getDiscoverEnv('hmcFlag')) {
+ if ((Number(frameNumPerHmc) * hmcNum) < frameNum) {
+ errMessage += 'The frame number should less than '
+ + Number(cecNumPerFrame)
+ * frameNum
+ + ' ("the number of hmc" * "the number of frame managed by per hmc")';
}
}
-
- if ((Number(lparNumPerCec) * cecNum) != lparNum){
- errMessage += 'The number of Lpars calculate by Name Range should be ' + Number(lparNumPerCec) * cecNum +
- '("the number of Drawers" * "the number of lpar per drawer")';
+
+ if ((Number(lparNumPerCec) * cecNum) != lparNum) {
+ errMessage += 'The number of Lpars calculate by Name Range should be '
+ + Number(lparNumPerCec) * cecNum
+ + '("the number of Drawers" * "the number of lpar per drawer")';
}
-
- if ('' != errMessage){
+
+ if ('' != errMessage) {
var warnBar = createWarnBar(errMessage);
$('#patternDiv').prepend(warnBar);
return false;
}
-
+
setDiscoverEnv('cecNum', cecNum);
setDiscoverEnv('frameNum', frameNum);
setDiscoverEnv('lparNum', lparNum);
@@ -711,94 +675,92 @@ function checkBasicPattern(operType){
}
/**
- * Step 3: allowed the users to edit the super node condigure file
- *
- * @param
- *
- * @return
+ * Step 3: Allow the users to edit the super node configure file
*/
-function powerInitSupernode(){
+function powerInitSupernode() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
- $('#discoverContentDiv').append('
' + steps[currentStep] + '
');
+ $('#discoverContentDiv').append(
+ '
'
+ + steps[currentStep] + '
');
createDiscoverButtons();
-
- //add the introduction about the page
+
+ // Add the introduction about the page
var infoStr = '
The supernode-list file lists what supernode numbers should be ';
infoStr += 'given to each CEC in each frame. Here is a sample file: ';
infoStr += 'frame1: 0, 1, 16 frame2: 17, 32 frame3: 33, 48, 49 ';
infoStr += 'frame4: 64 , 65, 80 frame5: 81, 96 frame6: 97(1), 112(1), 113(1), 37(1), 55, 71 ';
- infoStr += 'The name before the colon is the node name of the frame BPC. The numbers after the colon ' +
- 'are the supernode numbers to assign to the groups of CECs in that frame from bottom to top. ' +
- 'Each supernode contains 4 CECs, unless it is immediately followed by "(#)", in which case the ' +
- 'number in parenthesis indicates how many CECs are in this supernode.
';
+ infoStr += 'The name before the colon is the node name of the frame BPC. The numbers after the colon '
+ + 'are the supernode numbers to assign to the groups of CECs in that frame from bottom to top. '
+ + 'Each supernode contains 4 CECs, unless it is immediately followed by "(#)", in which case the '
+ + 'number in parenthesis indicates how many CECs are in this supernode.';
+
var InfoBar = createInfoBar(infoStr);
$('#discoverContentDiv #supernodeDiv').append(InfoBar);
-
+
var frameArray = expandNR(getDiscoverEnv('frameName'));
var showStr = '
';
- for (var i in frameArray){
- showStr += '
' + frameArray[i] + ':
';
+ for (var i in frameArray) {
+ showStr += '
' + frameArray[i]
+ + ':
';
}
+
showStr += '
';
$('#discoverContentDiv #supernodeDiv').append(showStr);
}
/**
- * Step 3: check the super node configure file
- *
- * @param
- *
- * @return
+ * Step 3: Check the super node configure file
*/
-function checkSupernode(operType){
+function checkSupernode(operType) {
collectInputValue();
-
- if ('back' == operType){
+
+ if ('back' == operType) {
return true;
}
-
+
$('#supernodeDiv .ui-state-error').remove();
-
+
var errString = '';
var eceNum = 0;
var args = '';
var frameArray = expandNR(getDiscoverEnv('frameName'));
- for (var i in frameArray){
+ for (var i in frameArray) {
var sp_config = getDiscoverEnv('sp_' + frameArray[i]);
- if (sp_config){
+ if (sp_config) {
eceNum += calcCec(sp_config);
- if (0 == i){
+ if (0 == i) {
args += frameArray[i] + ': ' + sp_config;
- }
- else{
+ } else {
args += '\n' + frameArray[i] + ': ' + sp_config;
}
- }
- else{
- errString += 'Input the super node configure for ' + frameArray[i] + ' ';
+ } else {
+ errString += 'Input the super node configure for ' + frameArray[i]
+ + ' ';
}
}
-
+
args += '\n';
-
+
var warnBar;
- if (errString){
+ if (errString) {
warnBar = createWarnBar(errString);
$('#supernodeDiv').prepend(warnBar);
return false;
}
-
+
var cecArray = expandNR(getDiscoverEnv('cecName'));
- if (eceNum != cecArray.length){
- errString += 'The number of CEC calculated from supernode configure is ' + eceNum + ', but the number ' +
- 'calculated from CECs\' Name Range is ' + cecArray.length + '. Reconfigure the supernode please.';
+ if (eceNum != cecArray.length) {
+ errString += 'The number of CEC calculated from supernode configure is '
+ + eceNum + ', but the number ' + 'calculated from CECs\' Name Range is ' + cecArray.length
+ + '. Reconfigure the supernode please.';
warnBar = createWarnBar(errString);
$('#supernodeDiv').prepend(warnBar);
return false;
}
-
+
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -809,48 +771,44 @@ function checkSupernode(operType){
msg : ''
}
});
-
+
return true;
}
-function calcCec(spConfigStr){
+function calcCec(spConfigStr) {
var tempArray = spConfigStr.split(',');
var num = 0;
var reg = /\(([1-4])\)/;
- for (var i in tempArray){
+ for (var i in tempArray) {
var regRes = reg.exec(tempArray[i]);
- if (regRes && regRes[1]){
+ if (regRes && regRes[1]) {
num += Number(regRes[1]);
- }
- else{
+ } else {
num += 4;
}
}
-
+
return num;
}
/**
- * Step 4: show the field which need to be configured in site table
- *
- * @param
- *
- * @return
+ * Step 4: Show the field which need to be configured in the site table
*/
-function powerInitSiteTable(operType){
+function powerInitSiteTable(operType) {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
- var showDiv = $('
' + steps[currentStep] + '(Site info)
');
+ var showDiv = $('
'
+ + steps[currentStep] + '(Site info)
');
var statBar = createStatusBar('siteTableStat');
statBar.find('div').append(createLoader());
showDiv.append(statBar);
$('#discoverContentDiv').append(showDiv);
-
- if (getDiscoverEnv('domainname')){
+
+ if (getDiscoverEnv('domainname')) {
showSiteArea();
return;
}
-
+
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -860,196 +818,193 @@ function powerInitSiteTable(operType){
args : 'site',
msg : ''
},
-
- success : function(data){
+
+ success : function(data) {
setDiscoverEnv('domainname', '');
- setDiscoverEnv('nameserver','');
- for (var i in data.rsp){
+ setDiscoverEnv('nameserver', '');
+ for (var i in data.rsp) {
var tempArray = data.rsp[i].split(',');
var tempValue = tempArray[1];
- switch (tempArray[0]){
- case '"domain"':{
- setDiscoverEnv('domainname', tempValue.substr(1, tempValue.length - 2));
- }
+ switch (tempArray[0]) {
+ case '"domain"': {
+ setDiscoverEnv('domainname', tempValue.substr(1,
+ tempValue.length - 2));
+ }
break;
- case '"nameservers"':{
- setDiscoverEnv('nameserver', tempValue.substr(1, tempValue.length - 2));
- }
+ case '"nameservers"': {
+ setDiscoverEnv('nameserver', tempValue.substr(1,
+ tempValue.length - 2));
+ }
break;
}
}
showSiteArea();
}
- });
+ });
}
/**
- * Step 4: when the values are ready, create the table
- *
- * @param
- *
- * @return
+ * Step 4: When the values are ready, create the table
*/
-function showSiteArea(){
+function showSiteArea() {
var showString = '
');
}
});
createDiscoverButtons();
}
/**
- * Step 4: check the input are all filled
- *
- * @param
- *
- * @return
+ * Step 4: Check that the inputs are all filled
*/
-function checkSiteTable(operType){
+function checkSiteTable(operType) {
$('#discoverContentDiv input[name=ipStart]').trigger('change');
collectInputValue();
-
- if ('back' == operType){
+
+ if ('back' == operType) {
return true;
}
-
+
$('#discoverContentDiv .ui-state-error').remove();
var errMessage = '';
- if (!getDiscoverEnv('domainname')){
+ if (!getDiscoverEnv('domainname')) {
errMessage += 'Input the domain name. ';
}
-
- if (!getDiscoverEnv('nameserver')){
+
+ if (!getDiscoverEnv('nameserver')) {
errMessage += 'Input the name server. ';
}
-
- if (!getDiscoverEnv('ipEnd')){
+
+ if (!getDiscoverEnv('ipEnd')) {
errMessage += 'Input the DHCP Dynamic Range. ';
}
-
- if ('' == errMessage){
- //update the dynamic ip to xcat db by xcatsetup and run makedhcp
- $.ajax({
+
+ if ('' == errMessage) {
+ $.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
- args : 'dynamiciprange;' + getDiscoverEnv('ipStart') + '-' + getDiscoverEnv('ipEnd'),
+ args : 'dynamiciprange;' + getDiscoverEnv('ipStart') + '-'
+ + getDiscoverEnv('ipEnd'),
msg : ''
}
- });
+ });
return true;
}
-
+
var warnBar = createWarnBar(errMessage);
$('#discoverContentDiv #siteDiv').prepend(warnBar);
return false;
}
/**
- * Step 5: told users to power on machines
- *
- * @param
- *
- * @return
+ * Step 5: Tell users to power on machines
*/
-function powerInitPoweronHardware(){
+function powerInitPoweronHardware() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
- var showStr = '
' + steps[currentStep] +
- '
Do the following manual steps now:
';
+ var showStr = '
' + steps[currentStep]
+ + '
Do the following manual steps now:
';
showStr += '
1. Power on the HMCs.
';
showStr += '
2. Configure the HMC\'s static IP and enable the SLP & SSH ports by HMC GUI
';
showStr += '
3. Power on all of Frames.
';
showStr += '
4. Click Next to discover the hardware on the service network.
';
-
+
$('#discoverContentDiv').append(showStr);
-
+
createDiscoverButtons();
}
/**
- * Step 6: discover all frames from the cluster and map all mtms with frame name
- *
- * @param
- *
- * @return
+ * Step 6: Discover all frames from the cluster and map all MTMs with frame name
*/
-function powerInitDiscoverFrames(){
+function powerInitDiscoverFrames() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
- var showDiv = $('
' + steps[currentStep] + '
');
+ var showDiv = $('
'
+ + steps[currentStep] + '
');
var statBar = createStatusBar('framedisc');
showDiv.append(statBar);
$('#discoverContentDiv').append(showDiv);
- $('#discoverShow').append('
'
+ $('#discoverShow').append('
'
+ '
');
-
- if (getDiscoverEnv('framemtmsmap')){
- $('#framedisc div').html('Mapping the frame name and mtms which discovered by lsslp. ' +
- 'Select the frame name, then select the mtms.');
+
+ if (getDiscoverEnv('framemtmsmap')) {
+ $('#framedisc div').html(
+ 'Mapping the frame name and mtms which discovered by lsslp. '
+ + 'Select the frame name, then select the mtms.');
+
var mapArray = getDiscoverEnv('framemtmsmap').split(';');
- for(var i in mapArray){
+ for (var i in mapArray) {
var tempArray = mapArray[i].split(',');
showMap(tempArray[0], tempArray[1]);
}
-
+
createDiscoverButtons();
return;
}
+
+ statBar.find('div').append('Discovering all Frames by lsslp.').append(
+ createLoader());
- statBar.find('div').append('Discovering all Frames by lsslp.').append(createLoader());
- //use lsslp to find all bpas in cluster
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -1059,133 +1014,149 @@ function powerInitDiscoverFrames(){
args : 'discover;frame',
msg : ''
},
-
- success : function(data){
+
+ success : function(data) {
var tempInfo = data.rsp[0];
- if (-1 != tempInfo.indexOf('Error')){
+ if (-1 != tempInfo.indexOf('Error')) {
$('#framedisc div').html(tempInfo);
createDiscoverButtons();
return;
}
-
+
var mtmsArray = tempInfo.split(';');
var frameArray = expandNR(getDiscoverEnv('frameName'));
- //chech the defined number and discovered number
- if (mtmsArray.length != frameArray.length){
- $('#framedisc div').html('Error: Definded Number is ' + frameArray.length +
- ', but lsslp discovered Number is ' + mtmsArray.length + ', please check your configure!');
+
+ // Check the defined number and discovered number
+ if (mtmsArray.length != frameArray.length) {
+ $('#framedisc div').html(
+ 'Error: Definded Number is ' + frameArray.length
+ + ', but lsslp discovered Number is '
+ + mtmsArray.length
+ + ', please check your configure!');
createDiscoverButtons();
return;
}
-
- $('#framedisc div').html('Mapping the frame name and mtms which discovered by lsslp. ' +
- 'Select the frame name, then select the mtms.');
-
- for (var i in frameArray){
- $('#frameTd').append('
' +
- frameArray[i] + '
');
-
+
+ $('#framedisc div').html(
+ 'Mapping the frame name and mtms which discovered by lsslp. '
+ + 'Select the frame name, then select the mtms.');
+
+ for (var i in frameArray) {
+ $('#frameTd').append(
+ '
'
+ + frameArray[i] + '
');
+
}
-
- for (var i in mtmsArray){
- $('#mtmsTd').append('
' +
- mtmsArray[i] + '
');
+
+ for (var i in mtmsArray) {
+ $('#mtmsTd').append(
+ '
';
-
+
$('#discoverContentDiv').append(showStr);
-
- if ('back' == operType){
+
+ if ('back' == operType) {
createDiscoverButtons();
return;
}
-
+
lsslpWriteFrame();
}
/**
- * Step 8: write all the lsslp -s FRAME info into database
- *
- * @param
- *
- * @return
+ * Step 8: Write all lsslp frame info into the database
*/
-function lsslpWriteFrame(){
+function lsslpWriteFrame() {
$('#frameLine').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
@@ -1386,8 +1352,8 @@ function lsslpWriteFrame(){
args : '-s;FRAME;-w',
msg : ''
},
-
- success : function(){
+
+ success : function() {
$('#frameLine img').remove();
var tempSpan = $('#frameLine').find('span');
tempSpan.removeClass('ui-icon-gear');
@@ -1398,13 +1364,9 @@ function lsslpWriteFrame(){
}
/**
- * Step 8: write all the lsslp -s HMC info into database
- *
- * @param
- *
- * @return
+ * Step 8: Write all the lsslp HMC info into database
*/
-function lsslpWriteHMC(){
+function lsslpWriteHMC() {
$('#hmcLine1').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
@@ -1415,42 +1377,46 @@ function lsslpWriteHMC(){
args : 'discover;hmc',
msg : ''
},
-
- success : function(data){
- //modify the page elements
+
+ success : function(data) {
+ // modify the page elements
$('#hmcLine1 img').remove();
var tempSpan = $('#hmcLine1').find('span');
tempSpan.removeClass('ui-icon-gear');
tempSpan.addClass('ui-icon-check');
$('#hmcLine2').append(createLoader());
-
+
var hmcArray = expandNR(getDiscoverEnv('hmcName'));
var mtmsArray = data.rsp[0].split(';');
var tempPar = '';
-
- if (hmcArray.length != mtmsArray.length){
- //error info
+
+ if (hmcArray.length != mtmsArray.length) {
+ // Error info
$('#hmcLine2 img').remove();
- var warnBar = createWarnBar('Error: Defined ' + hmcArray.length + ' HMCs, but discovered ' + mtmsArray.length +
- ' HMCs. Please check the configuration.');
+ var warnBar = createWarnBar('Error: Defined ' + hmcArray.length
+ + ' HMCs, but discovered ' + mtmsArray.length
+ + ' HMCs. Please check the configuration.');
$('#discoverContentDiv div').prepend(warnBar);
createDiscoverButtons();
return;
}
-
- //create the hmc and mtms pair string
- for (var i in hmcArray){
+
+ // Create the HMC and MTMs pair string
+ for (var i in hmcArray) {
var tPos = mtmsArray[i].lastIndexOf('-');
- var startPos= mtmsArray[i].indexOf(':');
- if ('' == tempPar){
- tempPar += hmcArray[i] + ',' + mtmsArray[i].substring(startPos + 1, tPos) + ',' +mtmsArray[i].substring(tPos + 1);
- }
- else{
- tempPar += ':' + hmcArray[i] + ',' + mtmsArray[i].substring(startPos + 1, tPos) + ',' +mtmsArray[i].substring(tPos + 1);
+ var startPos = mtmsArray[i].indexOf(':');
+ if ('' == tempPar) {
+ tempPar += hmcArray[i] + ','
+ + mtmsArray[i].substring(startPos + 1, tPos) + ','
+ + mtmsArray[i].substring(tPos + 1);
+ } else {
+ tempPar += ':' + hmcArray[i] + ','
+ + mtmsArray[i].substring(startPos + 1, tPos) + ','
+ + mtmsArray[i].substring(tPos + 1);
}
}
-
- //write the mtms and hmcname pair into vpd table
+
+ // Write MTMs and HMC name pair into vpd table
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -1460,8 +1426,8 @@ function lsslpWriteHMC(){
args : 'updatevpd;' + tempPar,
msg : ''
},
- success: function(){
- //run lsslp and write all infomation into datatable
+ success : function() {
+ // Run lsslp and write all info into datatable
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -1471,31 +1437,27 @@ function lsslpWriteHMC(){
args : '-s;HMC;-w',
msg : ''
},
- success: function(){
+ success : function() {
$('#hmcLine2 img').remove();
var tempSpan = $('#hmcLine2').find('span');
tempSpan.removeClass('ui-icon-gear');
tempSpan.addClass('ui-icon-check');
mkhwconnFrame();
}
- });
+ });
}
- });
+ });
}
});
}
/**
- * Step 8: make the hardware connection for frames.
- *
- * @param
- *
- * @return
+ * Step 8: Make the hardware connection for frames
*/
-function mkhwconnFrame(){
- $('#frameLine2').append(createLoader());
- $.ajax({
- url : 'lib/cmd.php',
+function mkhwconnFrame() {
+ $('#frameLine2').append(createLoader());
+ $.ajax({
+ url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'mkhwconn',
@@ -1503,7 +1465,7 @@ function mkhwconnFrame(){
args : '-t',
msg : ''
},
- success: function(){
+ success : function() {
$('#frameLine2 img').remove();
var tempSpan = $('#frameLine2').find('span');
tempSpan.removeClass('ui-icon-gear');
@@ -1514,13 +1476,9 @@ function mkhwconnFrame(){
}
/**
- * Step 8: write all the lsslp -s cec info into database
- *
- * @param
- *
- * @return
+ * Step 8: Write all the lsslp cec info into database
*/
-function lsslpWriteCec(){
+function lsslpWriteCec() {
$('#cecLine').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
@@ -1531,7 +1489,7 @@ function lsslpWriteCec(){
args : '-s;CEC;-w',
msg : ''
},
- success: function(){
+ success : function() {
$('#cecLine img').remove();
var tempSpan = $('#cecLine').find('span');
tempSpan.removeClass('ui-icon-gear');
@@ -1542,13 +1500,9 @@ function lsslpWriteCec(){
}
/**
- * Step 8: make hardware connection for cecs
- *
- * @param
- *
- * @return
+ * Step 8: Make hardware connection for CECs
*/
-function mkhwconnCec(){
+function mkhwconnCec() {
$('#cecLine2').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
@@ -1559,7 +1513,7 @@ function mkhwconnCec(){
args : '-t',
msg : ''
},
- success: function(){
+ success : function() {
$('#cecLine2 img').remove();
var tempSpan = $('#cecLine2').find('span');
tempSpan.removeClass('ui-icon-gear');
@@ -1570,13 +1524,9 @@ function mkhwconnCec(){
}
/**
- * Step 8: create the dhcp configure file
- *
- * @param
- *
- * @return
+ * Step 8: Create the DHCP configure file
*/
-function configDHCP(){
+function configDHCP() {
$('#dhcpLine').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
@@ -1587,8 +1537,8 @@ function configDHCP(){
args : '-n',
msg : ''
},
-
- success : function(){
+
+ success : function() {
$('#dhcpLine img').remove();
var tempSpan = $('#dhcpLine').find('span');
tempSpan.removeClass('ui-icon-gear');
@@ -1599,147 +1549,150 @@ function configDHCP(){
}
/**
- * Step 9: create lpars
- *
- * @param
- *
- * @return
+ * Step 9: Create LPARs
*/
-function powerInitCreateLpar(){
+function powerInitCreateLpar() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
- var showDiv = $('
' + steps[currentStep] + '
');
- switch (getDiscoverEnv('machineType')){
- case 'ih':{
+ var showDiv = $('
'
+ + steps[currentStep] + '
');
+ switch (getDiscoverEnv('machineType')) {
+ case 'ih':
ihCreateLpar(showDiv);
- }
- break;
- case 'nonih':{
+ break;
+ case 'nonih':
nonihCreateLpar(showDiv);
- }
- break;
+ break;
default:
- break;
+ break;
}
+
$('#discoverContentDiv').append(showDiv);
createDiscoverButtons();
}
-function ihCreateLpar(parentDiv){
- var showStr = 'Partition Rule: ' +
- 'If all the octants configuration value are same in one CEC, it will be " -r 0-7:value". ' +
- 'If the octants use the different configuration value in one cec, it will be "-r 0:value1,1:value2,...7:value7", or "-r 0:value1,1-7:value2". ' +
- 'The octants configuration value for one Octant could be 1, 2, 3, 4, 5 . The meanings of the octants configuration value are as following: ' +
- '1 - 1 partition with all cpus and memory of the octant ' +
- '2 - 2 partitions with a 50/50 split of cpus and memory ' +
- '3 - 3 partitions with a 25/25/50 split of cpus and memory ' +
- '4 - 4 partitions with a 25/25/25/25 split of cpus and memory ' +
- '5 - 2 partitions with a 25/75 split of cpus and memory ' +
- 'Define the configuration rule for one CEC, and create all Lpars on all CECs by this rule. Or ignore this step.';
-
+function ihCreateLpar(parentDiv) {
+ var showStr = 'Partition Rule: '
+ + 'If all the octants configuration value are same in one CEC, it will be " -r 0-7:value". '
+ + 'If the octants use the different configuration value in one cec, it will be "-r 0:value1,1:value2,...7:value7", or "-r 0:value1,1-7:value2". '
+ + 'The octants configuration value for one Octant could be 1, 2, 3, 4, 5 . The meanings of the octants configuration value are as following: '
+ + '1 - 1 partition with all cpus and memory of the octant '
+ + '2 - 2 partitions with a 50/50 split of cpus and memory '
+ + '3 - 3 partitions with a 25/25/50 split of cpus and memory '
+ + '4 - 4 partitions with a 25/25/25/25 split of cpus and memory '
+ + '5 - 2 partitions with a 25/75 split of cpus and memory '
+ + 'Define the configuration rule for one CEC, and create all Lpars on all CECs by this rule. Or ignore this step.';
+
parentDiv.append(createInfoBar(showStr));
- parentDiv.append('
Partition Configuration:
' +
- '
');
-
+ parentDiv.append('
Partition Configuration:
'
+ + '
');
+
var lparButton = createButton('Create Lpars');
parentDiv.find('td').eq(2).append(lparButton);
-
- lparButton.bind('click', function(){
- var reg = /(([0-7]|[0-7]-[0-7]):[1-5],)*(([0-7]|[0-7]-[0-7]):[1-5])$/g;
- var lparCount = 0;
- $('#discoverContentDiv .ui-state-error').remove();
- collectInputValue();
- var inputStr = getDiscoverEnv('partconf');
- var testArray = reg.exec(inputStr);
- if (!testArray || inputStr != testArray[0]){
- var warnBar = createWarnBar('Input the correct configuration rule.');
- $('#discoverContentDiv').prepend(warnBar);
- return;
- }
- var ruleArray = inputStr.split(',');
- for (var i in ruleArray){
- var octantCount = 0;
- var octantArray = ruleArray[i].split(':');
- var octantRule = Number(octantArray[1]);
- var pos = octantArray[0].indexOf('-');
- if (5 == octantRule){
- octantRule = 2;
+ lparButton.bind('click',
+ function() {
+ var reg = /(([0-7]|[0-7]-[0-7]):[1-5],)*(([0-7]|[0-7]-[0-7]):[1-5])$/g;
+ var lparCount = 0;
+ $('#discoverContentDiv .ui-state-error').remove();
+ collectInputValue();
+ var inputStr = getDiscoverEnv('partconf');
+ var testArray = reg.exec(inputStr);
+ if (!testArray || inputStr != testArray[0]) {
+ var warnBar = createWarnBar('Input the correct configuration rule.');
+ $('#discoverContentDiv').prepend(warnBar);
+ return;
}
- if (-1 == pos){
- octantCount = 1;
- }
- else{
- var startIndex = Number(octantArray[0].substring(0, pos));
- var endIndex = Number(octantArray[0].substring(pos + 1));
- octantCount = endIndex - startIndex + 1;
- }
-
- lparCount += octantCount * octantRule;
- }
-
- if (getDiscoverEnv('lparNumPerCec') != lparCount){
- var warnBar = createWarnBar('The LPAR number per CEC is ' + getDiscoverEnv('lparNumPerCec') + ', but the configuration ' +
- 'rule calculation is ' + lparCount + '.');
- $('#discoverContentDiv').prepend(warnBar);
- return;
- }
-
- var diaDiv = $('');
- diaDiv.append('
');
- diaDiv.append(createLoader());
- diaDiv.dialog({
- modal: true,
- width: 600,
- title: 'Creating Lpars...'
- });
-
- $('.ui-dialog-titlebar-close').hide();
-
- var cecArray = expandNR(getDiscoverEnv('cecName'));
- for (var i in cecArray){
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'mkvm',
- tgt : cecArray[i] + 'nodes',
- args : '-i;1;-m;non-interleaved;-r;' + inputStr,
- msg : cecArray[i] + ';' + cecArray.length
- },
-
- success : function(data) {
- //update the dialogure
- var tempArray = data.msg.split(';');
- updateCreateLparDia(tempArray[0], Number(tempArray[1]));
+ var ruleArray = inputStr.split(',');
+ for (var i in ruleArray) {
+ var octantCount = 0;
+ var octantArray = ruleArray[i].split(':');
+ var octantRule = Number(octantArray[1]);
+ var pos = octantArray[0].indexOf('-');
+ if (5 == octantRule) {
+ octantRule = 2;
}
+
+ if (-1 == pos) {
+ octantCount = 1;
+ } else {
+ var startIndex = Number(octantArray[0]
+ .substring(0, pos));
+ var endIndex = Number(octantArray[0]
+ .substring(pos + 1));
+ octantCount = endIndex - startIndex + 1;
+ }
+
+ lparCount += octantCount * octantRule;
+ }
+
+ if (getDiscoverEnv('lparNumPerCec') != lparCount) {
+ var warnBar = createWarnBar('The LPAR number per CEC is '
+ + getDiscoverEnv('lparNumPerCec')
+ + ', but the configuration '
+ + 'rule calculation is ' + lparCount + '.');
+ $('#discoverContentDiv').prepend(warnBar);
+ return;
+ }
+
+ var diaDiv = $('');
+ diaDiv.append('
All lpars are created. You must: 1. reboot the all CECS. '+
- '2.use chvm to assign the I/O slots to the new LPAR.
');
-
+ $('#createLparDiv').append('
All lpars are created. You must: 1. reboot the all CECS. '
+ + '2.use chvm to assign the I/O slots to the new LPAR.
');
+
var chvmButton = createButton('OK');
$('#createLparDiv').append(chvmButton);
- chvmButton.bind('click', function(){
+ chvmButton.bind('click', function() {
$('#createLparDiv').dialog('destroy');
$('#createLparDiv').remove();
});
}
-function nonihCreateLpar(parentDiv){
+function nonihCreateLpar(parentDiv) {
var showStr = 'The machine type is not P7 IH, so you had to create lpars by command line manually.';
parentDiv.append(createInfoBar(showStr));
return;
diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js
index 7fb21ac3e..86d7d476b 100644
--- a/xCAT-UI/js/custom/ipmi.js
+++ b/xCAT-UI/js/custom/ipmi.js
@@ -2,13 +2,11 @@
* Execute when the DOM is fully loaded
*/
$(document).ready(function() {
- // Load utility scripts (if any)
+ // Load utility scripts (if any)
});
/**
* Constructor
- *
- * @return Nothing
*/
var ipmiPlugin = function() {
@@ -19,29 +17,28 @@ var ipmiPlugin = function() {
*
* @return Discovery steps
*/
-ipmiPlugin.prototype.getStep = function(){
- return ['Basic patterns', 'Switches', 'Network', 'Services', 'Power on hardware'];
+ipmiPlugin.prototype.getStep = function() {
+ return [ 'Basic patterns', 'Switches', 'Network', 'Services',
+ 'Power on hardware' ];
};
/**
- * return steps's init function for hardware discovery wizard
- *
- * @return Nothing
+ * Return step init function for hardware discovery wizard
*/
-ipmiPlugin.prototype.getInitFunction = function(){
- return [idataplexInitBasic, idataplexInitSwitch, idataplexInitNetwork, idataplexInitService, idataplexInitPowerOn];
+ipmiPlugin.prototype.getInitFunction = function() {
+ return [ idataplexInitBasic, idataplexInitSwitch, idataplexInitNetwork,
+ idataplexInitService, idataplexInitPowerOn ];
};
-ipmiPlugin.prototype.getNextFunction = function(){
- return [idataplexCheckBasic, undefined, idataplexCheckNetwork, undefined, undefined];
+ipmiPlugin.prototype.getNextFunction = function() {
+ return [ idataplexCheckBasic, undefined, idataplexCheckNetwork, undefined,
+ undefined ];
};
/**
* Clone node (service page)
*
- * @param node
- * Node to clone
- * @return Nothing
+ * @param node Node to clone
*/
ipmiPlugin.prototype.serviceClone = function(node) {
@@ -50,171 +47,161 @@ ipmiPlugin.prototype.serviceClone = function(node) {
/**
* Load provision page (service page)
*
- * @param tabId
- * Tab ID where page will reside
- * @return Nothing
+ * @param tabId Tab ID where page will reside
*/
ipmiPlugin.prototype.loadServiceProvisionPage = function(tabId) {
-
+
};
/**
* Show node inventory (service page)
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
ipmiPlugin.prototype.loadServiceInventory = function(data) {
-
+
};
/**
* Load node inventory
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
ipmiPlugin.prototype.loadInventory = function(data) {
- var args = data.msg.split(',');
- var tabId = args[0].replace('out=', '');
- var node = args[1].replace('node=', '');
-
- // Get node inventory
- var inv = data.rsp;
+ var args = data.msg.split(',');
+ var tabId = args[0].replace('out=', '');
+ var node = args[1].replace('node=', '');
- // Remove loader
- $('#' + tabId).find('img').remove();
+ // Get node inventory
+ var inv = data.rsp;
- // Create division to hold inventory
- var invDiv = $('');
-
- // Create a fieldset
- var fieldSet = $('');
- var legend = $('');
- fieldSet.append(legend);
-
- var oList = $('');
- fieldSet.append(oList);
- invDiv.append(fieldSet);
+ // Remove loader
+ $('#' + tabId).find('img').remove();
- // Loop through each line
- var item;
- for (var k = 0; k < inv.length; k++) {
- // Remove node name
- var attr = inv[k].replace(node + ': ', '');
- attr = jQuery.trim(attr);
+ // Create division to hold inventory
+ var invDiv = $('');
- // Append attribute to list
- item = $('');
- item.append(attr);
- oList.append(item);
- }
+ // Create a fieldset
+ var fieldSet = $('');
+ var legend = $('');
+ fieldSet.append(legend);
- // Append to inventory form
- $('#' + tabId).append(invDiv);
+ var oList = $('');
+ fieldSet.append(oList);
+ invDiv.append(fieldSet);
+
+ // Loop through each line
+ var item;
+ for ( var k = 0; k < inv.length; k++) {
+ // Remove node name
+ var attr = inv[k].replace(node + ': ', '');
+ attr = jQuery.trim(attr);
+
+ // Append attribute to list
+ item = $('');
+ item.append(attr);
+ oList.append(item);
+ }
+
+ // Append to inventory form
+ $('#' + tabId).append(invDiv);
};
/**
* Load clone page
*
- * @param node
- * Source node to clone
- * @return Nothing
+ * @param node Source node to clone
*/
ipmiPlugin.prototype.loadClonePage = function(node) {
- // Get nodes tab
- var tab = getNodesTab();
- var newTabId = node + 'CloneTab';
+ // Get nodes tab
+ var tab = getNodesTab();
+ var newTabId = node + 'CloneTab';
- // If there is no existing clone tab
- if (!$('#' + newTabId).length) {
- // Create info bar
- var infoBar = createInfoBar('Not supported');
+ // If there is no existing clone tab
+ if (!$('#' + newTabId).length) {
+ // Create info bar
+ var infoBar = createInfoBar('Not supported');
- // Create clone form
- var cloneForm = $('');
- cloneForm.append(infoBar);
+ // Create clone form
+ var cloneForm = $('');
+ cloneForm.append(infoBar);
- // Add clone tab
- tab.add(newTabId, 'Clone', cloneForm, true);
- }
-
- tab.select(newTabId);
+ // Add clone tab
+ tab.add(newTabId, 'Clone', cloneForm, true);
+ }
+
+ tab.select(newTabId);
};
/**
* Load provision page
*
- * @param tabId
- * The provision tab ID
- * @return Nothing
+ * @param tabId The provision tab ID
*/
ipmiPlugin.prototype.loadProvisionPage = function(tabId) {
- // Get OS image names
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'osimage',
- msg : ''
- },
+ // Get OS image names
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'osimage',
+ msg : ''
+ },
- success : setOSImageCookies
- });
+ success : setOSImageCookies
+ });
- // Get groups
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'extnoderange',
- tgt : '/.*',
- args : 'subgroups',
- msg : ''
- },
+ // Get groups
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'extnoderange',
+ tgt : '/.*',
+ args : 'subgroups',
+ msg : ''
+ },
- success : setGroupsCookies
- });
+ success : setGroupsCookies
+ });
- // Get provision tab instance
- var inst = tabId.replace('ipmiProvisionTab', '');
+ // Get provision tab instance
+ var inst = tabId.replace('ipmiProvisionTab', '');
- // Create provision form
- var provForm = $('');
+ // Create provision form
+ var provForm = $('');
- // Create info bar
- var infoBar = createInfoBar('Provision an iDataPlex. This will install an operating system onto the iDataPlex.');
- provForm.append(infoBar);
+ // Create info bar
+ var infoBar = createInfoBar('Provision an iDataPlex. This will install an operating system onto the iDataPlex.');
+ provForm.append(infoBar);
- // Append to provision tab
- $('#' + tabId).append(provForm);
+ // Append to provision tab
+ $('#' + tabId).append(provForm);
- // Create provision existing node division
- var provExisting = createIpmiProvisionExisting(inst);
- provForm.append(provExisting);
+ // Create provision existing node division
+ var provExisting = createIpmiProvisionExisting(inst);
+ provForm.append(provExisting);
};
/**
* Load resources
*/
ipmiPlugin.prototype.loadResources = function() {
- // Get resource tab ID
- var tabId = 'ipmiResourceTab';
- // Remove loader
- $('#' + tabId).find('img').remove();
-
- // Create info bar
- var infoBar = createInfoBar('Not yet supported');
+ // Get resource tab ID
+ var tabId = 'ipmiResourceTab';
+ // Remove loader
+ $('#' + tabId).find('img').remove();
- // Create resource form
- var resrcForm = $('');
- resrcForm.append(infoBar);
-
- $('#' + tabId).append(resrcForm);
+ // Create info bar
+ var infoBar = createInfoBar('Not yet supported');
+
+ // Create resource form
+ var resrcForm = $('');
+ resrcForm.append(infoBar);
+
+ $('#' + tabId).append(resrcForm);
};
/**
@@ -224,21 +211,31 @@ ipmiPlugin.prototype.addNode = function() {
var dialog = $('');
var info = createInfoBar('Add a iDataPlex node');
dialog.append(info);
-
+
// Create node inputs
- dialog.append($(''));
- dialog.append($(''));
- dialog.append($(''));
- dialog.append($(''));
+ dialog
+ .append($(''));
+ dialog
+ .append($(''));
+ dialog
+ .append($(''));
+ dialog
+ .append($(''));
dialog.dialog({
- title: 'Add node',
- modal: true,
- width: 400,
- close: function(){$(this).remove();},
- buttons: {
- "OK" : function(){addIdataplex();},
- "Cancel": function(){$(this).dialog('close');}
+ title : 'Add node',
+ modal : true,
+ width : 400,
+ close : function() {
+ $(this).remove();
+ },
+ buttons : {
+ "OK" : function() {
+ addIdataplex();
+ },
+ "Cancel" : function() {
+ $(this).dialog('close');
+ }
}
});
};
@@ -246,47 +243,47 @@ ipmiPlugin.prototype.addNode = function() {
/**
* Add iDataPlex node range
*/
-function addIdataplex(){
- var attr, args;
+function addIdataplex() {
+ var attr, args;
var errorMessage = '';
-
+
// Remove existing warnings
$('#addIdplx .ui-state-error').remove();
-
+
// Return input border colors to normal
$('#addIdplx input').css('border', 'solid #BDBDBD 1px');
-
+
// Check node attributes
- $('#addIdplx input').each(function(){
+ $('#addIdplx input').each(function() {
attr = $(this).val();
if (!attr) {
errorMessage = "Please provide a value for each missing field!";
$(this).css('border', 'solid #FF0000 1px');
}
});
-
+
// Show error message (if any)
if (errorMessage) {
$('#addIdplx').prepend(createWarnBar(errorMessage));
return;
}
-
+
// Create loader
$('#addIdplx').append(createLoader());
-
+
// Change dialog buttons
$('#addIdplx').dialog('option', 'buttons', {
- 'Close':function(){
- $('#addIdplx').dialog('close');
- }
+ 'Close' : function() {
+ $('#addIdplx').dialog('close');
+ }
});
-
+
// Generate chdef arguments
- args = '-t;node;-o;' + $('#addIdplx input[name="node"]').val()
- + ';ip=' + $('#addIdplx input[name="ip"]').val()
- + ';mac=' + $('#addIdplx input[name="mac"]').val()
- + ';groups=' + $('#addIdplx input[name="groups"]').val()
- + ';mgt=ipmi;netboot=xnba;nodetype=osi;profile=compute';
+ args = '-t;node;-o;' + $('#addIdplx input[name="node"]').val() + ';ip='
+ + $('#addIdplx input[name="ip"]').val() + ';mac='
+ + $('#addIdplx input[name="mac"]').val() + ';groups='
+ + $('#addIdplx input[name="groups"]').val()
+ + ';mgt=ipmi;netboot=xnba;nodetype=osi;profile=compute';
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -296,28 +293,28 @@ function addIdataplex(){
args : args,
msg : ''
},
- success: function(data) {
- // Update /etc/hosts
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'makehosts',
- tgt : '',
- args : '',
- msg : ''
- }
- });
-
- // Remove loader
+ success : function(data) {
+ // Update /etc/hosts
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'makehosts',
+ tgt : '',
+ args : '',
+ msg : ''
+ }
+ });
+
+ // Remove loader
$('#addIdplx img').remove();
-
+
// Get return message
var message = '';
- for (var i in data.rsp) {
+ for ( var i in data.rsp) {
message += data.rsp[i] + ' ';
}
-
+
// Show return message
if (message)
$('#addIdplx').prepend(createInfoBar(message));
@@ -328,411 +325,416 @@ function addIdataplex(){
/**
* Create provision existing node division
*
- * @param inst
- * Provision tab instance
+ * @param inst Provision tab instance
* @return Provision existing node division
*/
function createIpmiProvisionExisting(inst) {
- // Create provision existing division
- var provExisting = $('');
+ // Create provision existing division
+ var provExisting = $('');
- // Create node fieldset
- var nodeFS = $('');
- var nodeLegend = $('');
- nodeFS.append(nodeLegend);
-
- var nodeAttr = $('');
- nodeFS.append($('
'));
- nodeFS.append(nodeAttr);
-
- // Create image fieldset
- var imgFS = $('');
- var imgLegend = $('');
- imgFS.append(imgLegend);
-
- var imgAttr = $('');
- imgFS.append($('
'));
- imgFS.append(imgAttr);
-
- provExisting.append(nodeFS, imgFS);
-
- // Create group input
- var group = $('');
- var groupLabel = $('');
- group.append(groupLabel);
+ // Create node fieldset
+ var nodeFS = $('');
+ var nodeLegend = $('');
+ nodeFS.append(nodeLegend);
- // Turn on auto complete for group
- var dTableDivId = 'ipmiNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
- var groupNames = $.cookie('groups');
- if (groupNames) {
- // Split group names into an array
- var tmp = groupNames.split(',');
+ var nodeAttr = $('');
+ nodeFS
+ .append($('
'));
+ nodeFS.append(nodeAttr);
- // Create drop down for groups
- var groupSelect = $('');
- groupSelect.append('');
- for ( var i in tmp) {
- // Add group into drop down
- var opt = $('');
- groupSelect.append(opt);
- }
- group.append(groupSelect);
+ // Create image fieldset
+ var imgFS = $('');
+ var imgLegend = $('');
+ imgFS.append(imgLegend);
- // 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);
- }
- nodeAttr.append(group);
+ var imgAttr = $('');
+ imgFS
+ .append($('
'));
+ imgFS.append(imgAttr);
- // Create node input
- var node = $('');
- var nodeLabel = $('');
- var nodeDatatable = $('
Select a group to view its nodes
');
- node.append(nodeLabel);
- node.append(nodeDatatable);
- nodeAttr.append(node);
+ provExisting.append(nodeFS, imgFS);
- // Create boot method drop down
- var method = $('');
- var methodLabel = $('');
- var methodSelect = $('');
- methodSelect.append(''
- + ''
- + ''
- + ''
- + ''
- + ''
- );
- method.append(methodLabel);
- method.append(methodSelect);
- imgAttr.append(method);
-
- // Create operating system input
- var os = $('');
- var osLabel = $('');
- var osInput = $('');
- osInput.one('focus', function() {
- var tmp = $.cookie('osvers');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- os.append(osLabel);
- os.append(osInput);
- imgAttr.append(os);
+ // Create group input
+ var group = $('');
+ var groupLabel = $('');
+ group.append(groupLabel);
- // Create architecture input
- var arch = $('');
- var archLabel = $('');
- var archInput = $('');
- archInput.one('focus', function() {
- var tmp = $.cookie('osarchs');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- arch.append(archLabel);
- arch.append(archInput);
- imgAttr.append(arch);
+ // Turn on auto complete for group
+ var dTableDivId = 'ipmiNodesDatatableDIV' + inst; // Division ID where
+ // nodes datatable will
+ // be appended
+ var groupNames = $.cookie('groups');
+ if (groupNames) {
+ // Split group names into an array
+ var tmp = groupNames.split(',');
- // Create profile input
- var profile = $('');
- var profileLabel = $('');
- var profileInput = $('');
- profileInput.one('focus', function() {
- var tmp = $.cookie('profiles');
- if (tmp) {
- // Turn on auto complete
- $(this).autocomplete({
- source: tmp.split(',')
- });
- }
- });
- profile.append(profileLabel);
- profile.append(profileInput);
- imgAttr.append(profile);
+ // Create drop down for groups
+ var groupSelect = $('');
+ groupSelect.append('');
+ for ( var i in tmp) {
+ // Add group into drop down
+ var opt = $('');
+ groupSelect.append(opt);
+ }
+ group.append(groupSelect);
- /**
- * Provision existing
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Remove any warning messages
- $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
- var ready = true;
- var errorMessage = '';
+ // 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);
+ }
+ nodeAttr.append(group);
- // Get provision tab ID
- var thisTabId = 'ipmiProvisionTab' + inst;
-
- // Get nodes that were checked
- var dTableId = 'ipmiNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
- if (!tgts) {
- errorMessage += 'You need to select a node. ';
- ready = false;
- }
-
- // Check booth method
- var boot = $('#' + thisTabId + ' select[name=bootMethod]');
- if (!boot.val()) {
- errorMessage += 'You need to select a boot method. ';
- boot.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- boot.css('border', 'solid #BDBDBD 1px');
- }
-
- // Check operating system image
- var os = $('#' + thisTabId + ' input[name=os]');
- if (!os.val()) {
- errorMessage += 'You need to select a operating system image. ';
- os.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- os.css('border', 'solid #BDBDBD 1px');
- }
-
- // Check architecture
- var arch = $('#' + thisTabId + ' input[name=arch]');
- if (!arch.val()) {
- errorMessage += 'You need to select an architecture. ';
- arch.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- arch.css('border', 'solid #BDBDBD 1px');
- }
-
- // Check profile
- var profile = $('#' + thisTabId + ' input[name=profile]');
- if (!profile.val()) {
- errorMessage += 'You need to select a profile. ';
- profile.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- profile.css('border', 'solid #BDBDBD 1px');
- }
-
- // If all inputs are valid, ready to provision
- if (ready) {
- // Disable provision button
- $(this).attr('disabled', 'true');
-
- // Prepend status bar
- var statBar = createStatusBar('ipmiProvisionStatBar' + inst);
- statBar.append(createLoader(''));
- statBar.prependTo($('#' + thisTabId));
+ // Create node input
+ var node = $('');
+ var nodeLabel = $('');
+ var nodeDatatable = $('
Select a group to view its nodes
');
+ node.append(nodeLabel);
+ node.append(nodeDatatable);
+ nodeAttr.append(node);
- // Disable all inputs
- var inputs = $('#' + thisTabId + ' input');
- inputs.attr('disabled', 'disabled');
-
- // Disable all selects
- var selects = $('#' + thisTabId + ' select');
- selects.attr('disabled', 'disabled');
-
- /**
- * (1) Set operating system
- */
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeadd',
- tgt : '',
- args : tgts + ';noderes.netboot=xnba;nodetype.os=' + os.val() + ';nodetype.arch=' + arch.val() + ';nodetype.profile=' + profile.val() + ';nodetype.provmethod=' + boot.val(),
- msg : 'cmd=nodeadd;out=' + inst
- },
+ // Create boot method drop down
+ var method = $('');
+ var methodLabel = $('');
+ var methodSelect = $('');
+ methodSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ + '');
+ method.append(methodLabel);
+ method.append(methodSelect);
+ imgAttr.append(method);
- success : updateIpmiProvisionExistingStatus
- });
- } else {
- // Show warning message
- var warn = createWarnBar(errorMessage);
- warn.prependTo($(this).parent().parent());
- }
- });
- provExisting.append(provisionBtn);
+ // Create operating system input
+ var os = $('');
+ var osLabel = $('');
+ var osInput = $('');
+ osInput.one('focus', function() {
+ var tmp = $.cookie('osvers');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source : tmp.split(',')
+ });
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ imgAttr.append(os);
- return provExisting;
+ // Create architecture input
+ var arch = $('');
+ var archLabel = $('');
+ var archInput = $('');
+ archInput.one('focus', function() {
+ var tmp = $.cookie('osarchs');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source : tmp.split(',')
+ });
+ }
+ });
+ arch.append(archLabel);
+ arch.append(archInput);
+ imgAttr.append(arch);
+
+ // Create profile input
+ var profile = $('');
+ var profileLabel = $('');
+ var profileInput = $('');
+ profileInput.one('focus', function() {
+ var tmp = $.cookie('profiles');
+ if (tmp) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source : tmp.split(',')
+ });
+ }
+ });
+ profile.append(profileLabel);
+ profile.append(profileInput);
+ imgAttr.append(profile);
+
+ /**
+ * Provision existing
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // Remove any warning messages
+ $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
+ var ready = true;
+ var errorMessage = '';
+
+ // Get provision tab ID
+ var thisTabId = 'ipmiProvisionTab' + inst;
+
+ // Get nodes that were checked
+ var dTableId = 'ipmiNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+ if (!tgts) {
+ errorMessage += 'You need to select a node. ';
+ ready = false;
+ }
+
+ // Check booth method
+ var boot = $('#' + thisTabId + ' select[name=bootMethod]');
+ if (!boot.val()) {
+ errorMessage += 'You need to select a boot method. ';
+ boot.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ boot.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check operating system image
+ var os = $('#' + thisTabId + ' input[name=os]');
+ if (!os.val()) {
+ errorMessage += 'You need to select a operating system image. ';
+ os.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ os.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check architecture
+ var arch = $('#' + thisTabId + ' input[name=arch]');
+ if (!arch.val()) {
+ errorMessage += 'You need to select an architecture. ';
+ arch.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ arch.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Check profile
+ var profile = $('#' + thisTabId + ' input[name=profile]');
+ if (!profile.val()) {
+ errorMessage += 'You need to select a profile. ';
+ profile.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ profile.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // If all inputs are valid, ready to provision
+ if (ready) {
+ // Disable provision button
+ $(this).attr('disabled', 'true');
+
+ // Prepend status bar
+ var statBar = createStatusBar('ipmiProvisionStatBar' + inst);
+ statBar.append(createLoader(''));
+ statBar.prependTo($('#' + thisTabId));
+
+ // Disable all inputs
+ var inputs = $('#' + thisTabId + ' input');
+ inputs.attr('disabled', 'disabled');
+
+ // Disable all selects
+ var selects = $('#' + thisTabId + ' select');
+ selects.attr('disabled', 'disabled');
+
+ /**
+ * (1) Set operating system
+ */
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeadd',
+ tgt : '',
+ args : tgts + ';noderes.netboot=xnba;nodetype.os='
+ + os.val() + ';nodetype.arch=' + arch.val()
+ + ';nodetype.profile=' + profile.val()
+ + ';nodetype.provmethod=' + boot.val(),
+ msg : 'cmd=nodeadd;out=' + inst
+ },
+
+ success : updateIpmiProvisionExistingStatus
+ });
+ } else {
+ // Show warning message
+ var warn = createWarnBar(errorMessage);
+ warn.prependTo($(this).parent().parent());
+ }
+ });
+ provExisting.append(provisionBtn);
+
+ return provExisting;
}
/**
* Update the provision existing node status
*
- * @param data
- * Data returned from HTTP request
- * @return Nothing
+ * @param data Data returned from HTTP request
*/
function updateIpmiProvisionExistingStatus(data) {
- // Get ajax response
- var rsp = data.rsp;
- var args = data.msg.split(';');
+ // Get ajax response
+ var rsp = data.rsp;
+ var args = data.msg.split(';');
- // Get command invoked
- var cmd = args[0].replace('cmd=', '');
- // Get provision tab instance
- var inst = args[1].replace('out=', '');
-
- // Get provision tab and status bar ID
- var statBarId = 'ipmiProvisionStatBar' + inst;
- var tabId = 'ipmiProvisionTab' + inst;
-
- /**
- * (2) Remote install
- */
- if (cmd == 'nodeadd') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
+ // Get command invoked
+ var cmd = args[0].replace('cmd=', '');
+ // Get provision tab instance
+ var inst = args[1].replace('out=', '');
- // Get parameters
- var os = $('#' + tabId + ' input[name="os"]').val();
- var profile = $('#' + tabId + ' input[name="profile"]').val();
- var arch = $('#' + tabId + ' input[name="arch"]').val();
-
- // Get nodes that were checked
- var dTableId = 'ipmiNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
-
- // Begin installation
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'rinstall;' + os + ';' + profile + ';' + arch + ';' + tgts,
- msg : 'cmd=rinstall;out=' + inst
- },
+ // Get provision tab and status bar ID
+ var statBarId = 'ipmiProvisionStatBar' + inst;
+ var tabId = 'ipmiProvisionTab' + inst;
- success : updateIpmiProvisionExistingStatus
- });
- }
-
- /**
- * (3) Done
- */
- else if (cmd == 'rinstall') {
- // Write ajax response to status bar
- var prg = writeRsp(rsp, '');
- $('#' + statBarId).find('div').append(prg);
- $('#' + statBarId).find('img').remove();
-
- // If installation was successful
- if (prg.html().indexOf('Error') == -1) {
- $('#' + statBarId).find('div').append('
It will take several minutes before the nodes are up and ready. Use nodestat to check the status of the install.
');
- }
- }
+ /**
+ * (2) Remote install
+ */
+ if (cmd == 'nodeadd') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+
+ // Get parameters
+ var os = $('#' + tabId + ' input[name="os"]').val();
+ var profile = $('#' + tabId + ' input[name="profile"]').val();
+ var arch = $('#' + tabId + ' input[name="arch"]').val();
+
+ // Get nodes that were checked
+ var dTableId = 'ipmiNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+
+ // Begin installation
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'rinstall;' + os + ';' + profile + ';' + arch + ';'
+ + tgts,
+ msg : 'cmd=rinstall;out=' + inst
+ },
+
+ success : updateIpmiProvisionExistingStatus
+ });
+ }
+
+ /**
+ * (3) Done
+ */
+ else if (cmd == 'rinstall') {
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, '');
+ $('#' + statBarId).find('div').append(prg);
+ $('#' + statBarId).find('img').remove();
+
+ // If installation was successful
+ if (prg.html().indexOf('Error') == -1) {
+ $('#' + statBarId)
+ .find('div')
+ .append(
+ '
It will take several minutes before the nodes are up and ready. Use nodestat to check the status of the install.
';
-
+
$('#discoverContentDiv').append(showString);
-
+
$('#discoverContentDiv [title]').tooltip({
- position: "center right",
- offset: [-2, 10],
- effect: "fade",
- opacity: 1
+ position : "center right",
+ offset : [ -2, 10 ],
+ effect : "fade",
+ opacity : 1
});
-
+
createDiscoverButtons();
}
/**
- * step 2: collect and check the basic pattern input on page.
+ * Step 2: Collect and check the basic pattern input
*
- * @param
- *
- * @return false: the input contains error, can not go to next step
- * true : the input are correct, go to the next step
+ * @param operType Operating type
+ * @return True if the inputs are correct, false otherwise
*/
-function idataplexCheckBasic(operType){
+function idataplexCheckBasic(operType) {
collectInputValue();
- //click back button, do not need check, only collect input value is ok.
- if ('back' == operType){
+ if ('back' == operType) {
return true;
}
-
+
$('#patternDiv .ui-state-error').remove();
var errMessage = '';
var nodename = getDiscoverEnv('idataplexnodename');
@@ -743,65 +745,64 @@ function idataplexCheckBasic(operType){
var switchip = getDiscoverEnv('idataplexswitchip');
var nodesperswitch = getDiscoverEnv('idataplexperswitch');
var nodesperframe = getDiscoverEnv('idataplexperframe');
-
- //all fields should input
- if (!nodename){
+
+ if (!nodename) {
errMessage += 'Input the Nodes name. ';
}
-
- if (!verifyIp(nodeip)){
+
+ if (!verifyIp(nodeip)) {
errMessage += 'Input valid Nodes start ip. ';
}
-
- if (!bmcname){
+
+ if (!bmcname) {
errMessage += 'Input the BMC name. ';
}
-
- if (!verifyIp(bmcip)){
+
+ if (!verifyIp(bmcip)) {
errMessage += 'Input valid BMC start ip. ';
}
-
- if (!switchname){
+
+ if (!switchname) {
errMessage += 'Input the switch name. ';
}
-
- if (!verifyIp(switchip)){
+
+ if (!verifyIp(switchip)) {
errMessage += 'Input valid switch start ip. ';
}
-
- if (!nodesperswitch){
+
+ if (!nodesperswitch) {
errMessage += 'Input the nodes number per switch. ';
}
-
- if (!nodesperframe){
+
+ if (!nodesperframe) {
errMessage += 'Input the nodes number per frame. ';
}
-
- if ('' != errMessage){
+
+ if ('' != errMessage) {
var warnBar = createWarnBar(errMessage);
$('#patternDiv').prepend(warnBar);
return false;
}
-
- //check the relations among nodes, bmcs and switches
+
+ // Check the relations among nodes, bmcs and switches
var nodeNum = expandNR(nodename).length;
var bmcNum = expandNR(bmcname).length;
var switchNum = expandNR(switchname).length;
var tempNumber = 0;
-
- //nodes number and bmc number
- if (nodeNum != bmcNum){
+
+ // Node number and BMC number
+ if (nodeNum != bmcNum) {
errMessage += 'The number of Node must equal the number of BMC. ';
}
-
- //nodes' number calculate by switches
+
+ // Node number calculate by switches
tempNumber += Number(nodesperswitch) * switchNum;
-
- if (tempNumber < nodeNum){
+
+ if (tempNumber < nodeNum) {
errMessage += 'Input the node number per switch correctly. ';
}
-
- if ('' != errMessage){
+
+ if ('' != errMessage) {
var warnBar = createWarnBar(errMessage);
$('#patternDiv').prepend(warnBar);
return false;
@@ -811,121 +812,111 @@ function idataplexCheckBasic(operType){
}
/**
- * step 3: tell users to configure the switches.
- *
- * @param
- *
- * @return
+ * Step 3: Tell users to configure the switches
*/
-function idataplexInitSwitch(){
+function idataplexInitSwitch() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
var switchArray = expandNR(getDiscoverEnv('idataplexswitchname'));
var switchIp = getDiscoverEnv('idataplexswitchip');
- var showString = '
' + steps[currentStep] + '
';
- showString += '
You defined ' + switchArray.length +' switches in last step. Configure them manually please: ';
- showString += '
1. Start IP address: ' + switchIp + ', and the IPs must be continuous.
';
+ var showString = '
'
+ + steps[currentStep] + '
';
+ showString += '
You defined ' + switchArray.length
+ + ' switches in last step. Configure them manually please: ';
+ showString += '
1. Start IP address: ' + switchIp
+ + ', and the IPs must be continuous.
';
showString += '
2. Enable the SNMP agent on switches.
';
showString += '
3. If you want to use the SNMP V3, the user/password and AuthProto (default is \'md5\') should be set in the switches table.
';
showString += '
4. Click the next button.
';
showString += '';
$('#discoverContentDiv').append(showString);
-
+
createDiscoverButtons();
}
/**
- * step 4: init the interface and dhcp dynamic range for hardware discovery page.
- *
- * @param
- *
- * @return
+ * Step 4: Init the interface and DHCP dynamic range for hardware discovery page
*/
-function idataplexInitNetwork(){
+function idataplexInitNetwork() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
var startIp = '172.30.200.1';
var endIp = '172.30.255.254';
- var showDiv = $('
' + steps[currentStep] + '
');
+ var showDiv = $('
'
+ + steps[currentStep] + '
');
var infoBar = createInfoBar('Make sure the discovery NIC\'s IP, start IP addresses and DHCP dynamic IP range are in the same subnet.');
showDiv.append(infoBar);
- //init the ip range by input
- if (getDiscoverEnv('idataplexIpStart')){
+
+ // Init the IP range by input
+ if (getDiscoverEnv('idataplexIpStart')) {
startIp = getDiscoverEnv('idataplexIpStart');
}
-
- if (getDiscoverEnv('idataplexIpEnd')){
+
+ if (getDiscoverEnv('idataplexIpEnd')) {
endIp = getDiscoverEnv('idataplexIpEnd');
}
var showString = '
';
- showString += '
DHCP Dynamic Range:
-
';
+ showString += '
DHCP Dynamic Range:
-
';
showString += '
';
showDiv.append(showString);
-
+
$('#discoverContentDiv').append(showDiv);
-
+
$('#discoverContentDiv [title]').tooltip({
- position: "center right",
- offset: [-2, 10],
- effect: "fade",
- opacity: 1
+ position : "center right",
+ offset : [ -2, 10 ],
+ effect : "fade",
+ opacity : 1
});
-
+
createDiscoverButtons();
}
/**
- * step 4: check the dynamic range for dhcp
- *
- * @param
- *
- * @return
+ * Step 4: Check the dynamic range for DHCP
*/
-function idataplexCheckNetwork(operType){
+function idataplexCheckNetwork(operType) {
collectInputValue();
- //click back button, do not need check, only collect input value is ok.
- if ('back' == operType){
+ if ('back' == operType) {
return true;
}
-
+
$('#networkDiv .ui-state-error').remove();
var startIp = getDiscoverEnv('idataplexIpStart');
var endIp = getDiscoverEnv('idataplexIpEnd');
var errMessage = '';
- if(!verifyIp(startIp)){
+ if (!verifyIp(startIp)) {
errMessage += 'Input the correct start IP address. ';
}
-
- if(!verifyIp(endIp)){
+
+ if (!verifyIp(endIp)) {
errMessage += 'Input the correct end IP address. ';
}
-
- if ('' != errMessage){
+
+ if ('' != errMessage) {
var warnBar = createWarnBar(errMessage);
$('#networkDiv').prepend(warnBar);
return false;
}
-
- if (ip2Decimal(endIp) <= ip2Decimal(startIp)){
+
+ if (ip2Decimal(endIp) <= ip2Decimal(startIp)) {
var warnBar = createWarnBar('the end IP must larger than start IP. ');
$('#networkDiv').prepend(warnBar);
return false;
}
-
+
return true;
}
/**
- * step 5: configure service by xcat command and restart
- *
- * @param
- *
- * @return
+ * Step 5: Configure service by xCAT command and restart
*/
-function idataplexInitService(operType){
+function idataplexInitService(operType) {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
var showStr = '
';
- showString += 'Walk over to each idataplex server and push the power button to power on. ' +
- 'After about 5-10 minutes, nodes should be configured and ready for hardware management. ';
+ var showString = '
'
+ + steps[currentStep] + '
';
+ showString += 'Walk over to each idataplex server and push the power button to power on. '
+ + 'After about 5-10 minutes, nodes should be configured and ready for hardware management. ';
$('#discoverContentDiv').append(showString);
-
- //add the refresh button
+
+ // Add the refresh button
var refreshButton = createButton("Refresh");
$('#poweronDiv').append(refreshButton);
- refreshButton.bind('click', function(){
+ refreshButton.bind('click', function() {
var tempObj = $('#poweronDiv div p');
tempObj.empty().append(createLoader());
-
+
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
@@ -1102,18 +1047,18 @@ function idataplexInitPowerOn(){
args : 'stat',
msg : ''
},
-
- success : function(data){
+
+ success : function(data) {
var tempObj = $('#poweronDiv div p');
tempObj.empty();
- for(var i in data.rsp){
+ for ( var i in data.rsp) {
tempObj.append(data.rsp[i] + ' ');
}
}
});
});
-
- //add the info area
+
+ // Add the info area
var infoBar = createInfoBar('Click the refresh button to check all nodes\' status.');
$('#poweronDiv').append(infoBar);
createDiscoverButtons();
diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js
index f534c5625..5a16c13e4 100644
--- a/xCAT-UI/js/custom/kvm.js
+++ b/xCAT-UI/js/custom/kvm.js
@@ -2,13 +2,11 @@
* Execute when the DOM is fully loaded
*/
$(document).ready(function() {
- // Load utility scripts (if any)
+ // Load utility scripts (if any)
});
/**
* Constructor
- *
- * @return Nothing
*/
var kvmPlugin = function() {
@@ -17,525 +15,511 @@ var kvmPlugin = function() {
/**
* Configure self-service page
*/
-kvmPlugin.prototype.loadConfigPage = function(tabId) {
- var configAccordion = $('');
-
- // Create accordion panel for user
- var userSection = $('');
- var userLnk = $('
').click(function () {
- // Do not load panel again if it is already loaded
- if ($('#kvmConfigUser').find('.dataTables_wrapper').length)
- return;
- else
- $('#kvmConfigUser').append(createLoader(''));
-
- // Get user data
- loadUserPanel('kvmConfigUser');
- });
-
- // Create accordion panel for profiles
- var profileSection = $('');
- profileSection.append(createInfoBar('Create, edit, and delete virtual machine profiles used in the self-service portal'));
- var profileLnk = $('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#kvmConfigUser').find('.dataTables_wrapper').length)
+ return;
+ else
+ $('#kvmConfigUser').append(createLoader(''));
+
+ // Get user data
+ loadUserPanel('kvmConfigUser');
+ });
+
+ // Create accordion panel for profiles
+ var profileSection = $('');
+ profileSection.append(createInfoBar('Create, edit, and delete virtual machine profiles used in the self-service portal'));
+ var profileLnk = $('
').click(function () {
- // Do not load panel again if it is already loaded
- if ($('#zvmConfigUser').find('.dataTables_wrapper').length)
- return;
- else
- $('#zvmConfigUser').append(createLoader(''));
+zvmPlugin.prototype.loadConfigPage = function(tabId) {
+ var configAccordion = $('');
+
+ // Create accordion panel for user
+ var userSection = $('');
+ var userLnk = $('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#zvmConfigUser').find('.dataTables_wrapper').length)
+ return;
+ else
+ $('#zvmConfigUser').append(createLoader(''));
- loadUserPanel('zvmConfigUser');
- });
-
- // Create accordion panel for profiles
- var profileSection = $('');
- var profileLnk = $('
').click(function () {
- // Do not load panel again if it is already loaded
- if ($('#zvmConfigProfile').find('.dataTables_wrapper').length)
- return;
- else
- $('#zvmConfigProfile').append(createLoader(''));
+ loadUserPanel('zvmConfigUser');
+ });
+
+ // Create accordion panel for profiles
+ var profileSection = $('');
+ var profileLnk = $('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#zvmConfigProfile').find('.dataTables_wrapper').length)
+ return;
+ else
+ $('#zvmConfigProfile').append(createLoader(''));
- queryProfiles('zvmConfigProfile');
- });
-
- // Create accordion panel for images
- var imgSection = $('');
- var imgLnk = $('
').click(function () {
- // Do not load panel again if it is already loaded
- if ($('#zvmConfigImages').find('.dataTables_wrapper').length)
- return;
- else
- $('#zvmConfigImages').append(createLoader(''));
+ queryProfiles('zvmConfigProfile');
+ });
+
+ // Create accordion panel for images
+ var imgSection = $('');
+ var imgLnk = $('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#zvmConfigImages').find('.dataTables_wrapper').length)
+ return;
+ else
+ $('#zvmConfigImages').append(createLoader(''));
- queryImages('zvmConfigImages');
- });
-
- // Create accordion panel for groups
- var groupsSection = $('');
- var groupsLnk = $('
').click(function () {
- // Do not load panel again if it is already loaded
- if ($('#zvmConfigGroups').find('.dataTables_wrapper').length)
- return;
- else
- $('#zvmConfigGroups').append(createLoader(''));
+ queryImages('zvmConfigImages');
+ });
+
+ // Create accordion panel for groups
+ var groupsSection = $('');
+ var groupsLnk = $('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#zvmNetworkResource').children().length)
+ return;
+ else
+ $('#zvmNetworkResource').append(createLoader(''));
+
+ // Resize accordion
+ $('#zvmResourceAccordion').accordion('resize');
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1)
+ hcps = $.cookie('hcp').split(',');
+ else
+ hcps.push($.cookie('hcp'));
+
+ for ( var i in hcps) {
+ // Gather networks from hardware control points
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcps[i],
+ args : '--getnetworknames',
+ msg : hcps[i]
+ },
- success : getNetwork
- });
- }
- });
-
- resourcesAccordion.append(diskLnk, diskSection, networkLnk, networkSection);
-
- // Append accordion to tab
- $('#' + tabId).append(resourcesAccordion);
- resourcesAccordion.accordion();
- diskLnk.trigger('click');
- }
+ success : getNetwork
+ });
+ }
+ });
+
+ resourcesAccordion.append(diskLnk, diskSection, networkLnk, networkSection);
+
+ // Append accordion to tab
+ $('#' + tabId).append(resourcesAccordion);
+ resourcesAccordion.accordion();
+ diskLnk.trigger('click');
+ }
}
/**
* Get node attributes from HTTP request data
*
- * @param propNames
- * Hash table of property names
- * @param keys
- * Property keys
- * @param data
- * Data from HTTP request
+ * @param propNames Hash table of property names
+ * @param keys Property keys
+ * @param data Data from HTTP request
* @return Hash table of property values
*/
function getAttrs(keys, propNames, data) {
- // Create hash table for property values
- var attrs = new Object();
+ // Create hash table for property values
+ var attrs = new Object();
- // Go through inventory and separate each property out
- var curKey; // Current property key
- var addLine; // Add a line to the current property?
- for ( var i = 1; i < data.length; i++) {
- addLine = true;
+ // Go through inventory and separate each property out
+ var curKey = null; // Current property key
+ var addLine; // Add a line to the current property?
+ for ( var i = 1; i < data.length; i++) {
+ addLine = true;
- // 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();
+ // 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();
- // Get rid of property name in the line
- data[i] = data[i].replace(propNames[keys[j]], '');
- // Trim the line
- data[i] = jQuery.trim(data[i]);
+ // Get rid of property name in the line
+ data[i] = data[i].replace(propNames[keys[j]], '');
+ // Trim the line
+ data[i] = jQuery.trim(data[i]);
- // Do not insert empty line
- if (data[i].length > 0) {
- attrs[keys[j]].push(data[i]);
- }
+ // Do not insert empty line
+ if (data[i].length > 0) {
+ attrs[keys[j]].push(data[i]);
+ }
- curKey = keys[j];
- addLine = false; // This line belongs to a property
- }
- }
+ curKey = keys[j];
+ addLine = false; // This line belongs to a property
+ }
+ }
- // Line does not contain a property
- // Must belong to previous property
- if (addLine && data[i].length > 1) {
- data[i] = jQuery.trim(data[i]);
- attrs[curKey].push(data[i]);
- }
- }
+ // Line does not contain a property
+ // Must belong to previous property
+ if (addLine && data[i].length > 1) {
+ data[i] = jQuery.trim(data[i]);
+ attrs[curKey].push(data[i]);
+ }
+ }
- return attrs;
+ return attrs;
}
/**
* Create add processor dialog
*
- * @param node
- * Node to add processor to
- * @return Nothing
+ * @param node Node to add processor to
*/
-function openAddProcDialog(node) {
- // Create form to add processor
- var addProcForm = $('');
- // Create info bar
- var info = createInfoBar('Add a temporary processor to this virtual server.');
- addProcForm.append(info);
- addProcForm.append('');
- addProcForm.append('');
-
- // Create drop down for processor type
- var procType = $('');
- procType.append('');
- var typeSelect = $('');
- typeSelect.append(''
- + ''
- + ''
- + ''
- );
- procType.append(typeSelect);
- addProcForm.append(procType);
-
- // Open dialog to add processor
- addProcForm.dialog({
- title:'Add processor',
- modal: true,
- close: function(){
- $(this).remove();
+function openAddProcDialog(node) {
+ // Create form to add processor
+ var addProcForm = $('');
+ // Create info bar
+ var info = createInfoBar('Add a temporary processor to this virtual server.');
+ addProcForm.append(info);
+ addProcForm.append('');
+ addProcForm.append('');
+
+ // Create drop down for processor type
+ var procType = $('');
+ procType.append('');
+ var typeSelect = $('');
+ typeSelect.append(''
+ + ''
+ + ''
+ + ''
+ );
+ procType.append(typeSelect);
+ addProcForm.append(procType);
+
+ // Open dialog to add processor
+ addProcForm.dialog({
+ title:'Add processor',
+ modal: true,
+ close: function(){
+ $(this).remove();
},
- width: 400,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get inputs
- var node = $(this).find('input[name=procNode]').val();
- var address = $(this).find('input[name=procAddress]').val();
- var type = $(this).find('select[name=procType]').val();
-
- // If inputs are not complete, show warning message
- if (!node || !address || !type) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Add processor
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--addprocessoractive;' + address + ';' + type,
- msg : node
- },
+ width: 400,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get inputs
+ var node = $(this).find('input[name=procNode]').val();
+ var address = $(this).find('input[name=procAddress]').val();
+ var type = $(this).find('select[name=procType]').val();
+
+ // If inputs are not complete, show warning message
+ if (!node || !address || !type) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Add processor
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--addprocessoractive;' + address + ';' + type,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
- // Increment node process
- incrementNodeProcess(node);
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- var statusId = node + 'StatusBar';
- var statusBarLoaderId = node + 'StatusBarLoader';
- $('#' + statusBarLoaderId).show();
- $('#' + statusId).show();
-
- // Close dialog
- $(this).dialog( "close" );
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Show loader
+ var statusId = node + 'StatusBar';
+ var statusBarLoaderId = node + 'StatusBarLoader';
+ $('#' + statusBarLoaderId).show();
+ $('#' + statusId).show();
+
+ // Close dialog
+ $(this).dialog( "close" );
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Create add disk dialog
*
- * @param node
- * Node to add disk to
- * @param hcp
- * Hardware control point of node
- * @return Nothing
+ * @param node Node to add disk to
+ * @param hcp Hardware control point of node
*/
function openAddDiskDialog(node, hcp) {
- // Get list of disk pools
- var cookie = $.cookie(hcp + 'diskpools');
- var pools = cookie.split(',');
-
- // Create form to add disk
- var addDiskForm = $('');
- // Create info bar
- var info = createInfoBar('Add a ECKD|3390 or FBA|9336 disk to this virtual server.');
- addDiskForm.append(info);
- addDiskForm.append('');
- addDiskForm.append('');
- addDiskForm.append('');
- addDiskForm.append('');
-
- // Create drop down for disk pool
- var diskPool = $('');
- diskPool.append('');
- var poolSelect = $('');
- for ( var i = 0; i < pools.length; i++) {
- poolSelect.append('');
- }
- diskPool.append(poolSelect);
- addDiskForm.append(diskPool);
+ // Get list of disk pools
+ var cookie = $.cookie(hcp + 'diskpools');
+ var pools = cookie.split(',');
+
+ // Create form to add disk
+ var addDiskForm = $('');
+ // Create info bar
+ var info = createInfoBar('Add a ECKD|3390 or FBA|9336 disk to this virtual server.');
+ addDiskForm.append(info);
+ addDiskForm.append('');
+ addDiskForm.append('');
+ addDiskForm.append('');
+ addDiskForm.append('');
+
+ // Create drop down for disk pool
+ var diskPool = $('');
+ diskPool.append('');
+ var poolSelect = $('');
+ for ( var i = 0; i < pools.length; i++) {
+ poolSelect.append('');
+ }
+ diskPool.append(poolSelect);
+ addDiskForm.append(diskPool);
- // Create drop down for disk mode
- var diskMode = $('');
- diskMode.append('');
- var modeSelect = $('');
- modeSelect.append(''
- + ''
- + ''
- + ''
- + ''
- + ''
- + ''
- );
- diskMode.append(modeSelect);
- addDiskForm.append(diskMode);
+ // Create drop down for disk mode
+ var diskMode = $('');
+ diskMode.append('');
+ var modeSelect = $('');
+ modeSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ diskMode.append(modeSelect);
+ addDiskForm.append(diskMode);
- addDiskForm.append('');
+ addDiskForm.append('');
- // Open dialog to add disk
- addDiskForm.dialog({
- title:'Add disk',
- modal: true,
- close: function(){
- $(this).remove();
+ // Open dialog to add disk
+ addDiskForm.dialog({
+ title:'Add disk',
+ modal: true,
+ close: function(){
+ $(this).remove();
},
- width: 400,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get inputs
- var node = $(this).find('input[name=diskNode]').val();
- var type = $(this).find('select[name=diskType]').val();
- var address = $(this).find('input[name=diskAddress]').val();
- var size = $(this).find('input[name=diskSize]').val();
- var pool = $(this).find('select[name=diskPool]').val();
- var mode = $(this).find('select[name=diskMode]').val();
- var password = $(this).find('input[name=diskPassword]').val();
-
- // If inputs are not complete, show warning message
- if (!node || !type || !address || !size || !pool || !mode) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Add disk
- if (type == '3390') {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--add3390;' + pool + ';' + address + ';' + size
- + ';' + mode + ';' + password + ';' + password + ';' + password,
- msg : node
- },
+ width: 400,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get inputs
+ var node = $(this).find('input[name=diskNode]').val();
+ var type = $(this).find('select[name=diskType]').val();
+ var address = $(this).find('input[name=diskAddress]').val();
+ var size = $(this).find('input[name=diskSize]').val();
+ var pool = $(this).find('select[name=diskPool]').val();
+ var mode = $(this).find('select[name=diskMode]').val();
+ var password = $(this).find('input[name=diskPassword]').val();
+
+ // If inputs are not complete, show warning message
+ if (!node || !type || !address || !size || !pool || !mode) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Add disk
+ if (type == '3390') {
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--add3390;' + pool + ';' + address + ';' + size
+ + ';' + mode + ';' + password + ';' + password + ';' + password,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
- // Increment node process
- incrementNodeProcess(node);
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- var statusId = node + 'StatusBar';
- var statusBarLoaderId = node + 'StatusBarLoader';
- $('#' + statusBarLoaderId).show();
- $('#' + statusId).show();
- } else if (type == '9336') {
- // Default block size for FBA volumes = 512
- var blkSize = '512';
-
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--add9336;' + pool + ';' + address + ';' + blkSize + ';' + size
- + ';' + mode + ';' + password + ';' + password + ';' + password,
- msg : node
- },
+ // Show loader
+ var statusId = node + 'StatusBar';
+ var statusBarLoaderId = node + 'StatusBarLoader';
+ $('#' + statusBarLoaderId).show();
+ $('#' + statusId).show();
+ } else if (type == '9336') {
+ // Default block size for FBA volumes = 512
+ var blkSize = '512';
+
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--add9336;' + pool + ';' + address + ';' + blkSize + ';' + size
+ + ';' + mode + ';' + password + ';' + password + ';' + password,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
- // Increment node process
- incrementNodeProcess(node);
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- var statusId = node + 'StatusBar';
- var statusBarLoaderId = node + 'StatusBarLoader';
- $('#' + statusBarLoaderId).show();
- $('#' + statusId).show();
- }
-
- // Close dialog
- $(this).dialog( "close" );
- } // End of else
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Show loader
+ var statusId = node + 'StatusBar';
+ var statusBarLoaderId = node + 'StatusBarLoader';
+ $('#' + statusBarLoaderId).show();
+ $('#' + statusId).show();
+ }
+
+ // Close dialog
+ $(this).dialog( "close" );
+ } // End of else
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Create add NIC dialog
*
- * @param node
- * Node to add NIC to
- * @param hcp
- * Hardware control point of node
- * @return Nothing
+ * @param node Node to add NIC to
+ * @param hcp Hardware control point of node
*/
function openAddNicDialog(node, hcp) {
- // Get network names
- var networks = $.cookie(hcp + 'networks').split(',');
-
- // Create form to add NIC
- var addNicForm = $('');
- // Create info bar
- var info = createInfoBar('Add a NIC to this virtual server.');
- addNicForm.append(info);
- addNicForm.append('');
- addNicForm.append('');
-
- // Create drop down for NIC types
- var nicType = $('');
- nicType.append('');
- var nicTypeSelect = $('');
- nicTypeSelect.append(''
- + ''
- + ''
- );
- nicType.append(nicTypeSelect);
- addNicForm.append(nicType);
-
- // Create drop down for network types
- var networkType = $('');
- networkType.append('');
- var networkTypeSelect = $('');
- networkTypeSelect.append(''
- + ''
- + ''
- );
- networkType.append(networkTypeSelect);
- addNicForm.append(networkType);
-
- // Create drop down for network names
- var gLansQdioSelect = $('');
- var gLansHipersSelect = $('');
- var vswitchSelect = $('');
- for ( var i = 0; i < networks.length; i++) {
- var network = networks[i].split(' ');
- var networkOption = $('');
- if (network[0] == 'VSWITCH') {
- vswitchSelect.append(networkOption);
- } else if (network[0] == 'LAN:QDIO') {
- gLansQdioSelect.append(networkOption);
- } else if (network[0] == 'LAN:HIPERS') {
- gLansHipersSelect.append(networkOption);
- }
- }
-
- // Hide network name drop downs until the NIC type and network type is selected
- // QDIO Guest LAN drop down
- var guestLanQdio = $('').hide();
- guestLanQdio.append('');
- guestLanQdio.append(gLansQdioSelect);
- addNicForm.append(guestLanQdio);
-
- // HIPERS Guest LAN drop down
- var guestLanHipers = $('').hide();
- guestLanHipers.append('');
- guestLanHipers.append(gLansHipersSelect);
- addNicForm.append(guestLanHipers);
-
- // VSWITCH drop down
- var vswitch = $('').hide();
- vswitch.append('');
- vswitch.append(vswitchSelect);
- addNicForm.append(vswitch);
-
- // Show network names on change
- networkTypeSelect.change(function(){
- // Remove any warning messages
- $(this).parent().parent().find('.ui-state-error').remove();
-
- // Get NIC type and network type
- var nicType = $(this).parent().parent().find('select[name=nicType]').val();
- var networkType = $(this).val();
-
- // Hide network name drop downs
- var guestLanQdio = $(this).parent().parent().find('select[name=nicLanQdioName]').parent();
- var guestLanHipers = $(this).parent().parent().find('select[name=nicLanHipersName]').parent();
- var vswitch = $(this).parent().parent().find('select[name=nicVSwitchName]').parent();
- guestLanQdio.hide();
- guestLanHipers.hide();
- vswitch.hide();
-
- // Show correct network name
- if (networkType == 'Guest LAN' && nicType == 'QDIO') {
- guestLanQdio.show();
- } else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') {
- guestLanHipers.show();
- } else if (networkType == 'Virtual Switch') {
- if (nicType == 'QDIO') {
- vswitch.show();
- } else {
- // No such thing as HIPERS VSWITCH
- var warn = createWarnBar('The selected choices are not valid.');
- warn.prependTo($(this).parent().parent());
- }
- }
- });
-
- // Show network names on change
- nicTypeSelect.change(function(){
- // Remove any warning messages
- $(this).parent().parent().find('.ui-state-error').remove();
-
- // Get NIC type and network type
- var nicType = $(this).val();
- var networkType = $(this).parent().parent().find('select[name=nicNetworkType]').val();
+ // Get network names
+ var networks = $.cookie(hcp + 'networks').split(',');
+
+ // Create form to add NIC
+ var addNicForm = $('');
+ // Create info bar
+ var info = createInfoBar('Add a NIC to this virtual server.');
+ addNicForm.append(info);
+ addNicForm.append('');
+ addNicForm.append('');
+
+ // Create drop down for NIC types
+ var nicType = $('');
+ nicType.append('');
+ var nicTypeSelect = $('');
+ nicTypeSelect.append(''
+ + ''
+ + ''
+ );
+ nicType.append(nicTypeSelect);
+ addNicForm.append(nicType);
+
+ // Create drop down for network types
+ var networkType = $('');
+ networkType.append('');
+ var networkTypeSelect = $('');
+ networkTypeSelect.append(''
+ + ''
+ + ''
+ );
+ networkType.append(networkTypeSelect);
+ addNicForm.append(networkType);
+
+ // Create drop down for network names
+ var gLansQdioSelect = $('');
+ var gLansHipersSelect = $('');
+ var vswitchSelect = $('');
+ for ( var i = 0; i < networks.length; i++) {
+ var network = networks[i].split(' ');
+ var networkOption = $('');
+ if (network[0] == 'VSWITCH') {
+ vswitchSelect.append(networkOption);
+ } else if (network[0] == 'LAN:QDIO') {
+ gLansQdioSelect.append(networkOption);
+ } else if (network[0] == 'LAN:HIPERS') {
+ gLansHipersSelect.append(networkOption);
+ }
+ }
+
+ // Hide network name drop downs until the NIC type and network type is selected
+ // QDIO Guest LAN drop down
+ var guestLanQdio = $('').hide();
+ guestLanQdio.append('');
+ guestLanQdio.append(gLansQdioSelect);
+ addNicForm.append(guestLanQdio);
+
+ // HIPERS Guest LAN drop down
+ var guestLanHipers = $('').hide();
+ guestLanHipers.append('');
+ guestLanHipers.append(gLansHipersSelect);
+ addNicForm.append(guestLanHipers);
+
+ // VSWITCH drop down
+ var vswitch = $('').hide();
+ vswitch.append('');
+ vswitch.append(vswitchSelect);
+ addNicForm.append(vswitch);
+
+ // Show network names on change
+ networkTypeSelect.change(function(){
+ // Remove any warning messages
+ $(this).parent().parent().find('.ui-state-error').remove();
+
+ // Get NIC type and network type
+ var nicType = $(this).parent().parent().find('select[name=nicType]').val();
+ var networkType = $(this).val();
+
+ // Hide network name drop downs
+ var guestLanQdio = $(this).parent().parent().find('select[name=nicLanQdioName]').parent();
+ var guestLanHipers = $(this).parent().parent().find('select[name=nicLanHipersName]').parent();
+ var vswitch = $(this).parent().parent().find('select[name=nicVSwitchName]').parent();
+ guestLanQdio.hide();
+ guestLanHipers.hide();
+ vswitch.hide();
+
+ // Show correct network name
+ if (networkType == 'Guest LAN' && nicType == 'QDIO') {
+ guestLanQdio.show();
+ } else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') {
+ guestLanHipers.show();
+ } else if (networkType == 'Virtual Switch') {
+ if (nicType == 'QDIO') {
+ vswitch.show();
+ } else {
+ // No such thing as HIPERS VSWITCH
+ var warn = createWarnBar('The selected choices are not valid.');
+ warn.prependTo($(this).parent().parent());
+ }
+ }
+ });
+
+ // Show network names on change
+ nicTypeSelect.change(function(){
+ // Remove any warning messages
+ $(this).parent().parent().find('.ui-state-error').remove();
+
+ // Get NIC type and network type
+ var nicType = $(this).val();
+ var networkType = $(this).parent().parent().find('select[name=nicNetworkType]').val();
- // Hide network name drop downs
- var guestLanQdio = $(this).parent().parent().find('select[name=nicLanQdioName]').parent();
- var guestLanHipers = $(this).parent().parent().find('select[name=nicLanHipersName]').parent();
- var vswitch = $(this).parent().parent().find('select[name=nicVSwitchName]').parent();
- guestLanQdio.hide();
- guestLanHipers.hide();
- vswitch.hide();
-
- // Show correct network name
- if (networkType == 'Guest LAN' && nicType == 'QDIO') {
- guestLanQdio.show();
- } else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') {
- guestLanHipers.show();
- } else if (networkType == 'Virtual Switch') {
- if (nicType == 'QDIO') {
- vswitch.show();
- } else {
- // No such thing as HIPERS VSWITCH
- var warn = createWarnBar('The selected choices are not valid.');
- warn.prependTo($(this).parent().parent());
- }
- }
- });
-
- // Open dialog to add NIC
- addNicForm.dialog({
- title:'Add NIC',
- modal: true,
- close: function(){
- $(this).remove();
+ // Hide network name drop downs
+ var guestLanQdio = $(this).parent().parent().find('select[name=nicLanQdioName]').parent();
+ var guestLanHipers = $(this).parent().parent().find('select[name=nicLanHipersName]').parent();
+ var vswitch = $(this).parent().parent().find('select[name=nicVSwitchName]').parent();
+ guestLanQdio.hide();
+ guestLanHipers.hide();
+ vswitch.hide();
+
+ // Show correct network name
+ if (networkType == 'Guest LAN' && nicType == 'QDIO') {
+ guestLanQdio.show();
+ } else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') {
+ guestLanHipers.show();
+ } else if (networkType == 'Virtual Switch') {
+ if (nicType == 'QDIO') {
+ vswitch.show();
+ } else {
+ // No such thing as HIPERS VSWITCH
+ var warn = createWarnBar('The selected choices are not valid.');
+ warn.prependTo($(this).parent().parent());
+ }
+ }
+ });
+
+ // Open dialog to add NIC
+ addNicForm.dialog({
+ title:'Add NIC',
+ modal: true,
+ close: function(){
+ $(this).remove();
},
- width: 400,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- var ready = true;
- var errMsg = '';
-
- // Get inputs
- var node = $(this).find('input[name=nicNode]').val();
- var nicType = $(this).find('select[name=nicType]').val();
- var networkType = $(this).find('select[name=nicNetworkType]').val();
- var address = $(this).find('input[name=nicAddress]').val();
-
- // If inputs are not complete, show warning message
- if (!node || !nicType || !networkType || !address) {
- errMsg = 'Please provide a value for each missing field. ';
- ready = false;
- }
-
- // If a HIPERS VSWITCH is selected, show warning message
- if (nicType == 'HiperSockets' && networkType == 'Virtual Switch') {
- errMsg += 'The selected choices are not valid.';
- ready = false;
- }
-
- // If there are errors
- if (!ready) {
- // Show warning message
- var warn = createWarnBar(errMsg);
- warn.prependTo($(this));
- } else {
- // Add guest LAN
- if (networkType == 'Guest LAN') {
- var temp;
- if (nicType == 'QDIO') {
- temp = $(this).find('select[name=nicLanQdioName]').val().split(' ');
- } else {
- temp = $(this).find('select[name=nicLanHipersName]').val().split(' ');
- }
-
- var lanOwner = temp[0];
- var lanName = temp[1];
-
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--addnic;' + address + ';' + nicType + ';3',
- msg : 'node=' + node + ';addr=' + address + ';lan='
- + lanName + ';owner=' + lanOwner
- },
- success : connect2GuestLan
- });
- }
+ width: 400,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ var ready = true;
+ var errMsg = '';
+
+ // Get inputs
+ var node = $(this).find('input[name=nicNode]').val();
+ var nicType = $(this).find('select[name=nicType]').val();
+ var networkType = $(this).find('select[name=nicNetworkType]').val();
+ var address = $(this).find('input[name=nicAddress]').val();
+
+ // If inputs are not complete, show warning message
+ if (!node || !nicType || !networkType || !address) {
+ errMsg = 'Please provide a value for each missing field. ';
+ ready = false;
+ }
+
+ // If a HIPERS VSWITCH is selected, show warning message
+ if (nicType == 'HiperSockets' && networkType == 'Virtual Switch') {
+ errMsg += 'The selected choices are not valid.';
+ ready = false;
+ }
+
+ // If there are errors
+ if (!ready) {
+ // Show warning message
+ var warn = createWarnBar(errMsg);
+ warn.prependTo($(this));
+ } else {
+ // Add guest LAN
+ if (networkType == 'Guest LAN') {
+ var temp;
+ if (nicType == 'QDIO') {
+ temp = $(this).find('select[name=nicLanQdioName]').val().split(' ');
+ } else {
+ temp = $(this).find('select[name=nicLanHipersName]').val().split(' ');
+ }
+
+ var lanOwner = temp[0];
+ var lanName = temp[1];
+
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--addnic;' + address + ';' + nicType + ';3',
+ msg : 'node=' + node + ';addr=' + address + ';lan='
+ + lanName + ';owner=' + lanOwner
+ },
+ success : connect2GuestLan
+ });
+ }
- // Add virtual switch
- else if (networkType == 'Virtual Switch' && nicType == 'QDIO') {
- var temp = $(this).find('select[name=nicVSwitchName]').val().split(' ');
- var vswitchName = temp[1];
+ // Add virtual switch
+ else if (networkType == 'Virtual Switch' && nicType == 'QDIO') {
+ var temp = $(this).find('select[name=nicVSwitchName]').val().split(' ');
+ var vswitchName = temp[1];
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--addnic;' + address + ';' + nicType + ';3',
- msg : 'node=' + node + ';addr=' + address + ';vsw='
- + vswitchName
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--addnic;' + address + ';' + nicType + ';3',
+ msg : 'node=' + node + ';addr=' + address + ';vsw='
+ + vswitchName
+ },
- success : connect2VSwitch
- });
- }
-
- // Increment node process
- incrementNodeProcess(node);
+ success : connect2VSwitch
+ });
+ }
+
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- $('#' + node + 'StatusBarLoader').show();
- $('#' + node + 'StatusBar').show();
-
- // Close dialog
- $(this).dialog( "close" );
- } // End of else
- },
- "Cancel": function(){
- $(this).dialog( "close" );
- }
- }
- });
+ // Show loader
+ $('#' + node + 'StatusBarLoader').show();
+ $('#' + node + 'StatusBar').show();
+
+ // Close dialog
+ $(this).dialog( "close" );
+ } // End of else
+ },
+ "Cancel": function(){
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Remove processor
*
- * @param node
- * Node where processor is attached
- * @param address
- * Virtual address of processor
- * @return Nothing
+ * @param node Node where processor is attached
+ * @param address Virtual address of processor
*/
function removeProcessor(node, address) {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--removeprocessor;' + address,
- msg : node
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--removeprocessor;' + address,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
- // Increment node process
- incrementNodeProcess(node);
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- $('#' + node + 'StatusBarLoader').show();
- $('#' + node + 'StatusBar').show();
+ // Show loader
+ $('#' + node + 'StatusBarLoader').show();
+ $('#' + node + 'StatusBar').show();
}
/**
* Remove disk
*
- * @param node
- * Node where disk is attached
- * @param address
- * Virtual address of disk
- * @return Nothing
+ * @param node Node where disk is attached
+ * @param address Virtual address of disk
*/
function removeDisk(node, address) {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--removedisk;' + address,
- msg : node
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--removedisk;' + address,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
- // Increment node process
- incrementNodeProcess(node);
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- $('#' + node + 'StatusBarLoader').show();
- $('#' + node + 'StatusBar').show();
+ // Show loader
+ $('#' + node + 'StatusBarLoader').show();
+ $('#' + node + 'StatusBar').show();
}
/**
* Remove NIC
*
- * @param node
- * Node where NIC is attached
- * @param address
- * Virtual address of NIC
- * @return Nothing
+ * @param node Node where NIC is attached
+ * @param address Virtual address of NIC
*/
function removeNic(node, nic) {
- var args = nic.split('.');
- var address = args[0];
+ var args = nic.split('.');
+ var address = args[0];
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--removenic;' + address,
- msg : node
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--removenic;' + address,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
- // Increment node process
- incrementNodeProcess(node);
+ // Increment node process
+ incrementNodeProcess(node);
- // Show loader
- $('#' + node + 'StatusBarLoader').show();
- $('#' + node + 'StatusBar').show();
+ // Show loader
+ $('#' + node + 'StatusBarLoader').show();
+ $('#' + node + 'StatusBar').show();
}
/**
* Set a cookie for the network names of a given node
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function setNetworkCookies(data) {
- if (data.rsp) {
- var node = data.msg;
- var networks = data.rsp[0].split(node + ': ');
-
- // Set cookie to expire in 60 minutes
- var exDate = new Date();
- exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
- $.cookie(node + 'networks', networks, { expires: exDate });
- }
+ if (data.rsp) {
+ var node = data.msg;
+ var networks = data.rsp[0].split(node + ': ');
+
+ // Set cookie to expire in 60 minutes
+ var exDate = new Date();
+ exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
+ $.cookie(node + 'networks', networks, { expires: exDate });
+ }
}
/**
* Get contents of each disk pool
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function getDiskPool(data) {
- if (data.rsp) {
- var hcp = data.msg;
- var pools = data.rsp[0].split(hcp + ': ');
+ if (data.rsp) {
+ var hcp = data.msg;
+ var pools = data.rsp[0].split(hcp + ': ');
- // Get contents of each disk pool
- for ( var i in pools) {
- if (pools[i]) {
- pools[i] = jQuery.trim(pools[i]);
-
- // Get used space
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'lsvm',
- tgt : hcp,
- args : '--diskpool;' + pools[i] + ';used',
- msg : 'hcp=' + hcp + ';pool=' + pools[i] + ';stat=used'
- },
+ // Get contents of each disk pool
+ for ( var i in pools) {
+ if (pools[i]) {
+ pools[i] = jQuery.trim(pools[i]);
+
+ // Get used space
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcp,
+ args : '--diskpool;' + pools[i] + ';used',
+ msg : 'hcp=' + hcp + ';pool=' + pools[i] + ';stat=used'
+ },
- success : loadDiskPoolTable
- });
+ success : loadDiskPoolTable
+ });
- // Get free space
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'lsvm',
- tgt : hcp,
- args : '--diskpool;' + pools[i] + ';free',
- msg : 'hcp=' + hcp + ';pool=' + pools[i] + ';stat=free'
- },
+ // Get free space
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcp,
+ args : '--diskpool;' + pools[i] + ';free',
+ msg : 'hcp=' + hcp + ';pool=' + pools[i] + ';stat=free'
+ },
- success : loadDiskPoolTable
- });
- } // End of if
- } // End of for
- }
+ success : loadDiskPoolTable
+ });
+ } // End of if
+ } // End of for
+ }
}
/**
* Get details of each network
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function getNetwork(data) {
- if (data.rsp) {
- var hcp = data.msg;
- var networks = data.rsp[0].split(hcp + ': ');
+ if (data.rsp) {
+ var hcp = data.msg;
+ var networks = data.rsp[0].split(hcp + ': ');
- // Loop through each network
- for ( var i = 1; i < networks.length; i++) {
- var args = networks[i].split(' ');
- var type = args[0];
- var name = args[2];
+ // Loop through each network
+ for ( var i = 1; i < networks.length; i++) {
+ var args = networks[i].split(' ');
+ var type = args[0];
+ var name = args[2];
- // Get network details
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'lsvm',
- tgt : hcp,
- args : '--getnetwork;' + name,
- msg : 'hcp=' + hcp + ';type=' + type + ';network=' + name
- },
+ // Get network details
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcp,
+ args : '--getnetwork;' + name,
+ msg : 'hcp=' + hcp + ';type=' + type + ';network=' + name
+ },
- success : loadNetworkTable
- });
- } // End of for
- } // End of if
+ success : loadNetworkTable
+ });
+ } // End of for
+ } // End of if
}
/**
* Load disk pool contents into a table
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function loadDiskPoolTable(data) {
- // Remove loader
- var panelId = 'zvmDiskResource';
- $('#' + panelId).find('img[src="images/loader.gif"]').remove();
-
- var args = data.msg.split(';');
- var hcp = args[0].replace('hcp=', '');
- var pool = args[1].replace('pool=', '');
- var stat = args[2].replace('stat=', '');
- var tmp = data.rsp[0].split(hcp + ': ');
+ // Remove loader
+ var panelId = 'zvmDiskResource';
+ $('#' + panelId).find('img[src="images/loader.gif"]').remove();
+
+ var args = data.msg.split(';');
+ var hcp = args[0].replace('hcp=', '');
+ var pool = args[1].replace('pool=', '');
+ var stat = args[2].replace('stat=', '');
+ var tmp = data.rsp[0].split(hcp + ': ');
- // Resource tab ID
- var info = $('#' + panelId).find('.ui-state-highlight');
- // If there is no info bar
- if (!info.length) {
- // Create info bar
- info = createInfoBar('Below are disks that are defined in the EXTENT CONTROL file.');
- $('#' + panelId).append(info);
- }
+ // Resource tab ID
+ var info = $('#' + panelId).find('.ui-state-highlight');
+ // If there is no info bar
+ if (!info.length) {
+ // Create info bar
+ info = createInfoBar('Below are disks that are defined in the EXTENT CONTROL file.');
+ $('#' + panelId).append(info);
+ }
- // Get datatable
- var tableId = 'zDiskDataTable';
- var dTable = getDiskDataTable();
- if (!dTable) {
- // Create a datatable
- var table = new DataTable(tableId);
- // Resource headers: volume ID, device type, start address, and size
- table.init( [ '', 'HCP', 'Pool', 'Status', 'Region', 'Device type', 'Starting address', 'Size' ]);
+ // Get datatable
+ var tableId = 'zDiskDataTable';
+ var dTable = getDiskDataTable();
+ if (!dTable) {
+ // Create a datatable
+ var table = new DataTable(tableId);
+ // Resource headers: volume ID, device type, start address, and size
+ table.init( [ '', 'HCP', 'Pool', 'Status', 'Region', 'Device type', 'Starting address', 'Size' ]);
- // Append datatable to panel
- $('#' + panelId).append(table.object());
+ // Append datatable to panel
+ $('#' + panelId).append(table.object());
- // Turn into datatable
- dTable = $('#' + tableId).dataTable();
- setDiskDataTable(dTable);
- }
+ // Turn into datatable
+ dTable = $('#' + tableId).dataTable();
+ setDiskDataTable(dTable);
+ }
- // Skip index 0 and 1 because it contains nothing
- for ( var i = 2; i < tmp.length; i++) {
- tmp[i] = jQuery.trim(tmp[i]);
- var diskAttrs = tmp[i].split(' ');
- dTable.fnAddData( [ '', hcp, pool, stat, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3] ]);
- }
-
- // Create actions menu
- if (!$('#zvmResourceActions').length) {
- // Empty filter area
- $('#' + tableId + '_length').empty();
-
- // Add disk to pool
- var addLnk = $('Add');
- addLnk.bind('click', function(event){
- openAddDisk2PoolDialog();
- });
-
- // Delete disk from pool
- var removeLnk = $('Remove');
- removeLnk.bind('click', function(event){
- var disks = getNodesChecked(tableId);
- openRemoveDiskFromPoolDialog(disks);
- });
-
- // Refresh table
- var refreshLnk = $('Refresh');
- refreshLnk.bind('click', function(event){
- $('#zvmDiskResource').empty().append(createLoader(''));
- setDiskDataTable('');
-
- // Create a array for hardware control points
- var hcps = new Array();
- if ($.cookie('hcp').indexOf(',') > -1)
- hcps = $.cookie('hcp').split(',');
- else
- hcps.push($.cookie('hcp'));
-
- // Query the disk pools for each
- for (var i in hcps) {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'lsvm',
- tgt : hcps[i],
- args : '--diskpoolnames',
- msg : hcps[i]
- },
+ // Skip index 0 and 1 because it contains nothing
+ for ( var i = 2; i < tmp.length; i++) {
+ tmp[i] = jQuery.trim(tmp[i]);
+ var diskAttrs = tmp[i].split(' ');
+ dTable.fnAddData( [ '', hcp, pool, stat, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3] ]);
+ }
+
+ // Create actions menu
+ if (!$('#zvmResourceActions').length) {
+ // Empty filter area
+ $('#' + tableId + '_length').empty();
+
+ // Add disk to pool
+ var addLnk = $('Add');
+ addLnk.bind('click', function(event){
+ openAddDisk2PoolDialog();
+ });
+
+ // Delete disk from pool
+ var removeLnk = $('Remove');
+ removeLnk.bind('click', function(event){
+ var disks = getNodesChecked(tableId);
+ openRemoveDiskFromPoolDialog(disks);
+ });
+
+ // Refresh table
+ var refreshLnk = $('Refresh');
+ refreshLnk.bind('click', function(event){
+ $('#zvmDiskResource').empty().append(createLoader(''));
+ setDiskDataTable('');
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1)
+ hcps = $.cookie('hcp').split(',');
+ else
+ hcps.push($.cookie('hcp'));
+
+ // Query the disk pools for each
+ for (var i in hcps) {
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcps[i],
+ args : '--diskpoolnames',
+ msg : hcps[i]
+ },
- success : getDiskPool
- });
- }
- });
-
- // Create action bar
- var actionBar = $('');
-
- // Create an action menu
- var actionsMenu = createMenu([addLnk, removeLnk, refreshLnk]);
- actionsMenu.superfish();
- actionsMenu.css('display', 'inline-block');
- actionBar.append(actionsMenu);
-
- // Set correct theme for action menu
- actionsMenu.find('li').hover(function() {
- setMenu2Theme($(this));
- }, function() {
- setMenu2Normal($(this));
- });
-
- // Create a division to hold actions menu
- var menuDiv = $('');
- $('#' + tableId + '_length').prepend(menuDiv);
- $('#' + tableId + '_length').css({
- 'padding': '0px',
- 'width': '500px'
- });
- $('#' + tableId + '_filter').css('padding', '10px');
- menuDiv.append(actionBar);
- }
-
- // Resize accordion
- $('#zvmResourceAccordion').accordion('resize');
+ success : getDiskPool
+ });
+ }
+ });
+
+ // Create action bar
+ var actionBar = $('');
+
+ // Create an action menu
+ var actionsMenu = createMenu([addLnk, removeLnk, refreshLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + tableId + '_length').prepend(menuDiv);
+ $('#' + tableId + '_length').css({
+ 'padding': '0px',
+ 'width': '500px'
+ });
+ $('#' + tableId + '_filter').css('padding', '10px');
+ menuDiv.append(actionBar);
+ }
+
+ // Resize accordion
+ $('#zvmResourceAccordion').accordion('resize');
}
/**
* Open dialog to remove disk from pool
*
- * @param disks2remove
- * Disks selected in table
- * @return Nothing
+ * @param disks2remove Disks selected in table
*/
function openRemoveDiskFromPoolDialog(disks2remove) {
- // Create form to delete disk to pool
- var dialogId = 'zvmDeleteDiskFromPool';
- var deleteDiskForm = $('');
- // Create info bar
- var info = createInfoBar('Remove a disk from a disk pool defined in the EXTENT CONTROL.');
- deleteDiskForm.append(info);
- var action = $('');
- var actionSelect = $('');
- action.append(actionSelect);
-
- var hcp = $('');
- var hcpSelect = $('');
- hcp.append(hcpSelect);
-
- // Set region input based on those selected on table (if any)
- var region = $('');
- var group = $('');
- deleteDiskForm.append(action, hcp, region, group);
-
- // Create a array for hardware control points
- var hcps = new Array();
- if ($.cookie('hcp').indexOf(',') > -1)
- hcps = $.cookie('hcp').split(',');
- else
- hcps.push($.cookie('hcp'));
-
- // Append options for hardware control points
- for (var i in hcps) {
- hcpSelect.append($(''));
- }
-
- actionSelect.change(function() {
- if ($(this).val() == '1' || $(this).val() == '3') {
- region.show();
- group.hide();
- } else if ($(this).val() == '2') {
- region.show();
- group.show();
- } else if ($(this).val() == '7') {
- region.val('FOOBAR');
- region.hide();
- group.show();
- }
- });
-
- // Open dialog to delete disk
- deleteDiskForm.dialog({
- title:'Delete disk from pool',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 500,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get inputs
- var action = $(this).find('select[name=action]').val();
- var hcp = $(this).find('select[name=hcp]').val();
- var region = $(this).find('input[name=region]').val();
- var group = $(this).find('input[name=group]').val();
-
- // If inputs are not complete, show warning message
- if (!action || !hcp) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- var args;
- if (action == '2' || action == '7')
- args = region + ';' + group;
- else
- args = group;
-
- // Remove disk from pool
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : hcp,
- args : '--removediskfrompool;' + action + ';' + args,
- msg : dialogId
- },
+ // Create form to delete disk to pool
+ var dialogId = 'zvmDeleteDiskFromPool';
+ var deleteDiskForm = $('');
- success : updateResourceDialog
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Create info bar
+ var info = createInfoBar('Remove a disk from a disk pool defined in the EXTENT CONTROL.');
+ deleteDiskForm.append(info);
+ var action = $('');
+ var actionSelect = $('');
+ action.append(actionSelect);
+
+ var hcp = $('');
+ var hcpSelect = $('');
+ hcp.append(hcpSelect);
+
+ // Set region input based on those selected on table (if any)
+ var region = $('');
+ var group = $('');
+ deleteDiskForm.append(action, hcp, region, group);
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1)
+ hcps = $.cookie('hcp').split(',');
+ else
+ hcps.push($.cookie('hcp'));
+
+ // Append options for hardware control points
+ for (var i in hcps) {
+ hcpSelect.append($(''));
+ }
+
+ actionSelect.change(function() {
+ if ($(this).val() == '1' || $(this).val() == '3') {
+ region.show();
+ group.hide();
+ } else if ($(this).val() == '2') {
+ region.show();
+ group.show();
+ } else if ($(this).val() == '7') {
+ region.val('FOOBAR');
+ region.hide();
+ group.show();
+ }
+ });
+
+ // Open dialog to delete disk
+ deleteDiskForm.dialog({
+ title:'Delete disk from pool',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 500,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get inputs
+ var action = $(this).find('select[name=action]').val();
+ var hcp = $(this).find('select[name=hcp]').val();
+ var region = $(this).find('input[name=region]').val();
+ var group = $(this).find('input[name=group]').val();
+
+ // If inputs are not complete, show warning message
+ if (!action || !hcp) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ var args;
+ if (action == '2' || action == '7')
+ args = region + ';' + group;
+ else
+ args = group;
+
+ // Remove disk from pool
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : hcp,
+ args : '--removediskfrompool;' + action + ';' + args,
+ msg : dialogId
+ },
+
+ success : updateResourceDialog
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open dialog to add disk to pool
*/
function openAddDisk2PoolDialog() {
- // Create form to add disk to pool
- var dialogId = 'zvmAddDisk2Pool';
- var addDiskForm = $('');
- // Create info bar
- var info = createInfoBar('Add a disk to a disk pool defined in the EXTENT CONTROL. The disk has to already be attached to SYSTEM.');
- addDiskForm.append(info);
- var action = $('');
- var actionSelect = $('');
- action.append(actionSelect);
-
- var hcp = $('');
- var hcpSelect = $('');
- hcp.append(hcpSelect);
- var region = $('');
- var volume = $('');
- var group = $('');
- addDiskForm.append(action, hcp, region, volume, group);
-
- // Create a array for hardware control points
- var hcps = new Array();
- if ($.cookie('hcp').indexOf(',') > -1)
- hcps = $.cookie('hcp').split(',');
- else
- hcps.push($.cookie('hcp'));
-
- // Append options for hardware control points
- for (var i in hcps) {
- hcpSelect.append($(''));
- }
-
- actionSelect.change(function() {
- if ($(this).val() == '4') {
- volume.show();
- } else if ($(this).val() == '5') {
- volume.hide();
- }
- });
-
- // Open dialog to add disk
- addDiskForm.dialog({
- title:'Add disk to pool',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 500,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get inputs
- var action = $(this).find('select[name=action]').val();
- var hcp = $(this).find('select[name=hcp]').val();
- var region = $(this).find('input[name=region]').val();
- var volume = $(this).find('input[name=volume]').val();
- var group = $(this).find('input[name=group]').val();
-
- // If inputs are not complete, show warning message
- if (!action || !hcp || !region || !group) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- var args;
- if (action == '4')
- args = region + ';' + volume + ';' + group;
- else
- args = region + ';' + group;
-
- // Add disk to pool
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : hcp,
- args : '--adddisk2pool;' + action + ';' + args,
- msg : dialogId
- },
+ // Create form to add disk to pool
+ var dialogId = 'zvmAddDisk2Pool';
+ var addDiskForm = $('');
+ // Create info bar
+ var info = createInfoBar('Add a disk to a disk pool defined in the EXTENT CONTROL. The disk has to already be attached to SYSTEM.');
+ addDiskForm.append(info);
+ var action = $('');
+ var actionSelect = $('');
+ action.append(actionSelect);
- success : updateResourceDialog
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ var hcp = $('');
+ var hcpSelect = $('');
+ hcp.append(hcpSelect);
+ var region = $('');
+ var volume = $('');
+ var group = $('');
+ addDiskForm.append(action, hcp, region, volume, group);
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1)
+ hcps = $.cookie('hcp').split(',');
+ else
+ hcps.push($.cookie('hcp'));
+
+ // Append options for hardware control points
+ for (var i in hcps) {
+ hcpSelect.append($(''));
+ }
+
+ actionSelect.change(function() {
+ if ($(this).val() == '4') {
+ volume.show();
+ } else if ($(this).val() == '5') {
+ volume.hide();
+ }
+ });
+
+ // Open dialog to add disk
+ addDiskForm.dialog({
+ title:'Add disk to pool',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 500,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get inputs
+ var action = $(this).find('select[name=action]').val();
+ var hcp = $(this).find('select[name=hcp]').val();
+ var region = $(this).find('input[name=region]').val();
+ var volume = $(this).find('input[name=volume]').val();
+ var group = $(this).find('input[name=group]').val();
+
+ // If inputs are not complete, show warning message
+ if (!action || !hcp || !region || !group) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ var args;
+ if (action == '4')
+ args = region + ';' + volume + ';' + group;
+ else
+ args = region + ';' + group;
+
+ // Add disk to pool
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : hcp,
+ args : '--adddisk2pool;' + action + ';' + args,
+ msg : dialogId
+ },
+
+ success : updateResourceDialog
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Update resource dialog
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
-function updateResourceDialog(data) {
- var dialogId = data.msg;
- var infoMsg;
+function updateResourceDialog(data) {
+ var dialogId = data.msg;
+ var infoMsg;
- // Create info message
- if (jQuery.isArray(data.rsp)) {
- infoMsg = '';
- for (var i in data.rsp) {
- infoMsg += data.rsp[i] + '';
- }
- } else {
- infoMsg = data.rsp;
- }
-
- // Create info bar with close button
- var infoBar = $('').css('margin', '5px 0px');
- var icon = $('').css({
- 'display': 'inline-block',
- 'margin': '10px 5px'
- });
-
- // Create close button to close info bar
- var close = $('').css({
- 'display': 'inline-block',
- 'float': 'right'
- }).click(function() {
- $(this).parent().remove();
- });
-
- var msg = $('
' + infoMsg + '
').css({
- 'display': 'inline-block',
- 'width': '90%'
- });
-
- infoBar.append(icon, msg, close);
- infoBar.prependTo($('#' + dialogId));
+ // Create info message
+ if (jQuery.isArray(data.rsp)) {
+ infoMsg = '';
+ for (var i in data.rsp) {
+ infoMsg += data.rsp[i] + '';
+ }
+ } else {
+ infoMsg = data.rsp;
+ }
+
+ // Create info bar with close button
+ var infoBar = $('').css('margin', '5px 0px');
+ var icon = $('').css({
+ 'display': 'inline-block',
+ 'margin': '10px 5px'
+ });
+
+ // Create close button to close info bar
+ var close = $('').css({
+ 'display': 'inline-block',
+ 'float': 'right'
+ }).click(function() {
+ $(this).parent().remove();
+ });
+
+ var msg = $('
' + infoMsg + '
').css({
+ 'display': 'inline-block',
+ 'width': '90%'
+ });
+
+ infoBar.append(icon, msg, close);
+ infoBar.prependTo($('#' + dialogId));
}
/**
* Select all checkboxes in the datatable
*
- * @param event
- * Event on element
- * @param obj
- * Object triggering event
- * @return Nothing
+ * @param event Event on element
+ * @param obj Object triggering event
*/
function selectAllDisk(event, obj) {
- // Get datatable ID
- // This will ascend from
- var tableObj = obj.parents('.datatable');
- var status = obj.attr('checked');
- tableObj.find(' :checkbox').attr('checked', status);
- event.stopPropagation();
+ // Get datatable ID
+ // This will ascend from
+ var tableObj = obj.parents('.datatable');
+ var status = obj.attr('checked');
+ tableObj.find(' :checkbox').attr('checked', status);
+ event.stopPropagation();
}
/**
* Load network details into a table
*
- * @param data
- * HTTP request data
- * @return Nothing
+ * @param data HTTP request data
*/
function loadNetworkTable(data) {
- // Remove loader
- var panelId = 'zvmNetworkResource';
- $('#' + panelId).find('img[src="images/loader.gif"]').remove();
-
- var args = data.msg.split(';');
- var hcp = args[0].replace('hcp=', '');
- var type = args[1].replace('type=', '');
- var name = args[2].replace('network=', '');
- var tmp = data.rsp[0].split(hcp + ': ');
+ // Remove loader
+ var panelId = 'zvmNetworkResource';
+ $('#' + panelId).find('img[src="images/loader.gif"]').remove();
+
+ var args = data.msg.split(';');
+ var hcp = args[0].replace('hcp=', '');
+ var type = args[1].replace('type=', '');
+ var name = args[2].replace('network=', '');
+ var tmp = data.rsp[0].split(hcp + ': ');
- // Resource tab ID
- var info = $('#' + panelId).find('.ui-state-highlight');
- // If there is no info bar
- if (!info.length) {
- // Create info bar
- info = createInfoBar('Below are LANs/VSWITCHes available to use.');
- $('#' + panelId).append(info);
- }
+ // Resource tab ID
+ var info = $('#' + panelId).find('.ui-state-highlight');
+ // If there is no info bar
+ if (!info.length) {
+ // Create info bar
+ info = createInfoBar('Below are LANs/VSWITCHes available to use.');
+ $('#' + panelId).append(info);
+ }
- // Get datatable
- var dTable = getNetworkDataTable();
- if (!dTable) {
- // Create table
- var tableId = 'zNetworkDataTable';
- var table = new DataTable(tableId);
- table.init( [ 'HCP', 'Type', 'Name', 'Details' ]);
+ // Get datatable
+ var dTable = getNetworkDataTable();
+ if (!dTable) {
+ // Create table
+ var tableId = 'zNetworkDataTable';
+ var table = new DataTable(tableId);
+ table.init( [ 'HCP', 'Type', 'Name', 'Details' ]);
- // Append datatable to tab
- $('#' + panelId).append(table.object());
+ // Append datatable to tab
+ $('#' + panelId).append(table.object());
- // Turn into datatable
- dTable = $('#' + tableId).dataTable();
- setNetworkDataTable(dTable);
+ // Turn into datatable
+ dTable = $('#' + tableId).dataTable();
+ setNetworkDataTable(dTable);
- // Set the column width
- var cols = table.object().find('thead tr th');
- cols.eq(0).css('width', '20px'); // HCP column
- cols.eq(1).css('width', '20px'); // Type column
- cols.eq(2).css('width', '20px'); // Name column
- cols.eq(3).css({'width': '600px'}); // Details column
- }
+ // Set the column width
+ var cols = table.object().find('thead tr th');
+ cols.eq(0).css('width', '20px'); // HCP column
+ cols.eq(1).css('width', '20px'); // Type column
+ cols.eq(2).css('width', '20px'); // Name column
+ cols.eq(3).css({'width': '600px'}); // Details column
+ }
- // Skip index 0 because it contains nothing
- var details = '
';
- for ( var i = 1; i < tmp.length; i++) {
- details += tmp[i];
- }
- details += '
';
-
- dTable.fnAddData([ '
' + hcp + '
', '
' + type + '
', '
' + name + '
', details ]);
-
- // Resize accordion
- $('#zvmResourceAccordion').accordion('resize');
+ // Skip index 0 because it contains nothing
+ var details = '
';
+ for ( var i = 1; i < tmp.length; i++) {
+ details += tmp[i];
+ }
+ details += '
';
+
+ dTable.fnAddData([ '
' + hcp + '
', '
' + type + '
', '
' + name + '
', details ]);
+
+ // Resize accordion
+ $('#zvmResourceAccordion').accordion('resize');
}
/**
* Connect a NIC to a Guest LAN
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function connect2GuestLan(data) {
- var rsp = data.rsp;
- var args = data.msg.split(';');
- var node = args[0].replace('node=', '');
- var address = args[1].replace('addr=', '');
- var lanName = args[2].replace('lan=', '');
- var lanOwner = args[3].replace('owner=', '');
-
- // Write ajax response to status bar
- var prg = writeRsp(rsp, node + ': ');
- $('#' + node + 'StatusBar').find('div').append(prg);
-
- // Connect NIC to Guest LAN
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--connectnic2guestlan;' + address + ';' + lanName + ';'
- + lanOwner,
- msg : node
- },
+ var rsp = data.rsp;
+ var args = data.msg.split(';');
+ var node = args[0].replace('node=', '');
+ var address = args[1].replace('addr=', '');
+ var lanName = args[2].replace('lan=', '');
+ var lanOwner = args[3].replace('owner=', '');
+
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, node + ': ');
+ $('#' + node + 'StatusBar').find('div').append(prg);
+
+ // Connect NIC to Guest LAN
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--connectnic2guestlan;' + address + ';' + lanName + ';'
+ + lanOwner,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
}
/**
* Connect a NIC to a VSwitch
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function connect2VSwitch(data) {
- var rsp = data.rsp;
- var args = data.msg.split(';');
- var node = args[0].replace('node=', '');
- var address = args[1].replace('addr=', '');
- var vswitchName = args[2].replace('vsw=', '');
-
- // Write ajax response to status bar
- var prg = writeRsp(rsp, node + ': ');
- $('#' + node + 'StatusBar').find('div').append(prg);
+ var rsp = data.rsp;
+ var args = data.msg.split(';');
+ var node = args[0].replace('node=', '');
+ var address = args[1].replace('addr=', '');
+ var vswitchName = args[2].replace('vsw=', '');
+
+ // Write ajax response to status bar
+ var prg = writeRsp(rsp, node + ': ');
+ $('#' + node + 'StatusBar').find('div').append(prg);
- // Connect NIC to VSwitch
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'chvm',
- tgt : node,
- args : '--connectnic2vswitch;' + address + ';' + vswitchName,
- msg : node
- },
+ // Connect NIC to VSwitch
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--connectnic2vswitch;' + address + ';' + vswitchName,
+ msg : node
+ },
- success : updateZNodeStatus
- });
+ success : updateZNodeStatus
+ });
}
/**
* Create provision existing node division
*
- * @param inst
- * Provision tab instance
+ * @param inst Provision tab instance
* @return Provision existing node division
*/
function createZProvisionExisting(inst) {
- // Create provision existing and hide it
- var provExisting = $('').hide();
-
- var vmFS = $('');
- var vmLegend = $('');
- vmFS.append(vmLegend);
- provExisting.append(vmFS);
-
- var vmAttr = $('');
- vmFS.append($('
'));
- vmFS.append(vmAttr);
-
- var osFS = $('');
- var osLegend = $('');
- osFS.append(osLegend);
- provExisting.append(osFS);
-
- var osAttr = $('');
- osFS.append($('
'));
- osFS.append(osAttr);
-
- // Create group input
- var group = $('');
- var groupLabel = $('');
- group.append(groupLabel);
-
- // Turn on auto complete for group
- 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 = $('');
- 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, 'zNodesDatatableDIV' + inst);
- }
- });
- } else {
- // If no groups are cookied
- var groupInput = $('');
- group.append(groupInput);
- }
- vmAttr.append(group);
+ // Create provision existing and hide it
+ var provExisting = $('').hide();
+
+ var vmFS = $('');
+ var vmLegend = $('');
+ vmFS.append(vmLegend);
+ provExisting.append(vmFS);
+
+ var vmAttr = $('');
+ vmFS.append($('
'));
+ vmFS.append(vmAttr);
+
+ var osFS = $('');
+ var osLegend = $('');
+ osFS.append(osLegend);
+ provExisting.append(osFS);
+
+ var osAttr = $('');
+ osFS.append($('
'));
+ osFS.append(osAttr);
+
+ // Create group input
+ var group = $('');
+ var groupLabel = $('');
+ group.append(groupLabel);
+
+ // Turn on auto complete for group
+ 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 = $('');
+ 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, 'zNodesDatatableDIV' + inst);
+ }
+ });
+ } else {
+ // If no groups are cookied
+ var groupInput = $('');
+ group.append(groupInput);
+ }
+ vmAttr.append(group);
- // Create node input
- var node = $('');
- var nodeLabel = $('');
- var nodeDatatable = $('
Select a group to view its nodes
');
- node.append(nodeLabel);
- node.append(nodeDatatable);
- vmAttr.append(node);
-
- // Create operating system image input
- var os = $('');
- var osLabel = $('');
- var osInput = $('');
- // Get image names on focus
- osInput.one('focus', function(){
- var imageNames = $.cookie('imagenames');
- if (imageNames) {
- // Turn on auto complete
- $(this).autocomplete({
- source: imageNames.split(',')
- });
- }
- });
- os.append(osLabel);
- os.append(osInput);
- osAttr.append(os);
-
- // Create boot method drop down
- var bootMethod = $('');
- var methoddLabel = $('');
- var methodSelect = $('');
- methodSelect.append(''
- + ''
- + ''
- + ''
- + ''
- );
- bootMethod.append(methoddLabel);
- bootMethod.append(methodSelect);
- osAttr.append(bootMethod);
-
- // Generate tooltips
- provExisting.find('div input[title]').tooltip({
- position: "center right",
- offset: [-2, 10],
- effect: "fade",
- opacity: 0.7,
- predelay: 800,
- events: {
- def: "mouseover,mouseout",
- input: "mouseover,mouseout",
- widget: "focus mouseover,blur mouseout",
- tooltip: "mouseover,mouseout"
- }
- });
-
- /**
- * Provision existing
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Remove any warning messages
- $(this).parent().parent().find('.ui-state-error').remove();
-
- var ready = true;
- var errMsg = '';
+ // Create node input
+ var node = $('');
+ var nodeLabel = $('');
+ var nodeDatatable = $('
Select a group to view its nodes
');
+ node.append(nodeLabel);
+ node.append(nodeDatatable);
+ vmAttr.append(node);
+
+ // Create operating system image input
+ var os = $('');
+ var osLabel = $('');
+ var osInput = $('');
+ // Get image names on focus
+ osInput.one('focus', function(){
+ var imageNames = $.cookie('imagenames');
+ if (imageNames) {
+ // Turn on auto complete
+ $(this).autocomplete({
+ source: imageNames.split(',')
+ });
+ }
+ });
+ os.append(osLabel);
+ os.append(osInput);
+ osAttr.append(os);
+
+ // Create boot method drop down
+ var bootMethod = $('');
+ var methoddLabel = $('');
+ var methodSelect = $('');
+ methodSelect.append(''
+ + ''
+ + ''
+ + ''
+ + ''
+ );
+ bootMethod.append(methoddLabel);
+ bootMethod.append(methodSelect);
+ osAttr.append(bootMethod);
+
+ // Generate tooltips
+ provExisting.find('div input[title]').tooltip({
+ position: "center right",
+ offset: [-2, 10],
+ effect: "fade",
+ opacity: 0.7,
+ predelay: 800,
+ events: {
+ def: "mouseover,mouseout",
+ input: "mouseover,mouseout",
+ widget: "focus mouseover,blur mouseout",
+ tooltip: "mouseover,mouseout"
+ }
+ });
+
+ /**
+ * Provision existing
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // Remove any warning messages
+ $(this).parent().parent().find('.ui-state-error').remove();
+
+ var ready = true;
+ var errMsg = '';
- // Get provision tab ID
- var thisTabId = $(this).parent().parent().parent().attr('id');
- // Get provision tab instance
- var inst = thisTabId.replace('zvmProvisionTab', '');
-
- // Get nodes that were checked
- var dTableId = 'zNodesDatatable' + inst;
- var tgts = getNodesChecked(dTableId);
- if (!tgts) {
- errMsg += 'You need to select a node. ';
- ready = false;
- }
-
- // Check operating system image
- var os = $('#' + thisTabId + ' input[name=os]:visible');
- if (!os.val()) {
- errMsg += 'You need to select a operating system image.';
- os.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- os.css('border', 'solid #BDBDBD 1px');
- }
-
- // If all inputs are valid, ready to provision
- if (ready) {
- // Disable provision button
- $(this).attr('disabled', 'true');
-
- // Show loader
- $('#zProvisionStatBar' + inst).show();
- $('#zProvisionLoader' + inst).show();
+ // Get provision tab ID
+ var thisTabId = $(this).parent().parent().parent().attr('id');
+ // Get provision tab instance
+ var inst = thisTabId.replace('zvmProvisionTab', '');
+
+ // Get nodes that were checked
+ var dTableId = 'zNodesDatatable' + inst;
+ var tgts = getNodesChecked(dTableId);
+ if (!tgts) {
+ errMsg += 'You need to select a node. ';
+ ready = false;
+ }
+
+ // Check operating system image
+ var os = $('#' + thisTabId + ' input[name=os]:visible');
+ if (!os.val()) {
+ errMsg += 'You need to select a operating system image.';
+ os.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ os.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // If all inputs are valid, ready to provision
+ if (ready) {
+ // Disable provision button
+ $(this).attr('disabled', 'true');
+
+ // Show loader
+ $('#zProvisionStatBar' + inst).show();
+ $('#zProvisionLoader' + inst).show();
- // Disable all inputs
- var inputs = $('#' + thisTabId + ' input:visible');
- inputs.attr('disabled', 'disabled');
-
- // Disable all selects
- var selects = $('#' + thisTabId + ' select');
- selects.attr('disabled', 'disabled');
-
- // Get operating system image
- var osImage = $('#' + thisTabId + ' input[name=os]:visible').val();
- var tmp = osImage.split('-');
- var os = tmp[0];
- var arch = tmp[1];
- var profile = tmp[3];
-
- /**
- * (1) Set operating system
- */
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeadd',
- tgt : '',
- args : tgts + ';noderes.netboot=zvm;nodetype.os=' + os + ';nodetype.arch=' + arch + ';nodetype.profile=' + profile,
- msg : 'cmd=nodeadd;out=' + inst
- },
+ // Disable all inputs
+ var inputs = $('#' + thisTabId + ' input:visible');
+ inputs.attr('disabled', 'disabled');
+
+ // Disable all selects
+ var selects = $('#' + thisTabId + ' select');
+ selects.attr('disabled', 'disabled');
+
+ // Get operating system image
+ var osImage = $('#' + thisTabId + ' input[name=os]:visible').val();
+ var tmp = osImage.split('-');
+ var os = tmp[0];
+ var arch = tmp[1];
+ var profile = tmp[3];
+
+ /**
+ * (1) Set operating system
+ */
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeadd',
+ tgt : '',
+ args : tgts + ';noderes.netboot=zvm;nodetype.os=' + os + ';nodetype.arch=' + arch + ';nodetype.profile=' + profile,
+ msg : 'cmd=nodeadd;out=' + inst
+ },
- success : updateZProvisionExistingStatus
- });
- } else {
- // Show warning message
- var warn = createWarnBar(errMsg);
- warn.prependTo($(this).parent().parent());
- }
- });
- provExisting.append(provisionBtn);
-
- return provExisting;
+ success : updateZProvisionExistingStatus
+ });
+ } else {
+ // Show warning message
+ var warn = createWarnBar(errMsg);
+ warn.prependTo($(this).parent().parent());
+ }
+ });
+ provExisting.append(provisionBtn);
+
+ return provExisting;
}
/**
* Create provision new node division
*
- * @param inst
- * Provision tab instance
+ * @param inst Provision tab instance
* @return Provision new node division
*/
function createZProvisionNew(inst) {
- // Create provision new node division
- var provNew = $('');
-
- // Create VM fieldset
- var vmFS = $('');
- var vmLegend = $('');
- vmFS.append(vmLegend);
- provNew.append(vmFS);
-
- var vmAttr = $('');
- vmFS.append($('
'));
- vmFS.append(vmAttr);
-
- // Create OS fieldset
- var osFS = $('');
- var osLegend = $('');
- osFS.append(osLegend);
- provNew.append(osFS);
-
- // Create hardware fieldset
- var hwFS = $('');
- var hwLegend = $('');
- hwFS.append(hwLegend);
- provNew.append(hwFS);
-
- var hwAttr = $('');
- hwFS.append($('
');
- diskRow.append(diskSize);
-
- // Create disk mode input
- var diskMode = $('
');
- var diskModeSelect = $('');
- diskModeSelect.append(''
- + ''
- + ''
- + ''
- + ''
- + ''
- + ''
- );
- diskMode.append(diskModeSelect);
- diskRow.append(diskMode);
+ // Create disk type drop down
+ var diskType = $('
');
+ var diskTypeSelect = $('');
+ diskTypeSelect.append(''
+ + ''
+ );
+ diskType.append(diskTypeSelect);
+ diskRow.append(diskType);
- // Get list of disk pools
- var thisTabId = $(this).parents('.tab').attr('id');
- var thisHcp = $('#' + thisTabId + ' input[name=hcp]').val();
- var definedPools;
- if (thisHcp) {
- // Get node without domain name
- var temp = thisHcp.split('.');
- definedPools = $.cookie(temp[0] + 'diskpools');
- }
+ // Create disk address input
+ var diskAddr = $('
');
+ diskRow.append(diskAddr);
- // Create disk pool input
- // Turn on auto complete for disk pool
- var diskPoolInput = $('').autocomplete({
- source: definedPools.split(',')
- });
- var diskPool = $('
').append(diskPoolInput);
- diskRow.append(diskPool);
+ // Create disk size input
+ var diskSize = $('
');
+ diskRow.append(diskSize);
+
+ // Create disk mode input
+ var diskMode = $('
');
- diskRow.append(diskPw);
+ // Get list of disk pools
+ var thisTabId = $(this).parents('.tab').attr('id');
+ var thisHcp = $('#' + thisTabId + ' input[name=hcp]').val();
+ var definedPools = null;
+ if (thisHcp) {
+ // Get node without domain name
+ var temp = thisHcp.split('.');
+ definedPools = $.cookie(temp[0] + 'diskpools');
+ }
- diskBody.append(diskRow);
-
- // Generate tooltips
- diskBody.find('td input[title]').tooltip({
- position: "top right",
- offset: [-4, 4],
- effect: "fade",
- opacity: 0.7,
- predelay: 800,
- events: {
- def: "mouseover,mouseout",
- input: "mouseover,mouseout",
- widget: "focus mouseover,blur mouseout",
- tooltip: "mouseover,mouseout"
- }
- });
- });
-
- // Create disk table
- diskFooter.append(addDiskLink);
- diskTable.append(diskHeader);
- diskTable.append(diskBody);
- diskTable.append(diskFooter);
-
- diskDiv.append(diskLabel);
- diskDiv.append(diskTable);
- hwAttr.append(diskDiv);
-
- // Generate tooltips
- provNew.find('div input[title]').tooltip({
- position: "center right",
- offset: [-2, 10],
- effect: "fade",
- opacity: 0.7,
- predelay: 800,
- events: {
- def: "mouseover,mouseout",
- input: "mouseover,mouseout",
- widget: "focus mouseover,blur mouseout",
- tooltip: "mouseover,mouseout"
- }
- });
-
- /**
- * Provision new
- */
- var provisionBtn = createButton('Provision');
- provisionBtn.bind('click', function(event) {
- // Remove any warning messages
- $(this).parent().parent().find('.ui-state-error').remove();
-
- var ready = true;
- var errMsg = '';
+ // Create disk pool input
+ // Turn on auto complete for disk pool
+ var diskPoolInput = $('').autocomplete({
+ source: definedPools.split(',')
+ });
+ var diskPool = $('
').append(diskPoolInput);
+ diskRow.append(diskPool);
- // Get tab ID
- var thisTabId = $(this).parents('.ui-tabs-panel').attr('id');
- // Get provision tab instance
- var inst = thisTabId.replace('zvmProvisionTab', '');
+ // Create disk password input
+ var diskPw = $('
');
+ diskRow.append(diskPw);
- // Check node name, userId, hardware control point, and group
- var inputs = $('#' + thisTabId + ' input:visible');
- 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');
- }
- }
+ diskBody.append(diskRow);
+
+ // Generate tooltips
+ diskBody.find('td input[title]').tooltip({
+ position: "top right",
+ offset: [-4, 4],
+ effect: "fade",
+ opacity: 0.7,
+ predelay: 800,
+ events: {
+ def: "mouseover,mouseout",
+ input: "mouseover,mouseout",
+ widget: "focus mouseover,blur mouseout",
+ tooltip: "mouseover,mouseout"
+ }
+ });
+ });
+
+ // Create disk table
+ diskFooter.append(addDiskLink);
+ diskTable.append(diskHeader);
+ diskTable.append(diskBody);
+ diskTable.append(diskFooter);
+
+ diskDiv.append(diskLabel);
+ diskDiv.append(diskTable);
+ hwAttr.append(diskDiv);
+
+ // Generate tooltips
+ provNew.find('div input[title]').tooltip({
+ position: "center right",
+ offset: [-2, 10],
+ effect: "fade",
+ opacity: 0.7,
+ predelay: 800,
+ events: {
+ def: "mouseover,mouseout",
+ input: "mouseover,mouseout",
+ widget: "focus mouseover,blur mouseout",
+ tooltip: "mouseover,mouseout"
+ }
+ });
+
+ /**
+ * Provision new
+ */
+ var provisionBtn = createButton('Provision');
+ provisionBtn.bind('click', function(event) {
+ // Remove any warning messages
+ $(this).parent().parent().find('.ui-state-error').remove();
+
+ var ready = true;
+ var errMsg = '';
- // Check user entry
- var thisUserEntry = $('#' + thisTabId + ' textarea:visible');
- thisUserEntry.val(thisUserEntry.val().toUpperCase());
- if (!thisUserEntry.val()) {
- thisUserEntry.css('border', 'solid #FF0000 1px');
- ready = false;
- } else {
- thisUserEntry.css('border', 'solid #BDBDBD 1px');
- }
-
- // Show error message for missing inputs
- if (!ready) {
- errMsg = errMsg + 'Please provide a value for each missing field. ';
- }
+ // Get tab ID
+ var thisTabId = $(this).parents('.ui-tabs-panel').attr('id');
+ // Get provision tab instance
+ var inst = thisTabId.replace('zvmProvisionTab', '');
- // Check if user entry contains user ID
- var thisUserId = $('#' + thisTabId + ' input[name=userId]:visible');
- var pos = thisUserEntry.val().indexOf('USER ' + thisUserId.val().toUpperCase());
- if (pos < 0) {
- errMsg = errMsg + 'The directory entry does not contain the correct user ID. ';
- ready = false;
- }
+ // Check node name, userId, hardware control point, and group
+ var inputs = $('#' + thisTabId + ' input:visible');
+ 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');
+ }
+ }
- // If no operating system is specified, create only user entry
- os = $('#' + thisTabId + ' input[name=os]:visible');
-
- // 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 user entry
+ var thisUserEntry = $('#' + thisTabId + ' textarea:visible');
+ thisUserEntry.val(thisUserEntry.val().toUpperCase());
+ if (!thisUserEntry.val()) {
+ thisUserEntry.css('border', 'solid #FF0000 1px');
+ ready = false;
+ } else {
+ thisUserEntry.css('border', 'solid #BDBDBD 1px');
+ }
+
+ // Show error message for missing inputs
+ if (!ready) {
+ errMsg = errMsg + 'Please provide a value for each missing field. ';
+ }
- // Check address, size, mode, pool, and password
- var diskArgs = $('#' + thisTabId + ' table input:visible');
- 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 inputs are valid, ready to provision
- 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 a virtual server without an operating system?';
- } else {
- // If no disks are given, create a virtual server (no disk)
- msg = 'Do you want to create a virtual server without an operating system or disks?';
- }
+ // Check if user entry contains user ID
+ var thisUserId = $('#' + thisTabId + ' input[name=userId]:visible');
+ var pos = thisUserEntry.val().indexOf('USER ' + thisUserId.val().toUpperCase());
+ if (pos < 0) {
+ errMsg = errMsg + 'The directory entry does not contain the correct user ID. ';
+ ready = false;
+ }
- // Open dialog to confirm
- var confirmDialog = $('
' + msg + '
');
- confirmDialog.dialog({
- title:'Confirm',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 400,
- buttons: {
- "Ok": function(){
- // Disable provision button
- provisionBtn.attr('disabled', 'true');
-
- // Show loader
- $('#zProvisionStatBar' + inst).show();
- $('#zProvisionLoader' + inst).show();
+ // If no operating system is specified, create only user entry
+ os = $('#' + thisTabId + ' input[name=os]:visible');
+
+ // 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;
+ }
- // Disable add disk button
- addDiskLink.attr('disabled', 'true');
-
- // Disable close button on disk table
- $('#' + thisTabId + ' table span').unbind('click');
-
- // Disable all inputs
- var inputs = $('#' + thisTabId + ' input');
- inputs.attr('disabled', 'disabled');
-
- // Disable all selects
- var selects = $('#' + thisTabId + ' select');
- selects.attr('disabled', 'disabled');
-
- // Add a new line at the end of the user entry
- var textarea = $('#' + thisTabId + ' textarea');
- var tmp = jQuery.trim(textarea.val());
- textarea.val(tmp + '\n');
- textarea.attr('readonly', 'readonly');
- textarea.css( {
- 'background-color' : '#F2F2F2'
- });
+ // Check address, size, mode, pool, and password
+ var diskArgs = $('#' + thisTabId + ' table input:visible');
+ 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 inputs are valid, ready to provision
+ 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 a virtual server without an operating system?';
+ } else {
+ // If no disks are given, create a virtual server (no disk)
+ msg = 'Do you want to create a virtual server without an operating system or disks?';
+ }
- // 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();
- // Get IP address and hostname
- var ip = $('#' + thisTabId + ' input[name=ip]').val();
- var hostname = $('#' + thisTabId + ' input[name=hostname]').val();
-
- // Generate arguments to sent
- var args = node + ';zvm.hcp=' + hcp
- + ';zvm.userid=' + userId
- + ';nodehm.mgt=zvm'
- + ';groups=' + group;
- if (ip)
- args += ';hosts.ip=' + ip;
-
- if (hostname)
- args += ';hosts.hostnames=' + hostname;
+ // Open dialog to confirm
+ var confirmDialog = $('
' + msg + '
');
+ confirmDialog.dialog({
+ title:'Confirm',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 400,
+ buttons: {
+ "Ok": function(){
+ // Disable provision button
+ provisionBtn.attr('disabled', 'true');
+
+ // Show loader
+ $('#zProvisionStatBar' + inst).show();
+ $('#zProvisionLoader' + inst).show();
- /**
- * (1) Define node
- */
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeadd',
- tgt : '',
- args : args,
- msg : 'cmd=nodeadd;out=' + inst
- },
+ // Disable add disk button
+ addDiskLink.attr('disabled', 'true');
+
+ // Disable close button on disk table
+ $('#' + thisTabId + ' table span').unbind('click');
+
+ // Disable all inputs
+ var inputs = $('#' + thisTabId + ' input');
+ inputs.attr('disabled', 'disabled');
+
+ // Disable all selects
+ var selects = $('#' + thisTabId + ' select');
+ selects.attr('disabled', 'disabled');
+
+ // Add a new line at the end of the user entry
+ var textarea = $('#' + thisTabId + ' textarea');
+ var tmp = jQuery.trim(textarea.val());
+ textarea.val(tmp + '\n');
+ textarea.attr('readonly', 'readonly');
+ textarea.css( {
+ 'background-color' : '#F2F2F2'
+ });
- success : updateZProvisionNewStatus
- });
-
- $(this).dialog("close");
- },
- "Cancel": function() {
- $(this).dialog("close");
- }
- }
- });
- } else {
- /**
- * Create a virtual server and install OS
- */
+ // 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();
+ // Get IP address and hostname
+ var ip = $('#' + thisTabId + ' input[name=ip]').val();
+ var hostname = $('#' + thisTabId + ' input[name=hostname]').val();
+
+ // Generate arguments to sent
+ var args = node + ';zvm.hcp=' + hcp
+ + ';zvm.userid=' + userId
+ + ';nodehm.mgt=zvm'
+ + ';groups=' + group;
+ if (ip)
+ args += ';hosts.ip=' + ip;
+
+ if (hostname)
+ args += ';hosts.hostnames=' + hostname;
- // Disable provision button
- $(this).attr('disabled', 'true');
-
- // Show loader
- $('#zProvisionStatBar' + inst).show();
- $('#zProvisionLoader' + inst).show();
+ /**
+ * (1) Define node
+ */
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeadd',
+ tgt : '',
+ args : args,
+ msg : 'cmd=nodeadd;out=' + inst
+ },
- // Disable add disk button
- addDiskLink.attr('disabled', 'true');
-
- // Disable close button on disk table
- $('#' + thisTabId + ' table span').unbind('click');
+ success : updateZProvisionNewStatus
+ });
+
+ $(this).dialog("close");
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+ }
+ }
+ });
+ } else {
+ /**
+ * Create a virtual server and install OS
+ */
- // Disable all inputs
- var inputs = $('#' + thisTabId + ' input');
- inputs.attr('disabled', 'disabled');
- inputs.css( {
- 'background-color' : '#F2F2F2'
- });
-
- // Disable all selects
- var selects = $('#' + thisTabId + ' select');
- selects.attr('disabled', 'disabled');
- selects.css( {
- 'background-color' : '#F2F2F2'
- });
-
- // Add a new line at the end of the user entry
- var textarea = $('#' + thisTabId + ' textarea');
- var tmp = jQuery.trim(textarea.val());
- textarea.val(tmp + '\n');
- textarea.attr('readonly', 'readonly');
- textarea.css( {
- 'background-color' : '#F2F2F2'
- });
+ // Disable provision button
+ $(this).attr('disabled', 'true');
+
+ // Show loader
+ $('#zProvisionStatBar' + inst).show();
+ $('#zProvisionLoader' + inst).show();
- // 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();
- // Get IP address and hostname
- var ip = $('#' + thisTabId + ' input[name=ip]').val();
- var hostname = $('#' + thisTabId + ' input[name=hostname]').val();
-
- // Generate arguments to sent
- var args = node + ';zvm.hcp=' + hcp
- + ';zvm.userid=' + userId
- + ';nodehm.mgt=zvm'
- + ';groups=' + group;
- if (ip)
- args += ';hosts.ip=' + ip;
-
- if (hostname)
- args += ';hosts.hostnames=' + hostname;
+ // Disable add disk button
+ addDiskLink.attr('disabled', 'true');
+
+ // Disable close button on disk table
+ $('#' + thisTabId + ' table span').unbind('click');
- /**
- * (1) Define node
- */
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'nodeadd',
- tgt : '',
- args : args,
- msg : 'cmd=nodeadd;out=' + inst
- },
+ // Disable all inputs
+ var inputs = $('#' + thisTabId + ' input');
+ inputs.attr('disabled', 'disabled');
+ inputs.css( {
+ 'background-color' : '#F2F2F2'
+ });
+
+ // Disable all selects
+ var selects = $('#' + thisTabId + ' select');
+ selects.attr('disabled', 'disabled');
+ selects.css( {
+ 'background-color' : '#F2F2F2'
+ });
+
+ // Add a new line at the end of the user entry
+ var textarea = $('#' + thisTabId + ' textarea');
+ var tmp = jQuery.trim(textarea.val());
+ textarea.val(tmp + '\n');
+ textarea.attr('readonly', 'readonly');
+ textarea.css( {
+ 'background-color' : '#F2F2F2'
+ });
- success : updateZProvisionNewStatus
- });
- }
- } else {
- // Show warning message
- var warn = createWarnBar(errMsg);
- warn.prependTo($(this).parent().parent());
- }
- });
- provNew.append(provisionBtn);
-
- return provNew;
+ // 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();
+ // Get IP address and hostname
+ var ip = $('#' + thisTabId + ' input[name=ip]').val();
+ var hostname = $('#' + thisTabId + ' input[name=hostname]').val();
+
+ // Generate arguments to sent
+ var args = node + ';zvm.hcp=' + hcp
+ + ';zvm.userid=' + userId
+ + ';nodehm.mgt=zvm'
+ + ';groups=' + group;
+ if (ip)
+ args += ';hosts.ip=' + ip;
+
+ if (hostname)
+ args += ';hosts.hostnames=' + hostname;
+
+ /**
+ * (1) Define node
+ */
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'nodeadd',
+ tgt : '',
+ args : args,
+ msg : 'cmd=nodeadd;out=' + inst
+ },
+
+ success : updateZProvisionNewStatus
+ });
+ }
+ } else {
+ // Show warning message
+ var warn = createWarnBar(errMsg);
+ warn.prependTo($(this).parent().parent());
+ }
+ });
+ provNew.append(provisionBtn);
+
+ return provNew;
}
/**
* Load zVMs into column (service page)
*
- * @param col
- * Table column where OS images will be placed
- * @return Nothing
+ * @param col Table column where OS images will be placed
*/
function loadzVMs(col) {
- // Get group names and description and append to group column
- var groupNames = $.cookie('srv_zvms').split(',');
- var radio, zvmBlock, args, zvm, hcp;
- for (var i in groupNames) {
- args = groupNames[i].split(':');
- zvm = args[0];
- hcp = args[1];
-
- // Create block for each group
- zvmBlock = $('').css({
- 'border': '1px solid',
- 'max-width': '200px',
- 'margin': '5px auto',
- 'padding': '5px',
- 'display': 'block',
- 'vertical-align': 'middle',
- 'cursor': 'pointer',
- 'white-space': 'normal'
- }).click(function(){
- $(this).children('input:radio').attr('checked', 'checked');
- $(this).parents('td').find('div').attr('class', 'ui-state-default');
- $(this).attr('class', 'ui-state-active');
- });
- radio = $('').css('display', 'none');
- zvmBlock.append(radio, $('' + zvm + ' managed by ' + hcp + ''));
- zvmBlock.children('span').css({
- 'display': 'block',
- 'margin': '5px',
- 'text-align': 'left'
- });
- col.append(zvmBlock);
- }
+ // Get group names and description and append to group column
+ var groupNames = $.cookie('srv_zvms').split(',');
+ var radio, zvmBlock, args, zvm, hcp;
+ for (var i in groupNames) {
+ args = groupNames[i].split(':');
+ zvm = args[0];
+ hcp = args[1];
+
+ // Create block for each group
+ zvmBlock = $('').css({
+ 'border': '1px solid',
+ 'max-width': '200px',
+ 'margin': '5px auto',
+ 'padding': '5px',
+ 'display': 'block',
+ 'vertical-align': 'middle',
+ 'cursor': 'pointer',
+ 'white-space': 'normal'
+ }).click(function(){
+ $(this).children('input:radio').attr('checked', 'checked');
+ $(this).parents('td').find('div').attr('class', 'ui-state-default');
+ $(this).attr('class', 'ui-state-active');
+ });
+ radio = $('').css('display', 'none');
+ zvmBlock.append(radio, $('' + zvm + ' managed by ' + hcp + ''));
+ zvmBlock.children('span').css({
+ 'display': 'block',
+ 'margin': '5px',
+ 'text-align': 'left'
+ });
+ col.append(zvmBlock);
+ }
}
/**
* Load groups into column
*
- * @param col
- * Table column where OS images will be placed
- * @return Nothing
+ * @param col Table column where OS images will be placed
*/
function loadSrvGroups(col) {
- // Get group names and description and append to group column
- var groupNames = $.cookie('srv_groups').split(',');
- var groupBlock, radio, args, name, ip, hostname, desc;
- for (var i in groupNames) {
- args = groupNames[i].split(':');
- name = args[0];
- ip = args[1];
- hostname = args[2];
- desc = args[3];
-
- // Create block for each group
- groupBlock = $('').css({
- 'border': '1px solid',
- 'max-width': '200px',
- 'margin': '5px auto',
- 'padding': '5px',
- 'display': 'block',
- 'vertical-align': 'middle',
- 'cursor': 'pointer',
- 'white-space': 'normal'
- }).click(function(){
- $(this).children('input:radio').attr('checked', 'checked');
- $(this).parents('td').find('div').attr('class', 'ui-state-default');
- $(this).attr('class', 'ui-state-active');
- });
- radio = $('').css('display', 'none');
- groupBlock.append(radio, $('' + name + ': ' + desc + ''));
- groupBlock.children('span').css({
- 'display': 'block',
- 'margin': '5px',
- 'text-align': 'left'
- });
- col.append(groupBlock);
- }
+ // Get group names and description and append to group column
+ var groupNames = $.cookie('srv_groups').split(',');
+ var groupBlock, radio, args, name, ip, hostname, desc;
+ for (var i in groupNames) {
+ args = groupNames[i].split(':');
+ name = args[0];
+ ip = args[1];
+ hostname = args[2];
+ desc = args[3];
+
+ // Create block for each group
+ groupBlock = $('').css({
+ 'border': '1px solid',
+ 'max-width': '200px',
+ 'margin': '5px auto',
+ 'padding': '5px',
+ 'display': 'block',
+ 'vertical-align': 'middle',
+ 'cursor': 'pointer',
+ 'white-space': 'normal'
+ }).click(function(){
+ $(this).children('input:radio').attr('checked', 'checked');
+ $(this).parents('td').find('div').attr('class', 'ui-state-default');
+ $(this).attr('class', 'ui-state-active');
+ });
+ radio = $('').css('display', 'none');
+ groupBlock.append(radio, $('' + name + ': ' + desc + ''));
+ groupBlock.children('span').css({
+ 'display': 'block',
+ 'margin': '5px',
+ 'text-align': 'left'
+ });
+ col.append(groupBlock);
+ }
}
/**
* Load OS images into column
*
- * @param col
- * Table column where OS images will be placed
- * @return Nothing
+ * @param col Table column where OS images will be placed
*/
function loadOSImages(col) {
- // Get group names and description and append to group column
- var imgNames = $.cookie('srv_imagenames').split(',');
- var imgBlock, radio, args, name, desc;
- for (var i in imgNames) {
- args = imgNames[i].split(':');
- name = args[0];
- desc = args[1];
-
- // Create block for each image
- imgBlock = $('').css({
- 'border': '1px solid',
- 'max-width': '200px',
- 'margin': '5px auto',
- 'padding': '5px',
- 'display': 'block',
- 'vertical-align': 'middle',
- 'cursor': 'pointer',
- 'white-space': 'normal'
- }).click(function(){
- $(this).children('input:radio').attr('checked', 'checked');
- $(this).parents('td').find('div').attr('class', 'ui-state-default');
- $(this).attr('class', 'ui-state-active');
- });
- radio = $('').css('display', 'none');
- imgBlock.append(radio, $('' + name + ': ' + desc + ''));
- imgBlock.children('span').css({
- 'display': 'block',
- 'margin': '5px',
- 'text-align': 'left'
- });
- col.append(imgBlock);
- }
+ // Get group names and description and append to group column
+ var imgNames = $.cookie('srv_imagenames').split(',');
+ var imgBlock, radio, args, name, desc;
+ for (var i in imgNames) {
+ args = imgNames[i].split(':');
+ name = args[0];
+ desc = args[1];
+
+ // Create block for each image
+ imgBlock = $('').css({
+ 'border': '1px solid',
+ 'max-width': '200px',
+ 'margin': '5px auto',
+ 'padding': '5px',
+ 'display': 'block',
+ 'vertical-align': 'middle',
+ 'cursor': 'pointer',
+ 'white-space': 'normal'
+ }).click(function(){
+ $(this).children('input:radio').attr('checked', 'checked');
+ $(this).parents('td').find('div').attr('class', 'ui-state-default');
+ $(this).attr('class', 'ui-state-active');
+ });
+ radio = $('').css('display', 'none');
+ imgBlock.append(radio, $('' + name + ': ' + desc + ''));
+ imgBlock.children('span').css({
+ 'display': 'block',
+ 'margin': '5px',
+ 'text-align': 'left'
+ });
+ col.append(imgBlock);
+ }
}
/**
* Set a cookie for zVM host names (service page)
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function setzVMCookies(data) {
- if (data.rsp) {
- var zvms = new Array();
- for ( var i = 0; i < data.rsp.length; i++) {
- zvms.push(data.rsp[i]);
- }
-
- // Set cookie to expire in 60 minutes
- var exDate = new Date();
- exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
- $.cookie('srv_zvms', zvms, { expires: exDate });
- }
+ if (data.rsp) {
+ var zvms = new Array();
+ for ( var i = 0; i < data.rsp.length; i++) {
+ zvms.push(data.rsp[i]);
+ }
+
+ // Set cookie to expire in 60 minutes
+ var exDate = new Date();
+ exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
+ $.cookie('srv_zvms', zvms, { expires: exDate });
+ }
}
/**
* Set a cookie for disk pool names of a given node (service page)
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function setDiskPoolCookies(data) {
- if (data.rsp) {
- var node = data.msg;
- var pools = data.rsp[0].split(node + ': ');
- for (var i in pools) {
- pools[i] = jQuery.trim(pools[i]);
- }
-
- // Set cookie to expire in 60 minutes
- var exDate = new Date();
- exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
- $.cookie(node + 'diskpools', pools, { expires: exDate });
- }
+ if (data.rsp) {
+ var node = data.msg;
+ var pools = data.rsp[0].split(node + ': ');
+ for (var i in pools) {
+ pools[i] = jQuery.trim(pools[i]);
+ }
+
+ // Set cookie to expire in 60 minutes
+ var exDate = new Date();
+ exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
+ $.cookie(node + 'diskpools', pools, { expires: exDate });
+ }
}
/**
* Create virtual machine (service page)
*
- * @param tabId
- * Tab ID
- * @param group
- * Group
- * @param hcp
- * Hardware control point
- * @param img
- * OS image
- * @return Nothing
+ * @param tabId Tab ID
+ * @param group Group
+ * @param hcp Hardware control point
+ * @param img OS image
*/
function createzVM(tabId, group, hcp, img, owner) {
- // Submit request to create VM
- // webportal provzlinux [group] [hcp] [image] [owner]
- var iframe = createIFrame('lib/srv_cmd.php?cmd=webportal&tgt=&args=provzlinux;' + group + ';' + hcp + ';' + img + ';' + owner + '&msg=&opts=flush');
- iframe.prependTo($('#' + tabId));
+ // Submit request to create VM
+ // webportal provzlinux [group] [hcp] [image] [owner]
+ var iframe = createIFrame('lib/srv_cmd.php?cmd=webportal&tgt=&args=provzlinux;' + group + ';' + hcp + ';' + img + ';' + owner + '&msg=&opts=flush');
+ iframe.prependTo($('#' + tabId));
}
/**
* Query the profiles that exists
*
- * @param panelId
- * Panel ID
- * @return Nothing
+ * @param panelId Panel ID
*/
function queryProfiles(panelId) {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'osimage',
- msg : panelId
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'osimage',
+ msg : panelId
+ },
- success : function(data) {
- var panelId = data.msg;
- setOSImageCookies(data);
- configProfilePanel(panelId);
- }
- });
+ success : function(data) {
+ var panelId = data.msg;
+ setOSImageCookies(data);
+ configProfilePanel(panelId);
+ }
+ });
}
/**
* Query the images that exists
*
- * @param panelId
- * Panel ID
- * @return Nothing
+ * @param panelId Panel ID
*/
function queryImages(panelId) {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'osimage',
- msg : panelId
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'osimage',
+ msg : panelId
+ },
- success : configImagePanel
- });
+ success : configImagePanel
+ });
}
/**
* Query the groups that exists
*
- * @param panelId
- * Panel ID
- * @return Nothing
+ * @param panelId Panel ID
*/
function queryGroups(panelId) {
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'hosts',
- msg : panelId
- },
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'hosts',
+ msg : panelId
+ },
- success : configGroupPanel
- });
+ success : configGroupPanel
+ });
}
/**
* Panel to configure groups
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
-function configGroupPanel(data) {
- var panelId = data.msg;
- var rsp = data.rsp;
-
- // Wipe panel clean
- $('#' + panelId).empty();
+function configGroupPanel(data) {
+ var panelId = data.msg;
+ var rsp = data.rsp;
+
+ // Wipe panel clean
+ $('#' + panelId).empty();
- // Add info bar
- $('#' + panelId).append(createInfoBar('Create, edit, and delete groups for the self-service portal.'));
-
- // Create table
- var tableId = 'zvmGroupTable';
- var table = new DataTable(tableId);
- table.init(['', 'Name', 'Selectable', 'IP', 'Hostname', 'Network', 'Description']);
+ // Add info bar
+ $('#' + panelId).append(createInfoBar('Create, edit, and delete groups for the self-service portal.'));
+
+ // Create table
+ var tableId = 'zvmGroupTable';
+ var table = new DataTable(tableId);
+ table.init(['', 'Name', 'Selectable', 'IP', 'Hostname', 'Network', 'Description']);
- // Insert groups into table
- var nodePos = 0;
- var ipPos = 0;
- var hostnamePos = 0;
- var commentsPos = 0;
- var desc, selectable, tmp;
- // Get column index for each attribute
- var colNameArray = rsp[0].substr(1).split(',');
- for (var i in colNameArray){
- switch (colNameArray[i]){
- case 'node':
- nodePos = i;
- break;
-
- case 'ip':
- ipPos = i;
- break;
-
- case 'hostnames':
- hostnamePos = i;
- break;
-
- case 'comments':
- commentsPos = i;
- break;
-
- default :
- break;
- }
- }
-
- // Go through each index
- for (var i = 1; i < rsp.length; i++) {
- // Get image name
- var cols = rsp[i].split(',');
- var name = cols[nodePos].replace(new RegExp('"', 'g'), '');
- var ip = cols[ipPos].replace(new RegExp('"', 'g'), '');
- var hostname = cols[hostnamePos].replace(new RegExp('"', 'g'), '');
- var comments = cols[commentsPos].replace(new RegExp('"', 'g'), '');
-
- // Set default description and selectable
- selectable = "no";
- network = "";
- desc = "No description";
-
- if (comments) {
- tmp = comments.split('|');
- for (var j = 0; j < tmp.length; j++) {
- // Save description
- if (tmp[j].indexOf('description:') > -1) {
- desc = tmp[j].replace('description:', '');
- desc = jQuery.trim(desc);
- }
-
- // Save network
- if (tmp[j].indexOf('network:') > -1) {
- network = tmp[j].replace('network:', '');
- network = jQuery.trim(network);
- }
-
- // Is the group selectable?
- if (tmp[j].indexOf('selectable:') > -1) {
- selectable = tmp[j].replace('selectable:', '');
- selectable = jQuery.trim(selectable);
- }
- }
- }
-
- // Columns are: name, selectable, network, and description
- var cols = new Array(name, selectable, ip, hostname, network, desc);
+ // Insert groups into table
+ var nodePos = 0;
+ var ipPos = 0;
+ var hostnamePos = 0;
+ var commentsPos = 0;
+ var desc, selectable, tmp;
+ // Get column index for each attribute
+ var colNameArray = rsp[0].substr(1).split(',');
+ for (var i in colNameArray){
+ switch (colNameArray[i]){
+ case 'node':
+ nodePos = i;
+ break;
+
+ case 'ip':
+ ipPos = i;
+ break;
+
+ case 'hostnames':
+ hostnamePos = i;
+ break;
+
+ case 'comments':
+ commentsPos = i;
+ break;
+
+ default :
+ break;
+ }
+ }
+
+ // Go through each index
+ for (var i = 1; i < rsp.length; i++) {
+ // Get image name
+ var cols = rsp[i].split(',');
+ var name = cols[nodePos].replace(new RegExp('"', 'g'), '');
+ var ip = cols[ipPos].replace(new RegExp('"', 'g'), '');
+ var hostname = cols[hostnamePos].replace(new RegExp('"', 'g'), '');
+ var comments = cols[commentsPos].replace(new RegExp('"', 'g'), '');
+
+ // Set default description and selectable
+ selectable = "no";
+ network = "";
+ desc = "No description";
+
+ if (comments) {
+ tmp = comments.split('|');
+ for (var j = 0; j < tmp.length; j++) {
+ // Save description
+ if (tmp[j].indexOf('description:') > -1) {
+ desc = tmp[j].replace('description:', '');
+ desc = jQuery.trim(desc);
+ }
+
+ // Save network
+ if (tmp[j].indexOf('network:') > -1) {
+ network = tmp[j].replace('network:', '');
+ network = jQuery.trim(network);
+ }
+
+ // Is the group selectable?
+ if (tmp[j].indexOf('selectable:') > -1) {
+ selectable = tmp[j].replace('selectable:', '');
+ selectable = jQuery.trim(selectable);
+ }
+ }
+ }
+
+ // Columns are: name, selectable, network, and description
+ var cols = new Array(name, selectable, ip, hostname, network, desc);
- // Add remove button where id = user name
- cols.unshift('');
+ // Add remove button where id = user name
+ cols.unshift('');
- // Add row
- table.add(cols);
- }
-
- // Append datatable to tab
- $('#' + panelId).append(table.object());
+ // Add row
+ table.add(cols);
+ }
+
+ // Append datatable to tab
+ $('#' + panelId).append(table.object());
- // Turn into datatable
- var dTable = $('#' + tableId).dataTable({
- 'iDisplayLength': 50,
- 'bLengthChange': false,
- "sScrollX": "100%",
- "bAutoWidth": true
- });
-
- // Create action bar
- var actionBar = $('');
-
- // Create a group
- var createLnk = $('Create');
- createLnk.click(function() {
- groupDialog();
- });
-
- // Edit a group
- var editLnk = $('Edit');
- editLnk.click(function() {
- var groups = $('#' + tableId + ' input[type=checkbox]:checked');
- for (var i in groups) {
- var group = groups.eq(i).attr('name');
- if (group) {
- // Column order is: name, selectable, network, and description
- var cols = groups.eq(i).parents('tr').find('td');
- var selectable = cols.eq(2).text();
- var ip = cols.eq(3).text();
- var hostnames = cols.eq(4).text();
- var network = cols.eq(5).text();
- var description = cols.eq(6).text();
-
- editGroupDialog(group, selectable, ip, hostnames, network, description);
- }
- }
- });
-
- // Delete a profile
- var deleteLnk = $('Delete');
- deleteLnk.click(function() {
- var groups = getNodesChecked(tableId);
- if (groups) {
- deleteGroupDialog(groups);
- }
- });
-
- // Refresh profiles table
- var refreshLnk = $('Refresh');
- refreshLnk.click(function() {
- queryGroups(panelId);
- });
-
- // Create an action menu
- var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
- actionsMenu.superfish();
- actionsMenu.css('display', 'inline-block');
- actionBar.append(actionsMenu);
-
- // Set correct theme for action menu
- actionsMenu.find('li').hover(function() {
- setMenu2Theme($(this));
- }, function() {
- setMenu2Normal($(this));
- });
-
- // Create a division to hold actions menu
- var menuDiv = $('');
- $('#' + tableId + '_wrapper').prepend(menuDiv);
- menuDiv.append(actionBar);
- $('#' + tableId + '_filter').appendTo(menuDiv);
+ // Turn into datatable
+ $('#' + tableId).dataTable({
+ 'iDisplayLength': 50,
+ 'bLengthChange': false,
+ "sScrollX": "100%",
+ "bAutoWidth": true
+ });
+
+ // Create action bar
+ var actionBar = $('');
+
+ // Create a group
+ var createLnk = $('Create');
+ createLnk.click(function() {
+ groupDialog();
+ });
+
+ // Edit a group
+ var editLnk = $('Edit');
+ editLnk.click(function() {
+ var groups = $('#' + tableId + ' input[type=checkbox]:checked');
+ for (var i in groups) {
+ var group = groups.eq(i).attr('name');
+ if (group) {
+ // Column order is: name, selectable, network, and description
+ var cols = groups.eq(i).parents('tr').find('td');
+ var selectable = cols.eq(2).text();
+ var ip = cols.eq(3).text();
+ var hostnames = cols.eq(4).text();
+ var network = cols.eq(5).text();
+ var description = cols.eq(6).text();
+
+ editGroupDialog(group, selectable, ip, hostnames, network, description);
+ }
+ }
+ });
+
+ // Delete a profile
+ var deleteLnk = $('Delete');
+ deleteLnk.click(function() {
+ var groups = getNodesChecked(tableId);
+ if (groups) {
+ deleteGroupDialog(groups);
+ }
+ });
+
+ // Refresh profiles table
+ var refreshLnk = $('Refresh');
+ refreshLnk.click(function() {
+ queryGroups(panelId);
+ });
+
+ // Create an action menu
+ var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + tableId + '_wrapper').prepend(menuDiv);
+ menuDiv.append(actionBar);
+ $('#' + tableId + '_filter').appendTo(menuDiv);
- // Resize accordion
- $('#zvmConfigAccordion').accordion('resize');
+ // Resize accordion
+ $('#zvmConfigAccordion').accordion('resize');
}
/**
* Panel to configure OS images
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
-function configImagePanel(data) {
- var panelId = data.msg;
- var rsp = data.rsp;
-
- // Wipe panel clean
- $('#' + panelId).empty();
+function configImagePanel(data) {
+ var panelId = data.msg;
+ var rsp = data.rsp;
+
+ // Wipe panel clean
+ $('#' + panelId).empty();
- // Add info bar
- $('#' + panelId).append(createInfoBar('Create, edit, and delete operating system images for the self-service portal.'));
-
- // Create table
- var tableId = 'zvmImageTable';
- var table = new DataTable(tableId);
- table.init(['', 'Name', 'Selectable', 'OS Version', 'Profile', 'Method', 'Description']);
+ // Add info bar
+ $('#' + panelId).append(createInfoBar('Create, edit, and delete operating system images for the self-service portal.'));
+
+ // Create table
+ var tableId = 'zvmImageTable';
+ var table = new DataTable(tableId);
+ table.init(['', 'Name', 'Selectable', 'OS Version', 'Profile', 'Method', 'Description']);
- // Insert images into table
- var imagePos = 0;
- var profilePos = 0;
- var osversPos = 0;
- var osarchPos = 0;
- var provMethodPos = 0;
- var comments = 0;
- var desc, selectable, tmp;
- // Get column index for each attribute
- var colNameArray = rsp[0].substr(1).split(',');
- for (var i in colNameArray){
- switch (colNameArray[i]){
- case 'imagename': {
- imagePos = i;
- }
- break;
-
- case 'profile':{
- profilePos = i;
- }
- break;
-
- case 'osvers':{
- osversPos = i;
- }
- break;
-
- case 'osarch':{
- osarchPos = i;
- }
- break;
-
- case 'comments':{
- comments = i;
- }
- break;
-
- case 'provmethod':{
- provMethodPos = i;
- }
- break;
-
- default :
- break;
- }
- }
-
- // Go through each index
- for (var i = 1; i < rsp.length; i++) {
- // Get image name
- var cols = rsp[i].split(',');
- var name = cols[imagePos].replace(new RegExp('"', 'g'), '');
- var profile = cols[profilePos].replace(new RegExp('"', 'g'), '');
- var provMethod = cols[provMethodPos].replace(new RegExp('"', 'g'), '');
- var osVer = cols[osversPos].replace(new RegExp('"', 'g'), '');
- var osArch = cols[osarchPos].replace(new RegExp('"', 'g'), '');
- var osComments = cols[comments].replace(new RegExp('"', 'g'), '');
-
- // Only save install boot and s390x architectures
- if (osArch == "s390x") {
- // Set default description and selectable
- selectable = "no";
- desc = "No description";
-
- if (osComments) {
- tmp = osComments.split('|');
- for (var j = 0; j < tmp.length; j++) {
- // Save description
- if (tmp[j].indexOf('description:') > -1) {
- desc = tmp[j].replace('description:', '');
- desc = jQuery.trim(desc);
- }
-
- // Is the image selectable?
- if (tmp[j].indexOf('selectable:') > -1) {
- selectable = tmp[j].replace('selectable:', '');
- selectable = jQuery.trim(selectable);
- }
- }
- }
-
- // Columns are: name, selectable, OS version, profile, method, and description
- var cols = new Array(name, selectable, osVer, profile, provMethod, desc);
+ // Insert images into table
+ var imagePos = 0;
+ var profilePos = 0;
+ var osversPos = 0;
+ var osarchPos = 0;
+ var provMethodPos = 0;
+ var comments = 0;
+ var desc, selectable, tmp;
+ // Get column index for each attribute
+ var colNameArray = rsp[0].substr(1).split(',');
+ for (var i in colNameArray){
+ switch (colNameArray[i]){
+ case 'imagename': {
+ imagePos = i;
+ }
+ break;
+
+ case 'profile':{
+ profilePos = i;
+ }
+ break;
+
+ case 'osvers':{
+ osversPos = i;
+ }
+ break;
+
+ case 'osarch':{
+ osarchPos = i;
+ }
+ break;
+
+ case 'comments':{
+ comments = i;
+ }
+ break;
+
+ case 'provmethod':{
+ provMethodPos = i;
+ }
+ break;
+
+ default :
+ break;
+ }
+ }
+
+ // Go through each index
+ for (var i = 1; i < rsp.length; i++) {
+ // Get image name
+ var cols = rsp[i].split(',');
+ var name = cols[imagePos].replace(new RegExp('"', 'g'), '');
+ var profile = cols[profilePos].replace(new RegExp('"', 'g'), '');
+ var provMethod = cols[provMethodPos].replace(new RegExp('"', 'g'), '');
+ var osVer = cols[osversPos].replace(new RegExp('"', 'g'), '');
+ var osArch = cols[osarchPos].replace(new RegExp('"', 'g'), '');
+ var osComments = cols[comments].replace(new RegExp('"', 'g'), '');
+
+ // Only save install boot and s390x architectures
+ if (osArch == "s390x") {
+ // Set default description and selectable
+ selectable = "no";
+ desc = "No description";
+
+ if (osComments) {
+ tmp = osComments.split('|');
+ for (var j = 0; j < tmp.length; j++) {
+ // Save description
+ if (tmp[j].indexOf('description:') > -1) {
+ desc = tmp[j].replace('description:', '');
+ desc = jQuery.trim(desc);
+ }
+
+ // Is the image selectable?
+ if (tmp[j].indexOf('selectable:') > -1) {
+ selectable = tmp[j].replace('selectable:', '');
+ selectable = jQuery.trim(selectable);
+ }
+ }
+ }
+
+ // Columns are: name, selectable, OS version, profile, method, and description
+ var cols = new Array(name, selectable, osVer, profile, provMethod, desc);
- // Add remove button where id = user name
- cols.unshift('');
+ // Add remove button where id = user name
+ cols.unshift('');
- // Add row
- table.add(cols);
- }
- }
-
- // Append datatable to tab
- $('#' + panelId).append(table.object());
+ // Add row
+ table.add(cols);
+ }
+ }
+
+ // Append datatable to tab
+ $('#' + panelId).append(table.object());
- // Turn into datatable
- var dTable = $('#' + tableId).dataTable({
- 'iDisplayLength': 50,
- 'bLengthChange': false,
- "sScrollX": "100%",
- "bAutoWidth": true
- });
-
- // Create action bar
- var actionBar = $('');
-
- // Create a profile
- var createLnk = $('Create');
- createLnk.click(function() {
- imageDialog();
- });
-
- // Edit a profile
- var editLnk = $('Edit');
- editLnk.click(function() {
- var images = $('#' + tableId + ' input[type=checkbox]:checked');
- for (var i in images) {
- var image = images.eq(i).attr('name');
- if (image) {
- // Column order is: profile, selectable, disk pool, disk size, and directory entry
- var cols = images.eq(i).parents('tr').find('td');
- var selectable = cols.eq(2).text();
- var osVersion = cols.eq(3).text();
- var profile = cols.eq(4).text();
- var method = cols.eq(5).text();
- var description = cols.eq(6).text();
-
- editImageDialog(image, selectable, osVersion, profile, method, description);
- }
- }
- });
-
- // Delete a profile
- var deleteLnk = $('Delete');
- deleteLnk.click(function() {
- var images = getNodesChecked(tableId);
- if (images) {
- deleteImageDialog(images);
- }
- });
-
- // Refresh profiles table
- var refreshLnk = $('Refresh');
- refreshLnk.click(function() {
- queryImages(panelId);
- });
-
- // Create an action menu
- var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
- actionsMenu.superfish();
- actionsMenu.css('display', 'inline-block');
- actionBar.append(actionsMenu);
-
- // Set correct theme for action menu
- actionsMenu.find('li').hover(function() {
- setMenu2Theme($(this));
- }, function() {
- setMenu2Normal($(this));
- });
-
- // Create a division to hold actions menu
- var menuDiv = $('');
- $('#' + tableId + '_wrapper').prepend(menuDiv);
- menuDiv.append(actionBar);
- $('#' + tableId + '_filter').appendTo(menuDiv);
+ // Turn into datatable
+ $('#' + tableId).dataTable({
+ 'iDisplayLength': 50,
+ 'bLengthChange': false,
+ "sScrollX": "100%",
+ "bAutoWidth": true
+ });
+
+ // Create action bar
+ var actionBar = $('');
+
+ // Create a profile
+ var createLnk = $('Create');
+ createLnk.click(function() {
+ imageDialog();
+ });
+
+ // Edit a profile
+ var editLnk = $('Edit');
+ editLnk.click(function() {
+ var images = $('#' + tableId + ' input[type=checkbox]:checked');
+ for (var i in images) {
+ var image = images.eq(i).attr('name');
+ if (image) {
+ // Column order is: profile, selectable, disk pool, disk size, and directory entry
+ var cols = images.eq(i).parents('tr').find('td');
+ var selectable = cols.eq(2).text();
+ var osVersion = cols.eq(3).text();
+ var profile = cols.eq(4).text();
+ var method = cols.eq(5).text();
+ var description = cols.eq(6).text();
+
+ editImageDialog(image, selectable, osVersion, profile, method, description);
+ }
+ }
+ });
+
+ // Delete a profile
+ var deleteLnk = $('Delete');
+ deleteLnk.click(function() {
+ var images = getNodesChecked(tableId);
+ if (images) {
+ deleteImageDialog(images);
+ }
+ });
+
+ // Refresh profiles table
+ var refreshLnk = $('Refresh');
+ refreshLnk.click(function() {
+ queryImages(panelId);
+ });
+
+ // Create an action menu
+ var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + tableId + '_wrapper').prepend(menuDiv);
+ menuDiv.append(actionBar);
+ $('#' + tableId + '_filter').appendTo(menuDiv);
- // Resize accordion
- $('#zvmConfigAccordion').accordion('resize');
+ // Resize accordion
+ $('#zvmConfigAccordion').accordion('resize');
}
/**
* Panel to configure directory entries and disks for a profile
*
- * @param panelId
- * Panel ID
- * @return Nothing
+ * @param panelId Panel ID
*/
-function configProfilePanel(panelId) {
- // Wipe panel clean
- $('#' + panelId).empty();
+function configProfilePanel(panelId) {
+ // Wipe panel clean
+ $('#' + panelId).empty();
- // Add info bar
- $('#' + panelId).append(createInfoBar('Create, edit, and delete profiles for the self-service portal. It is important to note the default z/VM user ID for any profile should be LXUSR.'));
-
- // Create table
- var tableId = 'zvmProfileTable';
- var table = new DataTable(tableId);
- table.init(['', 'Profile', 'Disk pool', 'Disk size', 'Directory entry']);
+ // Add info bar
+ $('#' + panelId).append(createInfoBar('Create, edit, and delete profiles for the self-service portal. It is important to note the default z/VM user ID for any profile should be LXUSR.'));
+
+ // Create table
+ var tableId = 'zvmProfileTable';
+ var table = new DataTable(tableId);
+ table.init(['', 'Profile', 'Disk pool', 'Disk size', 'Directory entry']);
- // Insert profiles into table
- var profiles = $.cookie('profiles').split(',');
- profiles.push('default'); // Add default profile
- for (var i in profiles) {
- if (profiles[i]) {
- // Columns are: profile, selectable, description, disk pool, disk size, and directory entry
- var cols = new Array(profiles[i], '', '', '');
-
- // Add remove button where id = user name
- cols.unshift('');
-
- // Add row
- table.add(cols);
- }
- }
-
- // Append datatable to tab
- $('#' + panelId).append(table.object());
+ // Insert profiles into table
+ var profiles = $.cookie('profiles').split(',');
+ profiles.push('default'); // Add default profile
+ for (var i in profiles) {
+ if (profiles[i]) {
+ // Columns are: profile, selectable, description, disk pool, disk size, and directory entry
+ var cols = new Array(profiles[i], '', '', '');
+
+ // Add remove button where id = user name
+ cols.unshift('');
+
+ // Add row
+ table.add(cols);
+ }
+ }
+
+ // Append datatable to tab
+ $('#' + panelId).append(table.object());
- // Turn into datatable
- var dTable = $('#' + tableId).dataTable({
- 'iDisplayLength': 50,
- 'bLengthChange': false,
- "sScrollX": "100%",
- "bAutoWidth": true
- });
-
- // Create action bar
- var actionBar = $('');
-
- // Create a profile
- var createLnk = $('Create');
- createLnk.click(function() {
- profileDialog();
- });
-
- // Edit a profile
- var editLnk = $('Edit');
- editLnk.click(function() {
- var profiles = $('#' + tableId + ' input[type=checkbox]:checked');
- for (var i in profiles) {
- var profile = profiles.eq(i).attr('name');
- if (profile) {
- // Column order is: profile, selectable, disk pool, disk size, and directory entry
- var cols = profiles.eq(i).parents('tr').find('td');
- var pool = cols.eq(2).text();
- var size = cols.eq(3).text();
- var entry = cols.eq(4).html().replace(new RegExp(' ', 'g'), '\n');
-
- editProfileDialog(profile, pool, size, entry);
- }
- }
- });
-
- // Delete a profile
- var deleteLnk = $('Delete');
- deleteLnk.click(function() {
- var profiles = getNodesChecked(tableId);
- if (profiles) {
- openDeleteProfileDialog(profiles);
- }
- });
-
- // Refresh profiles table
- var refreshLnk = $('Refresh');
- refreshLnk.click(function() {
- queryProfiles(panelId);
- });
-
- // Create an action menu
- var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
- actionsMenu.superfish();
- actionsMenu.css('display', 'inline-block');
- actionBar.append(actionsMenu);
-
- // Set correct theme for action menu
- actionsMenu.find('li').hover(function() {
- setMenu2Theme($(this));
- }, function() {
- setMenu2Normal($(this));
- });
-
- // Create a division to hold actions menu
- var menuDiv = $('');
- $('#' + tableId + '_wrapper').prepend(menuDiv);
- menuDiv.append(actionBar);
- $('#' + tableId + '_filter').appendTo(menuDiv);
+ // Turn into datatable
+ $('#' + tableId).dataTable({
+ 'iDisplayLength': 50,
+ 'bLengthChange': false,
+ "sScrollX": "100%",
+ "bAutoWidth": true
+ });
+
+ // Create action bar
+ var actionBar = $('');
+
+ // Create a profile
+ var createLnk = $('Create');
+ createLnk.click(function() {
+ profileDialog();
+ });
+
+ // Edit a profile
+ var editLnk = $('Edit');
+ editLnk.click(function() {
+ var profiles = $('#' + tableId + ' input[type=checkbox]:checked');
+ for (var i in profiles) {
+ var profile = profiles.eq(i).attr('name');
+ if (profile) {
+ // Column order is: profile, selectable, disk pool, disk size, and directory entry
+ var cols = profiles.eq(i).parents('tr').find('td');
+ var pool = cols.eq(2).text();
+ var size = cols.eq(3).text();
+ var entry = cols.eq(4).html().replace(new RegExp(' ', 'g'), '\n');
+
+ editProfileDialog(profile, pool, size, entry);
+ }
+ }
+ });
+
+ // Delete a profile
+ var deleteLnk = $('Delete');
+ deleteLnk.click(function() {
+ var profiles = getNodesChecked(tableId);
+ if (profiles) {
+ openDeleteProfileDialog(profiles);
+ }
+ });
+
+ // Refresh profiles table
+ var refreshLnk = $('Refresh');
+ refreshLnk.click(function() {
+ queryProfiles(panelId);
+ });
+
+ // Create an action menu
+ var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + tableId + '_wrapper').prepend(menuDiv);
+ menuDiv.append(actionBar);
+ $('#' + tableId + '_filter').appendTo(menuDiv);
- // Resize accordion
- $('#zvmConfigAccordion').accordion('resize');
-
- // Query directory entries and disk pool/size for each profile
- for (var i in profiles) {
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'getdefaultuserentry;' + profiles[i],
- msg : 'out=' + panelId + ';profile=' + profiles[i]
- },
-
- success: insertDirectoryEntry
- });
-
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'getzdiskinfo;' + profiles[i],
- msg : 'out=' + panelId + ';profile=' + profiles[i]
- },
-
- success: insertDiskInfo
- });
- }
+ // Resize accordion
+ $('#zvmConfigAccordion').accordion('resize');
+
+ // Query directory entries and disk pool/size for each profile
+ for (var i in profiles) {
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'getdefaultuserentry;' + profiles[i],
+ msg : 'out=' + panelId + ';profile=' + profiles[i]
+ },
+
+ success: insertDirectoryEntry
+ });
+
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'getzdiskinfo;' + profiles[i],
+ msg : 'out=' + panelId + ';profile=' + profiles[i]
+ },
+
+ success: insertDiskInfo
+ });
+ }
}
/**
* Insert the directory entry into the profile table
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function insertDirectoryEntry(data) {
- var tableId = 'zvmProfileTable';
- var args = data.msg.split(';');
-
- var panelId = args[0].replace('out=', '');
- var profile = args[1].replace('profile=', '');
-
- // Do not continue if there is nothing
- if (!data.rsp.length)
- return;
-
- var entry = data.rsp[0].replace(new RegExp('\n', 'g'), ' ');
-
- // Get the row containing the profile
- var rowPos = findRow(profile, '#' + tableId, 1);
- if (rowPos < 0)
- return;
+ var tableId = 'zvmProfileTable';
+ var args = data.msg.split(';');
+
+ var profile = args[1].replace('profile=', '');
+
+ // Do not continue if there is nothing
+ if (!data.rsp.length)
+ return;
+
+ var entry = data.rsp[0].replace(new RegExp('\n', 'g'), ' ');
+
+ // Get the row containing the profile
+ var rowPos = findRow(profile, '#' + tableId, 1);
+ if (rowPos < 0)
+ return;
- // Update the directory entry column
- var dTable = $('#' + tableId).dataTable();
- dTable.fnUpdate(entry, rowPos, 4, false);
-
- // Adjust table styling
- $('#' + tableId + ' td:nth-child(5)').css({
- 'text-align': 'left'
- });
- adjustColumnSize(tableId);
+ // Update the directory entry column
+ var dTable = $('#' + tableId).dataTable();
+ dTable.fnUpdate(entry, rowPos, 4, false);
+
+ // Adjust table styling
+ $('#' + tableId + ' td:nth-child(5)').css({
+ 'text-align': 'left'
+ });
+ adjustColumnSize(tableId);
}
/**
* Insert the disk info into the profile table
*
- * @param data
- * Data from HTTP request
- * @return Nothing
+ * @param data Data from HTTP request
*/
function insertDiskInfo(data) {
- var tableId = 'zvmProfileTable';
- var args = data.msg.split(';');
-
- var panelId = args[0].replace('out=', '');
- var profile = args[1].replace('profile=', '');
-
- // Do not continue if there is nothing
- if (!data.rsp.length)
- return;
-
- // Get the row containing the profile
- var rowPos = findRow(profile, '#' + tableId, 1);
- if (rowPos < 0)
- return;
-
- // Update the disk info columns
- var dTable = $('#' + tableId).dataTable();
-
- var tmp = "";
- var pool = "";
- var eckdSize = 0;
- var info = data.rsp[0].split('\n');
- for (var i in info) {
- if (info[i].indexOf('diskpool') > -1) {
- tmp = info[i].split('=');
- pool = jQuery.trim(tmp[1]);
-
- dTable.fnUpdate(pool, rowPos, 2, false);
- } if (info[i].indexOf('eckd_size') > -1) {
- tmp = info[i].split('=');
- eckdSize = jQuery.trim(tmp[1]);
-
- dTable.fnUpdate(eckdSize, rowPos, 3, false);
- }
- }
-
- // Adjust table styling
- adjustColumnSize(tableId);
+ var tableId = 'zvmProfileTable';
+ var args = data.msg.split(';');
+
+ var profile = args[1].replace('profile=', '');
+
+ // Do not continue if there is nothing
+ if (!data.rsp.length)
+ return;
+
+ // Get the row containing the profile
+ var rowPos = findRow(profile, '#' + tableId, 1);
+ if (rowPos < 0)
+ return;
+
+ // Update the disk info columns
+ var dTable = $('#' + tableId).dataTable();
+
+ var tmp = "";
+ var pool = "";
+ var eckdSize = 0;
+ var info = data.rsp[0].split('\n');
+ for (var i in info) {
+ if (info[i].indexOf('diskpool') > -1) {
+ tmp = info[i].split('=');
+ pool = jQuery.trim(tmp[1]);
+
+ dTable.fnUpdate(pool, rowPos, 2, false);
+ } if (info[i].indexOf('eckd_size') > -1) {
+ tmp = info[i].split('=');
+ eckdSize = jQuery.trim(tmp[1]);
+
+ dTable.fnUpdate(eckdSize, rowPos, 3, false);
+ }
+ }
+
+ // Adjust table styling
+ adjustColumnSize(tableId);
}
/**
* Open group dialog
*/
function groupDialog() {
- // Create form to add profile
- var dialogId = 'zvmCreateGroup';
- var groupForm = $('');
-
- // Create info bar
- var info = createInfoBar('Provide the following attributes for the group.');
- groupForm.append(info);
-
- var group = $('');
- var selectable = $('');
- var ip = $('');
- var hostnames = $('');
- var network = $('');
- var comments = $('');
- groupForm.append(group, selectable, ip, hostnames, network, comments);
-
- // Open dialog to add image
- groupForm.dialog({
- title:'Create group',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 400,
- buttons: {
- "Ok": function() {
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get group attributes
- var group = $(this).find('input[name="group"]');
- var selectable = $(this).find('input[name="selectable"]');
- var ip = $(this).find('input[name="ip"]');
- var hostnames = $(this).find('input[name="hostnames"]');
- var network = $(this).find('input[name="network"]');
- var comments = $(this).find('input[name="comments"]');
-
- // Check that group attributes are provided before continuing
- var ready = 1;
- var inputs = new Array(group, ip, hostnames, network);
- for (var i in inputs) {
- if (!inputs[i].val()) {
- inputs[i].css('border-color', 'red');
- ready = 0;
- } else
- inputs[i].css('border-color', '');
- }
-
- // If inputs are not complete, show warning message
- if (!ready) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Set default description
- if (!comments.val())
- comments.val('No description');
-
- // Create arguments to send via AJAX
- var args = "updategroup;" + group.val() + ";'" + ip.val() + "';'" + hostnames.val() + "';";
-
- if (selectable.attr("checked"))
- args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:yes";
- else
- args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:no";
-
- // Add image to xCAT
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : args,
- msg : dialogId
- },
+ // Create form to add profile
+ var dialogId = 'zvmCreateGroup';
+ var groupForm = $('');
- success : updatePanel
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Create info bar
+ var info = createInfoBar('Provide the following attributes for the group.');
+ groupForm.append(info);
+
+ var group = $('');
+ var selectable = $('');
+ var ip = $('');
+ var hostnames = $('');
+ var network = $('');
+ var comments = $('');
+ groupForm.append(group, selectable, ip, hostnames, network, comments);
+
+ // Open dialog to add image
+ groupForm.dialog({
+ title:'Create group',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 400,
+ buttons: {
+ "Ok": function() {
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get group attributes
+ var group = $(this).find('input[name="group"]');
+ var selectable = $(this).find('input[name="selectable"]');
+ var ip = $(this).find('input[name="ip"]');
+ var hostnames = $(this).find('input[name="hostnames"]');
+ var network = $(this).find('input[name="network"]');
+ var comments = $(this).find('input[name="comments"]');
+
+ // Check that group attributes are provided before continuing
+ var ready = 1;
+ var inputs = new Array(group, ip, hostnames, network);
+ for (var i in inputs) {
+ if (!inputs[i].val()) {
+ inputs[i].css('border-color', 'red');
+ ready = 0;
+ } else
+ inputs[i].css('border-color', '');
+ }
+
+ // If inputs are not complete, show warning message
+ if (!ready) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Set default description
+ if (!comments.val())
+ comments.val('No description');
+
+ // Create arguments to send via AJAX
+ var args = "updategroup;" + group.val() + ";'" + ip.val() + "';'" + hostnames.val() + "';";
+
+ if (selectable.attr("checked"))
+ args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:yes";
+ else
+ args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:no";
+
+ // Add image to xCAT
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : args,
+ msg : dialogId
+ },
+
+ success : updatePanel
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open image dialog
*/
function imageDialog() {
- // Create form to add profile
- var dialogId = 'zvmCreateImage';
- var imageForm = $('');
-
- // Create info bar
- var info = createInfoBar('Provide the following attributes for the image. The image name will be generated based on the attributes you will give.');
- imageForm.append(info);
-
- var imageName = $('');
- var selectable = $('');
- var imageType = $('');
- var architecture = $('');
- var osName = $('');
- var osVersion = $('');
- var profile = $('');
- var provisionMethod = $('');
- var provisionSelect = $('');
- provisionMethod.append(provisionSelect);
- var comments = $('');
- imageForm.append(imageName, selectable, imageType, architecture, osName, osVersion, profile, provisionMethod, comments);
-
- // Open dialog to add image
- imageForm.dialog({
- title:'Create image',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 400,
- buttons: {
- "Ok": function() {
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get image attributes
- var imageType = $(this).find('input[name="imagetype"]');
- var selectable = $(this).find('input[name="selectable"]');
- var architecture = $(this).find('input[name="osarch"]');
- var osName = $(this).find('input[name="osname"]');
- var osVersion = $(this).find('input[name="osvers"]');
- var profile = $(this).find('input[name="profile"]');
- var provisionMethod = $(this).find('select[name="provmethod"]');
- var comments = $(this).find('input[name="comments"]');
-
- // Check that image attributes are provided before continuing
- var ready = 1;
- var inputs = new Array(imageType, architecture, osName, osVersion, profile, provisionMethod);
- for (var i in inputs) {
- if (!inputs[i].val()) {
- inputs[i].css('border-color', 'red');
- ready = 0;
- } else
- inputs[i].css('border-color', '');
- }
-
- // If inputs are not complete, show warning message
- if (!ready) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Override image name
- $(this).find('input[name="imagename"]').val(osVersion.val() + '-' + architecture.val() + '-' + provisionMethod.val() + '-' + profile.val());
- var imageName = $(this).find('input[name="imagename"]');
-
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Set default description
- if (!comments.val())
- comments.val('No description');
-
- // Create arguments to send via AJAX
- var args = 'updateosimage;' + imageName.val() + ';' +
- imageType.val() + ';' +
- architecture.val() + ';' +
- osName.val() + ';' +
- osVersion.val() + ';' +
- profile.val() + ';' +
- provisionMethod.val() + ';';
-
- if (selectable.attr('checked'))
- args += '"description:' + comments.val() + '|selectable:yes"';
- else
- args += '"description:' + comments.val() + '|selectable:no"';
-
- // Add image to xCAT
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : args,
- msg : dialogId
- },
+ // Create form to add profile
+ var dialogId = 'zvmCreateImage';
+ var imageForm = $('');
- success : updatePanel
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Create info bar
+ var info = createInfoBar('Provide the following attributes for the image. The image name will be generated based on the attributes you will give.');
+ imageForm.append(info);
+
+ var imageName = $('');
+ var selectable = $('');
+ var imageType = $('');
+ var architecture = $('');
+ var osName = $('');
+ var osVersion = $('');
+ var profile = $('');
+ var provisionMethod = $('');
+ var provisionSelect = $('');
+ provisionMethod.append(provisionSelect);
+ var comments = $('');
+ imageForm.append(imageName, selectable, imageType, architecture, osName, osVersion, profile, provisionMethod, comments);
+
+ // Open dialog to add image
+ imageForm.dialog({
+ title:'Create image',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 400,
+ buttons: {
+ "Ok": function() {
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get image attributes
+ var imageType = $(this).find('input[name="imagetype"]');
+ var selectable = $(this).find('input[name="selectable"]');
+ var architecture = $(this).find('input[name="osarch"]');
+ var osName = $(this).find('input[name="osname"]');
+ var osVersion = $(this).find('input[name="osvers"]');
+ var profile = $(this).find('input[name="profile"]');
+ var provisionMethod = $(this).find('select[name="provmethod"]');
+ var comments = $(this).find('input[name="comments"]');
+
+ // Check that image attributes are provided before continuing
+ var ready = 1;
+ var inputs = new Array(imageType, architecture, osName, osVersion, profile, provisionMethod);
+ for (var i in inputs) {
+ if (!inputs[i].val()) {
+ inputs[i].css('border-color', 'red');
+ ready = 0;
+ } else
+ inputs[i].css('border-color', '');
+ }
+
+ // If inputs are not complete, show warning message
+ if (!ready) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Override image name
+ $(this).find('input[name="imagename"]').val(osVersion.val() + '-' + architecture.val() + '-' + provisionMethod.val() + '-' + profile.val());
+ var imageName = $(this).find('input[name="imagename"]');
+
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Set default description
+ if (!comments.val())
+ comments.val('No description');
+
+ // Create arguments to send via AJAX
+ var args = 'updateosimage;' + imageName.val() + ';' +
+ imageType.val() + ';' +
+ architecture.val() + ';' +
+ osName.val() + ';' +
+ osVersion.val() + ';' +
+ profile.val() + ';' +
+ provisionMethod.val() + ';';
+
+ if (selectable.attr('checked'))
+ args += '"description:' + comments.val() + '|selectable:yes"';
+ else
+ args += '"description:' + comments.val() + '|selectable:no"';
+
+ // Add image to xCAT
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : args,
+ msg : dialogId
+ },
+
+ success : updatePanel
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open profile dialog
*/
function profileDialog() {
- // Create form to add profile
- var dialogId = 'zvmCreateProfile';
- var profileForm = $('');
-
- // Create info bar
- var info = createInfoBar('Configure the default settings for a profile');
- profileForm.append(info);
-
- // Insert profiles into select
- var profileSelect = $('');
- var profiles = $.cookie('profiles').split(',');
- profiles.push('default'); // Add default profile
- for (var i in profiles) {
- if (profiles[i]) {
- profileSelect.append($(''));
- }
- }
-
- profileForm.append($('').append(profileSelect));
- profileForm.append('');
- profileForm.append('');
- profileForm.append('');
-
- // Open dialog to add processor
- profileForm.dialog({
- title:'Configure profile',
- modal: true,
- close: function(){
- $(this).remove();
+ // Create form to add profile
+ var dialogId = 'zvmCreateProfile';
+ var profileForm = $('');
+
+ // Create info bar
+ var info = createInfoBar('Configure the default settings for a profile');
+ profileForm.append(info);
+
+ // Insert profiles into select
+ var profileSelect = $('');
+ var profiles = $.cookie('profiles').split(',');
+ profiles.push('default'); // Add default profile
+ for (var i in profiles) {
+ if (profiles[i]) {
+ profileSelect.append($(''));
+ }
+ }
+
+ profileForm.append($('').append(profileSelect));
+ profileForm.append('');
+ profileForm.append('');
+ profileForm.append('');
+
+ // Open dialog to add processor
+ profileForm.dialog({
+ title:'Configure profile',
+ modal: true,
+ close: function(){
+ $(this).remove();
},
- width: 600,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Find profile attributes
- var profile = $(this).find('select[name=profile]').val();
- var pool = $(this).find('input[name=disk_pool]').val();
- var size = $(this).find('input[name=disk_size_eckd]').val();
- var entry = $(this).find('textarea[name=directory_entry]').val();
-
- // If inputs are not complete, show warning message
- if (!profile || !pool || !size || !entry) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Change dialog buttons
- $('#' + dialogId).dialog('option', 'buttons', {
- 'Close':function(){
- $(this).dialog('close');
- }
- });
-
- // Write file to /var/tmp
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'write',
- tgt : '/var/tmp/' + profile + '.direct',
- args : '',
- cont : entry,
- msg : dialogId + ';' + profile + ';' + pool + ';' + size
- },
+ width: 600,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Find profile attributes
+ var profile = $(this).find('select[name=profile]').val();
+ var pool = $(this).find('input[name=disk_pool]').val();
+ var size = $(this).find('input[name=disk_size_eckd]').val();
+ var entry = $(this).find('textarea[name=directory_entry]').val();
+
+ // If inputs are not complete, show warning message
+ if (!profile || !pool || !size || !entry) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $('#' + dialogId).dialog('option', 'buttons', {
+ 'Close':function(){
+ $(this).dialog('close');
+ }
+ });
+
+ // Write file to /var/tmp
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'write',
+ tgt : '/var/tmp/' + profile + '.direct',
+ args : '',
+ cont : entry,
+ msg : dialogId + ';' + profile + ';' + pool + ';' + size
+ },
- success : function(data) {
- var args = data.msg.split(';');
-
- // Create profile in xCAT
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'mkzprofile;' + args[1] + ';' + args[2] + ';' + args[3],
- msg : args[0]
- },
-
- success: updatePanel
- });
- }
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ success : function(data) {
+ var args = data.msg.split(';');
+
+ // Create profile in xCAT
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'mkzprofile;' + args[1] + ';' + args[2] + ';' + args[3],
+ msg : args[0]
+ },
+
+ success: updatePanel
+ });
+ }
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open dialog to confirm profile delete
*
- * @param profiles
- * Profiles to delete
- * @return Nothing
+ * @param profiles Profiles to delete
*/
function deleteProfileDialog(profiles) {
- // Create form to delete disk to pool
- var dialogId = 'zvmDeleteProfile';
- var deleteForm = $('');
-
- // Create info bar
- var info = createInfoBar('Are you sure you want to delete ' + profiles.replace(new RegExp(',', 'g'), ', ') + '?');
- deleteForm.append(info);
-
- // Open dialog to delete user
- deleteForm.dialog({
- title:'Delete profile',
- modal: true,
- width: 400,
- close: function(){
- $(this).remove();
+ // Create form to delete disk to pool
+ var dialogId = 'zvmDeleteProfile';
+ var deleteForm = $('');
+
+ // Create info bar
+ var info = createInfoBar('Are you sure you want to delete ' + profiles.replace(new RegExp(',', 'g'), ', ') + '?');
+ deleteForm.append(info);
+
+ // Open dialog to delete user
+ deleteForm.dialog({
+ title:'Delete profile',
+ modal: true,
+ width: 400,
+ close: function(){
+ $(this).remove();
},
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Delete user
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'rmzprofile;' + profiles,
- msg : dialogId
- },
- success : updatePanel
- });
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Delete user
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'rmzprofile;' + profiles,
+ msg : dialogId
+ },
+ success : updatePanel
+ });
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open dialog to edit profile
*
- * @param profile
- * Profile to edit
- * @param pool
- * Disk pool
- * @param size
- * Disk size
- * @param entry
- * Directory entry
- * @return Nothing
+ * @param profile Profile to edit
+ * @param pool Disk pool
+ * @param size Disk size
+ * @param entry Directory entry
*/
function editProfileDialog(profile, pool, size, entry) {
- // Create form to add profile
- var dialogId = 'zvmEditProfile_' + profile;
- var profileForm = $('');
-
- // Create info bar
- var info = createInfoBar('Configure the default settings for a profile');
- profileForm.append(info);
-
- // Insert profiles into select
- var profileSelect = $('');
- var profiles = $.cookie('profiles').split(',');
- profiles.push('default'); // Add default profile
- for (var i in profiles) {
- if (profiles[i]) {
- profileSelect.append($(''));
- }
- }
-
- profileForm.append($('').append(profileSelect));
- profileForm.append('');
- profileForm.append('');
- profileForm.append('');
-
- // Insert profile values
- profileSelect.val(profile);
- profileForm.find('input[name=disk_pool]').val(pool);
- profileForm.find('input[name=disk_size_eckd]').val(size);
- profileForm.find('textarea[name=directory_entry]').val(entry);
-
- // Open dialog to add processor
- profileForm.dialog({
- title:'Configure profile',
- modal: true,
- close: function(){
- $(this).remove();
+ // Create form to add profile
+ var dialogId = 'zvmEditProfile_' + profile;
+ var profileForm = $('');
+
+ // Create info bar
+ var info = createInfoBar('Configure the default settings for a profile');
+ profileForm.append(info);
+
+ // Insert profiles into select
+ var profileSelect = $('');
+ var profiles = $.cookie('profiles').split(',');
+ profiles.push('default'); // Add default profile
+ for (var i in profiles) {
+ if (profiles[i]) {
+ profileSelect.append($(''));
+ }
+ }
+
+ profileForm.append($('').append(profileSelect));
+ profileForm.append('');
+ profileForm.append('');
+ profileForm.append('');
+
+ // Insert profile values
+ profileSelect.val(profile);
+ profileForm.find('input[name=disk_pool]').val(pool);
+ profileForm.find('input[name=disk_size_eckd]').val(size);
+ profileForm.find('textarea[name=directory_entry]').val(entry);
+
+ // Open dialog to add processor
+ profileForm.dialog({
+ title:'Configure profile',
+ modal: true,
+ close: function(){
+ $(this).remove();
},
- width: 600,
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Find profile attributes
- var profile = $(this).find('select[name=profile]').val();
- var pool = $(this).find('input[name=disk_pool]').val();
- var size = $(this).find('input[name=disk_size_eckd]').val();
- var entry = $(this).find('textarea[name=directory_entry]').val();
-
- // If inputs are not complete, show warning message
- if (!profile || !pool || !size || !entry) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Change dialog buttons
- $('#' + dialogId).dialog('option', 'buttons', {
- 'Close':function(){
- $(this).dialog('close');
- }
- });
-
- // Write file to /var/tmp
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'write',
- tgt : '/var/tmp/' + profile + '.direct',
- args : '',
- cont : entry,
- msg : dialogId + ';' + profile + ';' + pool + ';' + size
- },
+ width: 600,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Find profile attributes
+ var profile = $(this).find('select[name=profile]').val();
+ var pool = $(this).find('input[name=disk_pool]').val();
+ var size = $(this).find('input[name=disk_size_eckd]').val();
+ var entry = $(this).find('textarea[name=directory_entry]').val();
+
+ // If inputs are not complete, show warning message
+ if (!profile || !pool || !size || !entry) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $('#' + dialogId).dialog('option', 'buttons', {
+ 'Close':function(){
+ $(this).dialog('close');
+ }
+ });
+
+ // Write file to /var/tmp
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'write',
+ tgt : '/var/tmp/' + profile + '.direct',
+ args : '',
+ cont : entry,
+ msg : dialogId + ';' + profile + ';' + pool + ';' + size
+ },
- success : function(data) {
- var args = data.msg.split(';');
-
- // Create profile in xCAT
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'mkzprofile;' + args[1] + ';' + args[2] + ';' + args[3],
- msg : args[0]
- },
-
- success: updatePanel
- });
- }
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ success : function(data) {
+ var args = data.msg.split(';');
+
+ // Create profile in xCAT
+ $.ajax({
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'mkzprofile;' + args[1] + ';' + args[2] + ';' + args[3],
+ msg : args[0]
+ },
+
+ success: updatePanel
+ });
+ }
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open dialog to confirm image delete
*
- * @param images
- * Images to delete
- * @return Nothing
+ * @param images Images to delete
*/
function deleteImageDialog(images) {
- // Create form to delete disk to pool
- var dialogId = 'zvmDeleteImage';
- var deleteForm = $('');
-
- // Create info bar
- var info = createInfoBar('Are you sure you want to delete ' + images.replace(new RegExp(',', 'g'), ', ') + '?');
- deleteForm.append(info);
-
- // Open dialog to delete user
- deleteForm.dialog({
- title:'Delete image',
- modal: true,
- width: 400,
- close: function(){
- $(this).remove();
+ // Create form to delete disk to pool
+ var dialogId = 'zvmDeleteImage';
+ var deleteForm = $('');
+
+ // Create info bar
+ var info = createInfoBar('Are you sure you want to delete ' + images.replace(new RegExp(',', 'g'), ', ') + '?');
+ deleteForm.append(info);
+
+ // Open dialog to delete user
+ deleteForm.dialog({
+ title:'Delete image',
+ modal: true,
+ width: 400,
+ close: function(){
+ $(this).remove();
},
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Delete user
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'rmosimage;' + images,
- msg : dialogId
- },
- success : updatePanel
- });
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Delete user
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'rmosimage;' + images,
+ msg : dialogId
+ },
+ success : updatePanel
+ });
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Open dialog to confirm group delete
*
- * @param groups
- * Groups to delete
- * @return Nothing
+ * @param groups Groups to delete
*/
function deleteGroupDialog(groups) {
- // Create form to delete disk to pool
- var dialogId = 'zvmDeleteImage';
- var deleteForm = $('');
-
- // Create info bar
- var info = createInfoBar('Are you sure you want to delete ' + groups.replace(new RegExp(',', 'g'), ', ') + '?');
- deleteForm.append(info);
-
- // Open dialog to delete user
- deleteForm.dialog({
- title:'Delete group',
- modal: true,
- width: 400,
- close: function(){
- $(this).remove();
+ // Create form to delete disk to pool
+ var dialogId = 'zvmDeleteImage';
+ var deleteForm = $('');
+
+ // Create info bar
+ var info = createInfoBar('Are you sure you want to delete ' + groups.replace(new RegExp(',', 'g'), ', ') + '?');
+ deleteForm.append(info);
+
+ // Open dialog to delete user
+ deleteForm.dialog({
+ title:'Delete group',
+ modal: true,
+ width: 400,
+ close: function(){
+ $(this).remove();
},
- buttons: {
- "Ok": function(){
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Delete user
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'rmgroup;' + groups,
- msg : dialogId
- },
- success : updatePanel
- });
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Delete user
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : 'rmgroup;' + groups,
+ msg : dialogId
+ },
+ success : updatePanel
+ });
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Edit image dialog
*
- * @param iName
- * Image name
- * @param iSelectable
- * Is image selectable from service page
- * @param iOsVersion
- * OS version
- * @param iProfile
- * Profile name
- * @param iMethod
- * Provisioning method
- * @param iComments
- * Image description
- *
- * @return Nothing
+ * @param iName Image name
+ * @param iSelectable Is image selectable from service page
+ * @param iOsVersion OS version
+ * @param iProfile Profile name
+ * @param iMethod Provisioning method
+ * @param iComments Image description
*/
function editImageDialog(iName, iSelectable, iOsVersion, iProfile, iMethod, iComments) {
- // Create form to add profile
- var dialogId = 'zvmCreateImage';
- var imageForm = $('');
-
- // Create info bar
- var info = createInfoBar('Provide the following attributes for the image. The image name will be generated based on the attributes you will give.');
- imageForm.append(info);
-
- var imageName = $('');
- var selectable = $('');
- var imageType = $('');
- var architecture = $('');
- var osName = $('');
- var osVersion = $('');
- var profile = $('');
- var provisionMethod = $('');
- var provisionSelect = $('');
- provisionMethod.append(provisionSelect);
- var comments = $('');
- imageForm.append(imageName, selectable, imageType, architecture, osName, osVersion, profile, provisionMethod, comments);
-
- // Fill in image attributes
- imageForm.find('input[name="imagename"]').val(iName);
- imageForm.find('input[name="osvers"]').val(iOsVersion);
- imageForm.find('input[name="profile"]').val(iProfile);
- imageForm.find('select[name="provmethod"]').val(iMethod);
- imageForm.find('input[name="comments"]').val(iComments);
- if (iSelectable == "yes")
- imageForm.find('input[name="selectable"]').attr('checked', 'checked');
-
- // Open dialog to add image
- imageForm.dialog({
- title:'Edit image',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 400,
- buttons: {
- "Ok": function() {
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get image attributes
- var imageType = $(this).find('input[name="imagetype"]');
- var selectable = $(this).find('input[name="selectable"]');
- var architecture = $(this).find('input[name="osarch"]');
- var osName = $(this).find('input[name="osname"]');
- var osVersion = $(this).find('input[name="osvers"]');
- var profile = $(this).find('input[name="profile"]');
- var provisionMethod = $(this).find('select[name="provmethod"]');
- var comments = $(this).find('input[name="comments"]');
-
- // Check that image attributes are provided before continuing
- var ready = 1;
- var inputs = new Array(imageType, architecture, osName, osVersion, profile, provisionMethod);
- for (var i in inputs) {
- if (!inputs[i].val()) {
- inputs[i].css('border-color', 'red');
- ready = 0;
- } else
- inputs[i].css('border-color', '');
- }
-
- // If inputs are not complete, show warning message
- if (!ready) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Override image name
- $(this).find('input[name="imagename"]').val(osVersion.val() + '-' + architecture.val() + '-' + provisionMethod.val() + '-' + profile.val());
- var imageName = $(this).find('input[name="imagename"]');
-
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Set default description
- if (!comments.val())
- comments.val('No description');
-
- // Create arguments to send via AJAX
- var args = 'updateosimage;' + imageName.val() + ';' +
- imageType.val() + ';' +
- architecture.val() + ';' +
- osName.val() + ';' +
- osVersion.val() + ';' +
- profile.val() + ';' +
- provisionMethod.val() + ';';
-
- if (selectable.attr('checked'))
- args += '"description:' + comments.val() + '|selectable:yes"';
- else
- args += '"description:' + comments.val() + '|selectable:no"';
-
- // Add image to xCAT
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : args,
- msg : dialogId
- },
+ // Create form to add profile
+ var dialogId = 'zvmCreateImage';
+ var imageForm = $('');
- success : updatePanel
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Create info bar
+ var info = createInfoBar('Provide the following attributes for the image. The image name will be generated based on the attributes you will give.');
+ imageForm.append(info);
+
+ var imageName = $('');
+ var selectable = $('');
+ var imageType = $('');
+ var architecture = $('');
+ var osName = $('');
+ var osVersion = $('');
+ var profile = $('');
+ var provisionMethod = $('');
+ var provisionSelect = $('');
+ provisionMethod.append(provisionSelect);
+ var comments = $('');
+ imageForm.append(imageName, selectable, imageType, architecture, osName, osVersion, profile, provisionMethod, comments);
+
+ // Fill in image attributes
+ imageForm.find('input[name="imagename"]').val(iName);
+ imageForm.find('input[name="osvers"]').val(iOsVersion);
+ imageForm.find('input[name="profile"]').val(iProfile);
+ imageForm.find('select[name="provmethod"]').val(iMethod);
+ imageForm.find('input[name="comments"]').val(iComments);
+ if (iSelectable == "yes")
+ imageForm.find('input[name="selectable"]').attr('checked', 'checked');
+
+ // Open dialog to add image
+ imageForm.dialog({
+ title:'Edit image',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 400,
+ buttons: {
+ "Ok": function() {
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get image attributes
+ var imageType = $(this).find('input[name="imagetype"]');
+ var selectable = $(this).find('input[name="selectable"]');
+ var architecture = $(this).find('input[name="osarch"]');
+ var osName = $(this).find('input[name="osname"]');
+ var osVersion = $(this).find('input[name="osvers"]');
+ var profile = $(this).find('input[name="profile"]');
+ var provisionMethod = $(this).find('select[name="provmethod"]');
+ var comments = $(this).find('input[name="comments"]');
+
+ // Check that image attributes are provided before continuing
+ var ready = 1;
+ var inputs = new Array(imageType, architecture, osName, osVersion, profile, provisionMethod);
+ for (var i in inputs) {
+ if (!inputs[i].val()) {
+ inputs[i].css('border-color', 'red');
+ ready = 0;
+ } else
+ inputs[i].css('border-color', '');
+ }
+
+ // If inputs are not complete, show warning message
+ if (!ready) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Override image name
+ $(this).find('input[name="imagename"]').val(osVersion.val() + '-' + architecture.val() + '-' + provisionMethod.val() + '-' + profile.val());
+ var imageName = $(this).find('input[name="imagename"]');
+
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Set default description
+ if (!comments.val())
+ comments.val('No description');
+
+ // Create arguments to send via AJAX
+ var args = 'updateosimage;' + imageName.val() + ';' +
+ imageType.val() + ';' +
+ architecture.val() + ';' +
+ osName.val() + ';' +
+ osVersion.val() + ';' +
+ profile.val() + ';' +
+ provisionMethod.val() + ';';
+
+ if (selectable.attr('checked'))
+ args += '"description:' + comments.val() + '|selectable:yes"';
+ else
+ args += '"description:' + comments.val() + '|selectable:no"';
+
+ // Add image to xCAT
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : args,
+ msg : dialogId
+ },
+
+ success : updatePanel
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
/**
* Edit group dialog
*
- * @param iGroup
- * Group name
- * @param iSelectable
- * Is group selectable from the service page
- * @param iIp
- * Group IP regex
- * @param iHostnames
- * Group hostnames regex
- * @param iNetwork
- * Group network, e.g. 10.1.2.0/24
- * @param iComments
- * Group description
- * @return Nothing
+ * @param iGroup Group name
+ * @param iSelectable Is group selectable from the service page
+ * @param iIp Group IP regex
+ * @param iHostnames Group hostnames regex
+ * @param iNetwork Group network, e.g. 10.1.2.0/24
+ * @param iComments Group description
*/
function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iNetwork, iComments) {
- // Create form to add profile
- var dialogId = 'zvmCreateGroup';
- var groupForm = $('');
-
- // Create info bar
- var info = createInfoBar('Provide the following attributes for the group.');
- groupForm.append(info);
-
- var group = $('');
- var selectable = $('');
- var ip = $('');
- var hostnames = $('');
- var network = $('');
- var comments = $('');
- groupForm.append(group, selectable, ip, hostnames, network, comments);
-
- // Fill in group attributes
- groupForm.find('input[name="group"]').val(iGroup);
- groupForm.find('input[name="ip"]').val(iIp);
- groupForm.find('input[name="hostnames"]').val(iHostnames);
- groupForm.find('input[name="network"]').val(iNetwork);
- groupForm.find('input[name="comments"]').val(iComments);
- if (iSelectable == "yes")
- groupForm.find('input[name="selectable"]').attr('checked', 'checked');
-
- // Open dialog to add image
- groupForm.dialog({
- title:'Edit group',
- modal: true,
- close: function(){
- $(this).remove();
- },
- width: 400,
- buttons: {
- "Ok": function() {
- // Remove any warning messages
- $(this).find('.ui-state-error').remove();
-
- // Get group attributes
- var group = $(this).find('input[name="group"]');
- var selectable = $(this).find('input[name="selectable"]');
- var ip = $(this).find('input[name="ip"]');
- var hostnames = $(this).find('input[name="hostnames"]');
- var network = $(this).find('input[name="network"]');
- var comments = $(this).find('input[name="comments"]');
-
- // Check that group attributes are provided before continuing
- var ready = 1;
- var inputs = new Array(group, ip, hostnames, network);
- for (var i in inputs) {
- if (!inputs[i].val()) {
- inputs[i].css('border-color', 'red');
- ready = 0;
- } else
- inputs[i].css('border-color', '');
- }
-
- // If inputs are not complete, show warning message
- if (!ready) {
- var warn = createWarnBar('Please provide a value for each missing field.');
- warn.prependTo($(this));
- } else {
- // Change dialog buttons
- $(this).dialog('option', 'buttons', {
- 'Close': function() {$(this).dialog("close");}
- });
-
- // Set default description
- if (!comments.val())
- comments.val('No description');
-
- // Create arguments to send via AJAX
- var args = "updategroup;" + group.val() + ";'" + ip.val() + "';'" + hostnames.val() + "';";
-
- if (selectable.attr("checked"))
- args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:yes";
- else
- args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:no";
-
- // Add image to xCAT
- $.ajax( {
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : args,
- msg : dialogId
- },
+ // Create form to add profile
+ var dialogId = 'zvmCreateGroup';
+ var groupForm = $('');
- success : updatePanel
- });
- }
- },
- "Cancel": function() {
- $(this).dialog( "close" );
- }
- }
- });
+ // Create info bar
+ var info = createInfoBar('Provide the following attributes for the group.');
+ groupForm.append(info);
+
+ var group = $('');
+ var selectable = $('');
+ var ip = $('');
+ var hostnames = $('');
+ var network = $('');
+ var comments = $('');
+ groupForm.append(group, selectable, ip, hostnames, network, comments);
+
+ // Fill in group attributes
+ groupForm.find('input[name="group"]').val(iGroup);
+ groupForm.find('input[name="ip"]').val(iIp);
+ groupForm.find('input[name="hostnames"]').val(iHostnames);
+ groupForm.find('input[name="network"]').val(iNetwork);
+ groupForm.find('input[name="comments"]').val(iComments);
+ if (iSelectable == "yes")
+ groupForm.find('input[name="selectable"]').attr('checked', 'checked');
+
+ // Open dialog to add image
+ groupForm.dialog({
+ title:'Edit group',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 400,
+ buttons: {
+ "Ok": function() {
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get group attributes
+ var group = $(this).find('input[name="group"]');
+ var selectable = $(this).find('input[name="selectable"]');
+ var ip = $(this).find('input[name="ip"]');
+ var hostnames = $(this).find('input[name="hostnames"]');
+ var network = $(this).find('input[name="network"]');
+ var comments = $(this).find('input[name="comments"]');
+
+ // Check that group attributes are provided before continuing
+ var ready = 1;
+ var inputs = new Array(group, ip, hostnames, network);
+ for (var i in inputs) {
+ if (!inputs[i].val()) {
+ inputs[i].css('border-color', 'red');
+ ready = 0;
+ } else
+ inputs[i].css('border-color', '');
+ }
+
+ // If inputs are not complete, show warning message
+ if (!ready) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ // Set default description
+ if (!comments.val())
+ comments.val('No description');
+
+ // Create arguments to send via AJAX
+ var args = "updategroup;" + group.val() + ";'" + ip.val() + "';'" + hostnames.val() + "';";
+
+ if (selectable.attr("checked"))
+ args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:yes";
+ else
+ args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:no";
+
+ // Add image to xCAT
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'webrun',
+ tgt : '',
+ args : args,
+ msg : dialogId
+ },
+
+ success : updatePanel
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
}
\ No newline at end of file
diff --git a/xCAT-UI/js/help/help.js b/xCAT-UI/js/help/help.js
index 9a06f8a1d..1c06fc4eb 100644
--- a/xCAT-UI/js/help/help.js
+++ b/xCAT-UI/js/help/help.js
@@ -1,30 +1,30 @@
function loadHelpPage(){
- // Create help tab
+ // Create help tab
var tab = new Tab();
tab.init();
$('#content').append(tab.object());
- // Add help content
+ // Add help content
var helpForm = $('');
helpForm.append(
- '