mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-30 19:02:27 +00:00 
			
		
		
		
	bug 1155 Initial merge of UI code; to test the process
Change-Id: I4c594869f8919c8367174ab7610327f7f3af4e59
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -6,8 +6,8 @@ var topPriority = 0; | ||||
| var tableId = 'usersTable'; | ||||
|  | ||||
| /** | ||||
|  * Get user access table  | ||||
|  *  | ||||
|  * Get user access table | ||||
|  * | ||||
|  * @returns User access table | ||||
|  */ | ||||
| function getUsersTable(){ | ||||
| @@ -16,7 +16,7 @@ function getUsersTable(){ | ||||
|  | ||||
| /** | ||||
|  * Set user access table | ||||
|  *  | ||||
|  * | ||||
|  * @param table User access table | ||||
|  */ | ||||
| function setUsersTable(table){ | ||||
| @@ -44,43 +44,43 @@ function loadUserPage() { | ||||
|  | ||||
| /** | ||||
|  * Load user table | ||||
|  *  | ||||
|  * @param data Data returned from HTTP request  | ||||
|  * | ||||
|  * @param data Data returned from HTTP request | ||||
|  */ | ||||
| function loadUserTable(data){ | ||||
|     var tabId = 'usersTab'; | ||||
|          | ||||
|  | ||||
|     $('#' + tabId).empty(); | ||||
|      | ||||
|  | ||||
|     // Set padding for page | ||||
|     $('#' + tabId).css('padding', '20px 60px'); | ||||
|      | ||||
|  | ||||
|     // Create info bar | ||||
|     var info = $('#' + tabId).find('.ui-state-highlight'); | ||||
|     // If there is no info bar | ||||
|     if (!info.length) { | ||||
|         var infoBar = createInfoBar('Configure access given to users.'); | ||||
|          | ||||
|  | ||||
|         // Create users page | ||||
|         var userPg = $('<div class="form"></div>'); | ||||
|         $('#' + tabId).append(infoBar, userPg); | ||||
|     } | ||||
|  | ||||
|     if (data.rsp) { | ||||
|     	// Create a datatable if one does not exist  | ||||
|     	// Create a datatable if one does not exist | ||||
|         var table = new DataTable(tableId); | ||||
|         var headers = new Array('Priority', 'Name', 'Host', 'Commands', 'Noderange', 'Parameters', 'Time', 'Rule', 'Comments', 'Disable'); | ||||
|          | ||||
|  | ||||
|         // Add column for the checkbox | ||||
|         headers.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">'); | ||||
|         table.init(headers); | ||||
|         headers.shift(); | ||||
|          | ||||
|  | ||||
|         // Append datatable to panel | ||||
|         $('#' + tabId).append(table.object()); | ||||
|          | ||||
|  | ||||
|         topPriority = 0; | ||||
|          | ||||
|  | ||||
|         // Add table rows | ||||
|         // Start with the 2nd row (1st row is the headers) | ||||
|         for (var i = 1; i < data.rsp.length; i++) { | ||||
| @@ -104,7 +104,7 @@ function loadUserTable(data){ | ||||
|                 // Replace quote | ||||
|                 cols[j] = cols[j].replace(new RegExp('"', 'g'), ''); | ||||
|             } | ||||
|              | ||||
|  | ||||
|             // Set the highest priority | ||||
|             priority = cols[0]; | ||||
|             if (priority > topPriority) | ||||
| @@ -116,9 +116,9 @@ function loadUserTable(data){ | ||||
|             // Add row | ||||
|             table.add(cols); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         // Turn table into datatable | ||||
|         var dTable = $('#' + tableId).dataTable({         | ||||
|         var dTable = $('#' + tableId).dataTable({ | ||||
|             'iDisplayLength': 50, | ||||
|             'bLengthChange': false, | ||||
|             "bScrollCollapse": true, | ||||
| @@ -134,15 +134,15 @@ function loadUserTable(data){ | ||||
|         }); | ||||
|         setUsersTable(dTable);  // Cache user access table | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Create action bar | ||||
|     var actionBar = $('<div class="actionBar"></div>').css("width", "450px"); | ||||
|      | ||||
|  | ||||
|     var createLnk = $('<a>Create</a>'); | ||||
|     createLnk.click(function() { | ||||
|     	openCreateUserDialog(""); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     var editLnk = $('<a>Edit</a>'); | ||||
|     editLnk.click(function() { | ||||
|     	// Should only allow 1 user to be edited at a time | ||||
| @@ -151,7 +151,7 @@ function loadUserTable(data){ | ||||
|         	openCreateUserDialog(users[i]); | ||||
|         } | ||||
|     }); | ||||
|          | ||||
|  | ||||
|     var deleteLnk = $('<a>Delete</a>'); | ||||
|     deleteLnk.click(function() { | ||||
|     	// Find the user name from datatable | ||||
| @@ -166,85 +166,85 @@ function loadUserTable(data){ | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|          | ||||
|  | ||||
|         if (usersList) { | ||||
|         	openDeleteUserDialog(usersList); | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     var refreshLnk = $('<a>Refresh</a>'); | ||||
|     refreshLnk.click(function() { | ||||
|     	loadUserPage(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Create an action menu | ||||
|     var actionsMenu = createMenu([refreshLnk, createLnk, editLnk, deleteLnk]); | ||||
|     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 = $('<div id="' + tableId + '_menuDiv" class="menuDiv"></div>'); | ||||
|     $('#' + tableId + '_wrapper').prepend(menuDiv); | ||||
|     menuDiv.append(actionBar);     | ||||
|     menuDiv.append(actionBar); | ||||
|     $('#' + tableId + '_filter').appendTo(menuDiv); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Open create user dialog | ||||
|  *  | ||||
|  * | ||||
|  * @param data User data (only during edit) | ||||
|  */ | ||||
| function openCreateUserDialog(data) { | ||||
|     var dialogId = 'createUser'; | ||||
|      | ||||
|  | ||||
|     // Generate the user priority | ||||
|     var priority = parseFloat(topPriority) + 0.01; | ||||
|     priority = priority.toPrecision(3); | ||||
|      | ||||
|  | ||||
|     // Create form to create user | ||||
|     var createUserForm = $('<div id="' + dialogId + '" class="form"></div>'); | ||||
|      | ||||
|  | ||||
|     // Create info bar | ||||
|     var info = createInfoBar('Create a user and configure access to xCAT.'); | ||||
|      | ||||
|  | ||||
|     var userFS = $('<fieldset></fieldset>'); | ||||
|     var userLegend = $('<legend>User</legend>'); | ||||
|     userFS.append(userLegend); | ||||
|      | ||||
|  | ||||
|     var userAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>'); | ||||
|     userFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/nodes/users.png"></img></div>')); | ||||
|     userFS.append(userAttr); | ||||
|      | ||||
|  | ||||
|     var optionFS = $('<fieldset></fieldset>'); | ||||
|     var optionLegend = $('<legend>Options</legend>'); | ||||
|     optionFS.append(optionLegend); | ||||
|      | ||||
|  | ||||
|     var optionAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>'); | ||||
|     optionFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>')); | ||||
|     optionFS.append(optionAttr); | ||||
|      | ||||
|  | ||||
|     createUserForm.append(info, userFS, optionFS); | ||||
|      | ||||
|  | ||||
|     userAttr.append($('<div><label>Priority:</label><input type="text" name="priority" disabled="disabled" value="' + priority + '" title="The priority value for this user"/></div>')); | ||||
|     userAttr.append($('<div><label>User name:</label><input type="text" name="name" title="The user name to log into xCAT with"/></div>')); | ||||
|     var type = $('<div><label>Type:</label></div>'); | ||||
|     var typeSelect = $('<select name="user_type" title="Specifies the type of user.">' + | ||||
|     		'<option value="guest">Guest</option>' + | ||||
|     		'<option value="admin">Administrator</option>' +    		 | ||||
|     		'<option value="admin">Administrator</option>' + | ||||
| 		'</select>'); | ||||
|     type.append(typeSelect);     | ||||
|     type.append(typeSelect); | ||||
|     userAttr.append(type); | ||||
|     userAttr.append($('<div><label>Password:</label><input name="password" type="password" title="The user password that will be used to log into xCAT"></div>')); | ||||
|     userAttr.append($('<div><label>Confirm password:</label><input name="confirm_password" type="password" title="The user password that will be used to log into xCAT"></div>')); | ||||
|      | ||||
|  | ||||
|     optionAttr.append($('<div><label>Host:</label><input type="text" name="host" title="The host from which users may issue the commands specified by this rule. By default, it is all hosts."/></div>')); | ||||
|     optionAttr.append($('<div><label>Commands:</label><input type="text" name="commands" title="The list of commands that this rule applies to. By default, it is all commands."/></div>')); | ||||
|     optionAttr.append($('<div><label>Parameters:</label><input type="text" name="parameters" title="A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. By default, it is all parameters."/></div>')); | ||||
| @@ -253,15 +253,15 @@ function openCreateUserDialog(data) { | ||||
|     		'<option value="allow">Allow</option>' + | ||||
|     		'<option value="accept">Accept</option>' + | ||||
|     		'<option value="trusted">Trusted</option>' + | ||||
|     		'<option value="deny">Deny</option>' +  | ||||
|     		'<option value="deny">Deny</option>' + | ||||
| 		'</select></div>')); | ||||
|      | ||||
|  | ||||
|     optionAttr.append($('<div><label>Comments:</label><input type="text" name="comments" style="width: 250px;" title="Any user written notes"/></div>')); | ||||
|     optionAttr.append($('<div><label>Disable:</label><select name="disable" title="Set to yes to disable the user">' +  | ||||
|     		'<option value="">No</option>' +  | ||||
|     optionAttr.append($('<div><label>Disable:</label><select name="disable" title="Set to yes to disable the user">' + | ||||
|     		'<option value="">No</option>' + | ||||
|     		'<option value="yes">Yes</option>' + | ||||
| 		'</select></div>')); | ||||
|      | ||||
|  | ||||
| 	// Generate tooltips | ||||
|     createUserForm.find('div input[title],select[title]').tooltip({ | ||||
|         position: "center right", | ||||
| @@ -282,7 +282,7 @@ function openCreateUserDialog(data) { | ||||
|             this.getTip().css('z-index', $.topZIndex()); | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Open dialog to add disk | ||||
|     createUserForm.dialog({ | ||||
|         title:'Configure user', | ||||
| @@ -295,7 +295,7 @@ function openCreateUserDialog(data) { | ||||
|             "Ok": function(){ | ||||
|                 // Remove any warning messages | ||||
|                 $(this).find('.ui-state-error').remove(); | ||||
|                  | ||||
|  | ||||
|                 // Get inputs | ||||
|                 var priority = $(this).find('input[name=priority]').val(); | ||||
|                 var usrName = $(this).find('input[name=name]').val(); | ||||
| @@ -308,14 +308,14 @@ function openCreateUserDialog(data) { | ||||
|                 var rule = $(this).find('select[name=rule]').val(); | ||||
|                 var comments = $(this).find('input[name=comments]').val(); | ||||
|                 var disable = $(this).find('select[name=disable]').val(); | ||||
|                  | ||||
|  | ||||
|                 // Verify user name and passwords are supplied | ||||
|                 if (!usrName) { | ||||
|                     var warn = createWarnBar('Please provide a user name'); | ||||
|                     warn.prependTo($(this)); | ||||
|                     return; | ||||
|                 } | ||||
|                  | ||||
|  | ||||
|                 // Verify passwords match | ||||
|                 if (password != confirmPassword) { | ||||
|                 	var warn = createWarnBar('Passwords do not match'); | ||||
| @@ -331,47 +331,48 @@ function openCreateUserDialog(data) { | ||||
|                 } if (disable) { | ||||
|                     args += ' policy.disable=' + disable; | ||||
|                 } | ||||
|                  | ||||
|  | ||||
|                 // Handle cases where there are value or no value | ||||
|                 if (host) { | ||||
|                     args += " policy.host='" + host + "'"; | ||||
|                 } else { | ||||
|                 	args += " policy.host=''"; | ||||
|                 } | ||||
|                  | ||||
|                 //else { | ||||
|                 //	args += " policy.host=''"; | ||||
|                 //} | ||||
|  | ||||
|                 if (parameters) { | ||||
|                     args += " policy.parameters='" + parameters + "'"; | ||||
|                 } else { | ||||
|                 	args += " policy.parameters=''"; | ||||
|                 } | ||||
|                  | ||||
|                 }// else { | ||||
|                 //	args += " policy.parameters=''"; | ||||
|                 //} | ||||
|  | ||||
|                 if (nodeRange) { | ||||
|                     args += " policy.noderange='" + nodeRange + "'"; | ||||
|                 } else { | ||||
|                 	args += " policy.noderange=''"; | ||||
|                 } | ||||
|                 }// else { | ||||
|                 //	args += " policy.noderange=''"; | ||||
|                 //} | ||||
|  | ||||
|                 if (comments) { | ||||
|                     args += " policy.comments='" + comments + "'"; | ||||
|                 } else { | ||||
|                 	args += " policy.comments=''"; | ||||
|                 } | ||||
|                  | ||||
|                 }// else { | ||||
|                 //	args += " policy.comments=''"; | ||||
|                 //} | ||||
|  | ||||
|                 if (commands) { | ||||
|                     args += " policy.commands='" + commands + "'"; | ||||
|                 } else { | ||||
|                 	args += " policy.commands=''"; | ||||
|                 } | ||||
|                  | ||||
|                 }// else { | ||||
|                 //	args += " policy.commands=''"; | ||||
|                 //} | ||||
|  | ||||
|                 // Trim any extra spaces | ||||
|                 args = jQuery.trim(args);   | ||||
|                  | ||||
|                 args = jQuery.trim(args); | ||||
|  | ||||
|                 // Change dialog buttons | ||||
|                 $(this).dialog('option', 'buttons', { | ||||
|                     'Close': function() {$(this).dialog("close");} | ||||
|                 }); | ||||
|  | ||||
|                 // Submit request to update policy and passwd tables                 | ||||
|                 // Submit request to update policy and passwd tables | ||||
|                 $.ajax({ | ||||
|                     url : 'lib/cmd.php', | ||||
|                     dataType : 'json', | ||||
| @@ -381,7 +382,7 @@ function openCreateUserDialog(data) { | ||||
|                         args : 'policy||' + priority + '||' + args, | ||||
|                         msg : dialogId | ||||
|                     }, | ||||
|                      | ||||
|  | ||||
|                     success : updatePanel | ||||
|                 }); | ||||
|  | ||||
| @@ -395,11 +396,11 @@ function openCreateUserDialog(data) { | ||||
| 	                        args : 'passwd||' + usrName + '||' + password, | ||||
| 	                        msg : dialogId | ||||
| 	                    }, | ||||
| 	                     | ||||
|  | ||||
| 	                    success : updatePanel | ||||
| 	                }); | ||||
|                 } | ||||
|                                  | ||||
|  | ||||
|                 // Update highest priority | ||||
|                 topPriority = priority; | ||||
|             }, | ||||
| @@ -408,47 +409,47 @@ function openCreateUserDialog(data) { | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Change comments if access checkbox is checked | ||||
|     typeSelect.change(function() { | ||||
|     	var comments = createUserForm.find('input[name=comments]').val(); | ||||
|     	var cmds = createUserForm.find('input[name=commands]').val(); | ||||
|     	comments = jQuery.trim(comments); | ||||
|     	cmds = jQuery.trim(cmds); | ||||
|     	 | ||||
|  | ||||
|     	var tag = "privilege:root"; | ||||
|     	 | ||||
|  | ||||
|     	// The list of every command used by the self-service page | ||||
|     	// Every command must be separated by a comma | ||||
|     	var authorizedCmds = "authcheck,lsdef,nodestat,tabdump,rinv,rpower,rmvm,webportal,webrun"; | ||||
|     	 | ||||
|  | ||||
|     	// Append tag to commands and comments | ||||
|     	if (typeSelect.val().indexOf("admin") > -1) {  		 | ||||
|     	if (typeSelect.val().indexOf("admin") > -1) { | ||||
|     		if (comments && comments.charAt(comments.length - 1) != ";") { | ||||
|     			comments += ";"; | ||||
|     		} | ||||
|     		 | ||||
|  | ||||
|     		comments += tag; | ||||
|     		createUserForm.find('input[name=comments]').val(comments);    		 | ||||
|     		createUserForm.find('input[name=comments]').val(comments); | ||||
|     		createUserForm.find('input[name=commands]').val(""); | ||||
|     	} else { | ||||
|     		comments = comments.replace(tag, ""); | ||||
|     		comments = comments.replace(";;", ";"); | ||||
|     		createUserForm.find('input[name=comments]').val(comments);    		 | ||||
|     		createUserForm.find('input[name=comments]').val(comments); | ||||
|     		createUserForm.find('input[name=commands]').val(authorizedCmds); | ||||
|     	} | ||||
|     	 | ||||
|  | ||||
|     	// Strip off leading semi-colon | ||||
|     	if (comments.charAt(0) == ";") { | ||||
|     		comments = comments.substr(1, comments.length); | ||||
|     		createUserForm.find('input[name=comments]').val(comments); | ||||
|     	} | ||||
| 	}); | ||||
|      | ||||
|  | ||||
|     // Set the user data (on edit) | ||||
|     if (data) { | ||||
|     	var checkBox = $('#' + tableId + ' input[name="' + data + '"]'); | ||||
|     	 | ||||
|  | ||||
|     	var priority = data; | ||||
|         var name = checkBox.parents('tr').find('td:eq(2)').text(); | ||||
|         var host = checkBox.parents('tr').find('td:eq(3)').text(); | ||||
| @@ -459,14 +460,14 @@ function openCreateUserDialog(data) { | ||||
|         var rule = checkBox.parents('tr').find('td:eq(8)').text(); | ||||
|         var comments = checkBox.parents('tr').find('td:eq(9)').text(); | ||||
|         var disable = checkBox.parents('tr').find('td:eq(10)').text(); | ||||
|          | ||||
|  | ||||
|         createUserForm.find('input[name=priority]').val(priority); | ||||
|         createUserForm.find('input[name=name]').val(name); | ||||
|          | ||||
|  | ||||
|         // Do not show password (security) | ||||
|         createUserForm.find('input[name=password]').val(); | ||||
|         createUserForm.find('input[name=confirm_password]').val(); | ||||
|          | ||||
|  | ||||
|         createUserForm.find('input[name=host]').val(host); | ||||
|         createUserForm.find('input[name=commands]').val(commands); | ||||
|         createUserForm.find('input[name=parameters]').val(parameters); | ||||
| @@ -474,7 +475,7 @@ function openCreateUserDialog(data) { | ||||
|         createUserForm.find('select[name=rule]').val(rule); | ||||
|         createUserForm.find('input[name=comments]').val(comments); | ||||
|         createUserForm.find('select[name=disable]').val(disable); | ||||
|          | ||||
|  | ||||
|         if (comments.indexOf("privilege:root") > -1) { | ||||
|         	typeSelect.val("admin"); | ||||
|         } | ||||
| @@ -485,18 +486,18 @@ function openCreateUserDialog(data) { | ||||
| } | ||||
| /** | ||||
|  * Open dialog to confirm user delete | ||||
|  *  | ||||
|  * | ||||
|  * @param users Users to delete | ||||
|  */ | ||||
| function openDeleteUserDialog(users) { | ||||
|     // Create form to delete disk to pool | ||||
|     var dialogId = 'deleteUser'; | ||||
|     var deleteForm = $('<div id="' + dialogId + '" class="form"></div>'); | ||||
|          | ||||
|  | ||||
|     // 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', | ||||
| @@ -509,12 +510,12 @@ function openDeleteUserDialog(users) { | ||||
|             "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', | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -6,29 +6,26 @@ function loadHelpPage(){ | ||||
|     var tab = new Tab(); | ||||
|     tab.init(); | ||||
|     $('#content').append(tab.object()); | ||||
|      | ||||
|  | ||||
|     var helpForm = $('<div class="form"></div>'); | ||||
|     helpForm.append( | ||||
|         '<fieldset>' +  | ||||
|         '<fieldset>' + | ||||
|             '<legend>Quick Start</legend>' + | ||||
|             '<div style="display: inline-table; vertical-align: middle;"><img src="images/help/quick_start.png" style="width: 90%;"></img></div>' + | ||||
|             '<ol style="display: inline-table; vertical-align: middle;">' + | ||||
|                 '<li><a href="configure.php" style="color: blue;">1. Discover hardware</a><br/>Discover all hardware in the cluster. Define them in the xCAT database.</li>' + | ||||
|                 '<li><a href="index.php" style="color: blue;">2. View defined nodes</a><br/>View node definitions by groups in a table or graphical view.</li>' + | ||||
|                 '<li><a href="provision.php" style="color: blue;">3. Manage operating system images</a><br/>View operating system images defined in xCAT. Copy operating system ISOs into xCAT. Create stateful, stateless, or statelite images.</li>' + | ||||
|                 '<li><a href="provision.php" style="color: blue;">4. Provision nodes</a><br/>Create stateful, stateless, or statelite virtual machines. Install an operating system onto bare metal machines.</li>' + | ||||
|                 '<li><a href="provision.php" style="color: blue;">5. Manage and provision storage and networks</a><br/>Create network devices. Define storage for systems.</li>' + | ||||
|                 '<li><a href="monitor.php" style="color: blue;">6. Monitor cluster</a><br/>Monitor the xCAT cluster using one or more third party software such as Ganglia, RMC, etc. </li>' + | ||||
|                 '<li><a href="index.php" style="color: blue;">1. View defined nodes</a><br/>View node definitions by groups in a table.</li>' + | ||||
|                 '<li><a href="provision.php" style="color: blue;">2. Manage operating system images</a><br/>View operating system images defined in xCAT. Copy operating system ISOs into xCAT.</li>' + | ||||
|                 '<li><a href="provision.php" style="color: blue;">3. Provision nodes</a><br/>Create virtual machines. Install an operating system onto virtual machines.</li>' + | ||||
|                 '<li><a href="provision.php" style="color: blue;">4. Manage and provision storage and networks</a><br/>Create network devices. Define storage for systems.</li>' + | ||||
|             '</ol>' + | ||||
|         '</fieldset>' + | ||||
|         '<fieldset>' + | ||||
|             '<legend>Settings</legend>' +  | ||||
|             '<legend>Settings</legend>' + | ||||
|             '<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>' + | ||||
|             '<ol style="display: inline-table; vertical-align: middle;">' + | ||||
|                 '<li><a href="configure.php" style="color: blue;">a. Manage and control user access</a></li>' + | ||||
|                 '<li><a href="configure.php" style="color: blue;">b. Edit the xCAT database tables</a></li>' +  | ||||
|                 '<li><a href="configure.php" style="color: blue;">c. Update xCAT packages</a></li>' +  | ||||
|             '</ol>' +  | ||||
|                 '<li><a href="configure.php" style="color: blue;">b. Edit the xCAT database tables</a></li>' + | ||||
|             '</ol>' + | ||||
|         '</fieldset>'); | ||||
|     tab.add('helpTab', 'Help', helpForm, false); | ||||
| } | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /** | ||||
|  * Load nodeset page | ||||
|  *  | ||||
|  * | ||||
|  * @param tgtNodes Targets to run nodeset against | ||||
|  */ | ||||
| function loadNodesetPage(tgtNodes) { | ||||
| @@ -29,7 +29,7 @@ function loadNodesetPage(tgtNodes) { | ||||
|         inst = inst + 1; | ||||
|         tabId = 'nodesetTab' + inst; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Create nodeset form | ||||
|     var nodesetForm = $('<div class="form"></div>'); | ||||
|  | ||||
| @@ -44,23 +44,23 @@ function loadNodesetPage(tgtNodes) { | ||||
|     // Create info bar | ||||
|     var infoBar = createInfoBar('Set the boot state for a node range'); | ||||
|     nodesetForm.append(statBar, infoBar); | ||||
|      | ||||
|  | ||||
| 	// Create VM fieldset | ||||
|     var vmFS = $('<fieldset></fieldset>'); | ||||
|     var vmLegend = $('<legend>Virtual Machine</legend>'); | ||||
|     vmFS.append(vmLegend); | ||||
|     nodesetForm.append(vmFS); | ||||
|      | ||||
|  | ||||
|     var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>'); | ||||
|     vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>')); | ||||
|     vmFS.append(vmAttr); | ||||
|      | ||||
|  | ||||
| 	// Create options fieldset | ||||
|     var imageFS = $('<fieldset></fieldset>'); | ||||
|     var imageLegend = $('<legend>Image</legend>'); | ||||
|     imageFS.append(imageLegend); | ||||
|     nodesetForm.append(imageFS); | ||||
|      | ||||
|  | ||||
|     var imageAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>'); | ||||
|     imageFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>')); | ||||
|     imageFS.append(imageAttr); | ||||
| @@ -68,7 +68,7 @@ function loadNodesetPage(tgtNodes) { | ||||
|     // Create target node or group | ||||
|     var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>'); | ||||
|     vmAttr.append(tgt); | ||||
|      | ||||
|  | ||||
|     // Create boot type drop down | ||||
|     var type = $('<div></div>'); | ||||
|     var typeLabel = $('<label>Boot type:</label>'); | ||||
| @@ -80,13 +80,13 @@ function loadNodesetPage(tgtNodes) { | ||||
|     type.append(typeLabel); | ||||
|     type.append(typeSelect); | ||||
|     imageAttr.append(type); | ||||
|      | ||||
|  | ||||
|     // Create operating system image input | ||||
|     var os = $('<div></div>'); | ||||
|     var osLabel = $('<label>Operating system image:</label>'); | ||||
|     var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>'); | ||||
|     osSelect.append($('<option value=""></option>')); | ||||
|      | ||||
|  | ||||
|     var imageNames = $.cookie('imagenames').split(','); | ||||
|     if (imageNames) { | ||||
|         imageNames.sort(); | ||||
| @@ -112,7 +112,7 @@ function loadNodesetPage(tgtNodes) { | ||||
|             tooltip : "mouseover,mouseout" | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Ok | ||||
|      */ | ||||
| @@ -124,7 +124,7 @@ function loadNodesetPage(tgtNodes) { | ||||
|     okBtn.bind('click', function(event) { | ||||
|     	// Remove any warning messages | ||||
|     	$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); | ||||
|          | ||||
|  | ||||
|         // Check state, OS, arch, and profile | ||||
|         var ready = true; | ||||
|         var inputs = $('#' + tabId + ' input'); | ||||
| @@ -139,7 +139,7 @@ function loadNodesetPage(tgtNodes) { | ||||
|  | ||||
|         if (ready) { | ||||
|             // Get nodes | ||||
|             var tgts = $('#' + tabId + ' input[name=target]').val();             | ||||
|             var tgts = $('#' + tabId + ' input[name=target]').val(); | ||||
|             // Get boot type | ||||
|             var type = $('#' + tabId + ' select[id=bootType]').val(); | ||||
|             // Get operating system image | ||||
| @@ -185,7 +185,7 @@ function loadNodesetPage(tgtNodes) { | ||||
|  | ||||
| /** | ||||
|  * Update nodeset status | ||||
|  *  | ||||
|  * | ||||
|  * @param data Data returned from HTTP request | ||||
|  */ | ||||
| function updateNodesetStatus(data) { | ||||
| @@ -217,7 +217,7 @@ function updateNodesetStatus(data) { | ||||
|             // Create target nodes string | ||||
|             var tgtNodesStr = ''; | ||||
|             var nodes = tgts.split(','); | ||||
|              | ||||
|  | ||||
|             // Loop through each node | ||||
|             for ( var i in nodes) { | ||||
|                 // If it is the 1st and only node | ||||
| @@ -239,7 +239,7 @@ function updateNodesetStatus(data) { | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|              | ||||
|  | ||||
|             $('#' + statBarId).find('div').append('<pre>Node definition created for ' + tgtNodesStr + '</pre>'); | ||||
|             $.ajax( { | ||||
|                 url : 'lib/cmd.php', | ||||
| @@ -267,53 +267,7 @@ function updateNodesetStatus(data) { | ||||
|             $('#' + statBarId).find('div').append('<pre>/etc/hosts updated</pre>'); | ||||
|         } | ||||
|  | ||||
|         // Update DNS | ||||
|         $.ajax( { | ||||
|             url : 'lib/cmd.php', | ||||
|             dataType : 'json', | ||||
|             data : { | ||||
|                 cmd : 'makedns', | ||||
|                 tgt : '', | ||||
|                 args : '', | ||||
|                 msg : 'cmd=makedns;inst=' + inst | ||||
|             }, | ||||
|  | ||||
|             success : updateNodesetStatus | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * (5) Update DHCP | ||||
|      */ | ||||
|     else if (cmd == 'makedns') { | ||||
|         // Write ajax response to status bar | ||||
|         var prg = writeRsp(rsp, '');     | ||||
|         $('#' + statBarId).find('div').append(prg);     | ||||
|          | ||||
|         // Update DHCP | ||||
|         $.ajax( { | ||||
|             url : 'lib/cmd.php', | ||||
|             dataType : 'json', | ||||
|             data : { | ||||
|                 cmd : 'makedhcp', | ||||
|                 tgt : '', | ||||
|                 args : '-a', | ||||
|                 msg : 'cmd=makedhcp;inst=' + inst | ||||
|             }, | ||||
|  | ||||
|             success : updateNodesetStatus | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * (6) Prepare node for boot | ||||
|      */ | ||||
|     else if (cmd == 'makedhcp') { | ||||
|         // Write ajax response to status bar | ||||
|         var prg = writeRsp(rsp, '');     | ||||
|         $('#' + statBarId).find('div').append(prg);     | ||||
|  | ||||
|         // Prepare node for boot | ||||
|         // Go straight to prepare node for boot | ||||
|         $.ajax( { | ||||
|             url : 'lib/cmd.php', | ||||
|             dataType : 'json', | ||||
| @@ -329,12 +283,12 @@ function updateNodesetStatus(data) { | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * (7) Boot node from network | ||||
|      * (5) Boot node from network | ||||
|      */ | ||||
|     else if (cmd == 'nodeset') { | ||||
|         // Write ajax response to status bar | ||||
|         var prg = writeRsp(rsp, '');     | ||||
|         $('#' + statBarId).find('div').append(prg);     | ||||
|         var prg = writeRsp(rsp, ''); | ||||
|         $('#' + statBarId).find('div').append(prg); | ||||
|  | ||||
|         // Hide loader | ||||
|         $('#' + statBarId).find('img').hide(); | ||||
|   | ||||
| @@ -23,7 +23,7 @@ var softwareList = { | ||||
| function loadImagesPage() { | ||||
|     // Set padding for images page | ||||
|     $('#imagesTab').css('padding', '20px 60px'); | ||||
|      | ||||
|  | ||||
|     // Get images within the database | ||||
|     $.ajax( { | ||||
|         url : 'lib/cmd.php', | ||||
| @@ -41,7 +41,7 @@ function loadImagesPage() { | ||||
|  | ||||
| /** | ||||
|  * Load images within the database | ||||
|  *  | ||||
|  * | ||||
|  * @param data Data returned from HTTP request | ||||
|  */ | ||||
| function loadImages(data) { | ||||
| @@ -50,12 +50,12 @@ function loadImages(data) { | ||||
|     if (rsp[0].indexOf('Could not find any object definitions') > -1) { | ||||
|     	rsp = new Array(); | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Image attributes hash | ||||
|     var attrs = new Object(); | ||||
|     // Image attributes | ||||
|     var headers = new Object(); | ||||
|      | ||||
|  | ||||
|     // Clear hash table containing image attributes | ||||
|     origAttrs = ''; | ||||
|  | ||||
| @@ -82,7 +82,7 @@ function loadImages(data) { | ||||
|         attrs[image][key] = val; | ||||
|         headers[key] = 1; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Save attributes in hash table | ||||
|     origAttrs = attrs; | ||||
|  | ||||
| @@ -108,7 +108,7 @@ function loadImages(data) { | ||||
|         var checkBx = '<input type="checkbox" name="' + img + '"/>'; | ||||
|         // Push in checkbox and image name | ||||
|         row.push(checkBx, img); | ||||
|          | ||||
|  | ||||
|         // Go through each header | ||||
|         for (var i = 2; i < sorted.length; i++) { | ||||
|             // Add the node attributes to the row | ||||
| @@ -127,7 +127,7 @@ function loadImages(data) { | ||||
|  | ||||
|     // Clear the tab before inserting the table | ||||
|     $('#imagesTab').children().remove(); | ||||
|      | ||||
|  | ||||
|     // Create info bar for images tab | ||||
|     var info = createInfoBar('Double click on a cell to edit.  Click outside the table to save changes.  Hit the Escape key to ignore changes.'); | ||||
|     $('#imagesTab').append(info); | ||||
| @@ -142,13 +142,13 @@ function loadImages(data) { | ||||
|     copyCDLnk.click(function() { | ||||
|         openCopyCdDialog(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Generate stateless or statelite image | ||||
|     var generateLnk = $('<a>Generate image</a>'); | ||||
|     generateLnk.click(function() { | ||||
|         loadCreateImage(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Edit image attributes | ||||
|     var editLnk = $('<a>Edit</a>'); | ||||
|     editLnk.click(function() { | ||||
| @@ -159,22 +159,22 @@ function loadImages(data) { | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Add a row | ||||
|     var addLnk = $('<a>Add</a>'); | ||||
|     addLnk.click(function() { | ||||
|         openAddImageDialog(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Remove a row | ||||
|     var removeLnk = $('<a>Remove</a>'); | ||||
|     removeLnk.click(function() { | ||||
|         var images = getNodesChecked(imgTableId); | ||||
|         if (images) { | ||||
|             confirmImageDeleteDialog(images); | ||||
|         }         | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Refresh image table | ||||
|     var refreshLnk = $('<a>Refresh</a>'); | ||||
|     refreshLnk.click(function() { | ||||
| @@ -192,7 +192,7 @@ function loadImages(data) { | ||||
|             success : loadImages | ||||
|         }); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Insert table | ||||
|     $('#imagesTab').append(dTable.object()); | ||||
|  | ||||
| @@ -211,12 +211,12 @@ function loadImages(data) { | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Set datatable width | ||||
|     $('#' + imgTableId + '_wrapper').css({ | ||||
|         'width': '880px' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Actions | ||||
|     var actionBar = $('<div class="actionBar"></div>').css("width", "450px"); | ||||
|     var advancedLnk = '<a>Advanced</a>'; | ||||
| @@ -227,50 +227,50 @@ function loadImages(data) { | ||||
|     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 = $('<div id="' + imgTableId + '_menuDiv" class="menuDiv"></div>'); | ||||
|     $('#' + imgTableId + '_wrapper').prepend(menuDiv); | ||||
|     menuDiv.append(actionBar);     | ||||
|     menuDiv.append(actionBar); | ||||
|     $('#' + imgTableId + '_filter').appendTo(menuDiv); | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Enable editable columns | ||||
|      */ | ||||
|      | ||||
|  | ||||
|     // Do not make 1st or 2nd columns editable | ||||
|     $('#' + imgTableId + ' td:not(td:nth-child(1),td:nth-child(2))').editable( | ||||
|         function(value, settings) {     | ||||
|         function(value, settings) { | ||||
|             // Get column index | ||||
|             var colPos = this.cellIndex; | ||||
|                          | ||||
|  | ||||
|             // Get row index | ||||
|             var dTable = $('#' + imgTableId).dataTable(); | ||||
|             var rowPos = dTable.fnGetPosition(this.parentNode); | ||||
|              | ||||
|  | ||||
|             // Update datatable | ||||
|             dTable.fnUpdate(value, rowPos, colPos); | ||||
|              | ||||
|  | ||||
|             // Get image name | ||||
|             var image = $(this).parent().find('td:eq(1)').text(); | ||||
|                      | ||||
|  | ||||
|             // Get table headers | ||||
|             var headers = $('#' + imgTableId).parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th'); | ||||
|  | ||||
|             // Get attribute name | ||||
|             var attrName = jQuery.trim(headers.eq(colPos).text()); | ||||
|             // Get column value | ||||
|             var value = $(this).text();         | ||||
|             var value = $(this).text(); | ||||
|             // Build argument | ||||
|             var args = attrName + '=' + value; | ||||
|                      | ||||
|  | ||||
|             // Send command to change image attributes | ||||
|             $.ajax( { | ||||
|                 url : 'lib/cmd.php', | ||||
| @@ -293,7 +293,7 @@ function loadImages(data) { | ||||
|             event : "dblclick", // Double click and edit | ||||
|             height : '30px'     // The height of the text area | ||||
|         }); | ||||
|          | ||||
|  | ||||
|     // Get definable node attributes | ||||
|     $.ajax( { | ||||
|         url : 'lib/cmd.php', | ||||
| @@ -311,7 +311,7 @@ function loadImages(data) { | ||||
|  | ||||
| /** | ||||
|  * Open dialog to confirm deleting image | ||||
|  *  | ||||
|  * | ||||
|  * @param images Comma delimited image names | ||||
|  */ | ||||
| function confirmImageDeleteDialog(images) { | ||||
| @@ -321,7 +321,7 @@ function confirmImageDeleteDialog(images) { | ||||
|     var confirmDialog = $('<div id="' + dialogId + '">' | ||||
|             + '<p>Are you sure you want to remove ' + tmp + '?</p>' | ||||
|         + '</div>'); | ||||
|              | ||||
|  | ||||
|     // Open dialog to confirm delete | ||||
|     confirmDialog.dialog({ | ||||
|         modal: true, | ||||
| @@ -331,12 +331,12 @@ function confirmImageDeleteDialog(images) { | ||||
|         title: 'Confirm', | ||||
|         width: 500, | ||||
|         buttons: { | ||||
|             "Ok": function(){  | ||||
|             "Ok": function(){ | ||||
|                 // Change dialog buttons | ||||
|                 $(this).dialog('option', 'buttons', { | ||||
|                     'Close': function() {$(this).dialog("close");} | ||||
|                 }); | ||||
|                  | ||||
|  | ||||
|                 // Add image to xCAT | ||||
|                 $.ajax( { | ||||
|                     url : 'lib/cmd.php', | ||||
| @@ -351,7 +351,7 @@ function confirmImageDeleteDialog(images) { | ||||
|                     success : updateImageDialog | ||||
|                 }); | ||||
|             }, | ||||
|             "Cancel": function(){  | ||||
|             "Cancel": function(){ | ||||
|                 $(this).dialog("close"); | ||||
|             } | ||||
|         } | ||||
| @@ -365,32 +365,32 @@ function openAddImageDialog() { | ||||
|     // Create dialog to add image | ||||
|     var dialogId = 'addImage'; | ||||
|     var addImageForm = $('<div id="' + dialogId + '" class="form"></div>'); | ||||
|      | ||||
|  | ||||
|     // 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.'); | ||||
|      | ||||
|  | ||||
|     var imageFS = $('<fieldset></fieldset>'); | ||||
|     var imageLegend = $('<legend>Image</legend>'); | ||||
|     imageFS.append(imageLegend); | ||||
|     var imageAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>'); | ||||
|     imageFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>')); | ||||
|     imageFS.append(imageAttr); | ||||
|      | ||||
|  | ||||
|     var optionFS = $('<fieldset></fieldset>'); | ||||
|     var optionLegend = $('<legend>Options</legend>'); | ||||
|     optionFS.append(optionLegend); | ||||
|     var optionAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>'); | ||||
|     optionFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>')); | ||||
|     optionFS.append(optionAttr); | ||||
|      | ||||
|  | ||||
|     addImageForm.append(info, imageFS, optionFS); | ||||
|      | ||||
|  | ||||
|     // Create inputs for image attributes | ||||
|     var imageName = $('<div><label>Image name:</label><input type="text" name="imagename" disabled="disabled" title="The name of this xCAT OS image definition"/></div>'); | ||||
|     var imageType = $('<div><label>Image type:</label><input type="text" name="imagetype" value="linux" title="The type of operating system image this definition represents"/></div>'); | ||||
|     var architecture = $('<div><label>OS architecture:</label><input type="text" name="osarch" title="The hardware architecture of this image. Valid values: x86_64, x86, ia64, ppc64, and s390x."/></div>'); | ||||
|     var architecture = $('<div><label>OS architecture:</label><input type="text" name="osarch" title="The hardware architecture of this image. Valid values: s390x."/></div>'); | ||||
|     var osName = $('<div><label>OS name:</label><input type="text" name="osname" value="Linux" title="Operating system name"/></div>'); | ||||
|     var osVersion = $('<div><label>OS version:</label><input type="text" name="osvers" title="The operating system deployed on this node. Valid values: rhel*, centos*, fedora*, sles* (where * is the version #)."/></div>');     | ||||
|     var osVersion = $('<div><label>OS version:</label><input type="text" name="osvers" title="The operating system deployed on this node. Valid values: rhel*, sles* (where * is the version #)."/></div>'); | ||||
|     var profile = $('<div><label>Profile:</label><input type="text" name="profile" title="The node usage category"/></div>'); | ||||
|     var provisionMethod = $('<div><label>Provision method:</label></div>'); | ||||
|     var provisionSelect = $('<select name="provmethod" title="The provisioning method for node deployment">' | ||||
| @@ -400,7 +400,7 @@ function openAddImageDialog() { | ||||
|             + '<option value="statelite">statelite</option>' | ||||
|         + '</select>'); | ||||
|     provisionMethod.append(provisionSelect); | ||||
|      | ||||
|  | ||||
|     // Create inputs for optional attributes | ||||
|     var otherpkgDirectory = $('<div><label>Other package directory:</label></div>'); | ||||
|     var otherpkgDirectoryInput = $('<input type="text" name="otherpkgdir" title="The base directory where the non-distro packages are stored"/>'); | ||||
| @@ -498,10 +498,10 @@ function openAddImageDialog() { | ||||
|         height : '300', | ||||
|         basePath : '/install' // Limit user to only install directory | ||||
|     }); | ||||
|          | ||||
|  | ||||
|     imageAttr.append(imageName, imageType, architecture, osName, osVersion, profile, provisionMethod); | ||||
|     optionAttr.append(otherpkgDirectory, packageDirectory, packageList, template); | ||||
|          | ||||
|  | ||||
| 	// Generate tooltips | ||||
|     addImageForm.find('div input[title],select[title]').tooltip({ | ||||
|         position: "center right", | ||||
| @@ -522,7 +522,7 @@ function openAddImageDialog() { | ||||
|             this.getTip().css('z-index', $.topZIndex()); | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Open dialog to add image | ||||
|     addImageForm.dialog({ | ||||
|         title:'Add image', | ||||
| @@ -536,7 +536,7 @@ function openAddImageDialog() { | ||||
|             "Ok": function(){ | ||||
|                 // Remove any warning messages | ||||
|                 $(this).find('.ui-state-error').remove(); | ||||
|                  | ||||
|  | ||||
|                 // Get image attributes | ||||
|                 var imageType = $(this).find('input[name="imagetype"]'); | ||||
|                 var architecture = $(this).find('input[name="osarch"]'); | ||||
| @@ -544,13 +544,13 @@ function openAddImageDialog() { | ||||
|                 var osVersion = $(this).find('input[name="osvers"]'); | ||||
|                 var profile = $(this).find('input[name="profile"]'); | ||||
|                 var provisionMethod = $(this).find('select[name="provmethod"]'); | ||||
|                  | ||||
|  | ||||
|                 // Get optional image attributes | ||||
|                 var otherpkgDirectory = $(this).find('input[name="otherpkgdir"]'); | ||||
|                 var pkgDirectory = $(this).find('input[name="pkgdir"]'); | ||||
|                 var pkgList = $(this).find('input[name="pkglist"]'); | ||||
|                 var template = $(this).find('input[name="template"]'); | ||||
|                  | ||||
|  | ||||
|                 // Check that image attributes are provided before continuing | ||||
|                 var ready = 1; | ||||
|                 var inputs = new Array(imageType, architecture, osName, osVersion, profile, provisionMethod); | ||||
| @@ -561,7 +561,7 @@ function openAddImageDialog() { | ||||
|                     } 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.'); | ||||
| @@ -570,12 +570,12 @@ function openAddImageDialog() { | ||||
|                     // 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");} | ||||
|                     }); | ||||
|                      | ||||
|  | ||||
|                     // Create arguments to send via AJAX | ||||
|                     var args = '-t;osimage;-o;' + imageName.val() + ';' + | ||||
|                         'imagetype=' + imageType.val() + ';' + | ||||
| @@ -584,7 +584,7 @@ function openAddImageDialog() { | ||||
|                         'osvers=' + osVersion.val() + ';' + | ||||
|                         'profile=' + profile.val() + ';' + | ||||
|                         'provmethod=' + provisionMethod.val(); | ||||
|                      | ||||
|  | ||||
|                     // Get optional attributes | ||||
|                     if (otherpkgDirectory.val()) | ||||
|                         args += ';otherpkgdir=' + otherpkgDirectory.val(); | ||||
| @@ -594,7 +594,7 @@ function openAddImageDialog() { | ||||
|                         args += ';pkglist=' + pkgList.val(); | ||||
|                     if (template.val()) | ||||
|                         args += ';template=' + template.val(); | ||||
|                      | ||||
|  | ||||
|                     // Add image to xCAT | ||||
|                     $.ajax( { | ||||
|                         url : 'lib/cmd.php', | ||||
| @@ -605,7 +605,7 @@ function openAddImageDialog() { | ||||
|                             args : args, | ||||
|                             msg : dialogId | ||||
|                         }, | ||||
|      | ||||
|  | ||||
|                         success : updateImageDialog | ||||
|                     }); | ||||
|                 } | ||||
| @@ -619,40 +619,40 @@ function openAddImageDialog() { | ||||
|  | ||||
| /** | ||||
|  * Update image dialog | ||||
|  *  | ||||
|  * | ||||
|  * @param data HTTP request data | ||||
|  */ | ||||
| function updateImageDialog(data) {     | ||||
| function updateImageDialog(data) { | ||||
|     var dialogId = data.msg; | ||||
|     var infoMsg; | ||||
|      | ||||
|  | ||||
|     // Delete loader if one does exist | ||||
|     $('.ui-dialog #' + dialogId + ' img[src="images/loader.gif"]').remove(); | ||||
|  | ||||
|     // Create info message | ||||
|     if (jQuery.isArray(data.rsp)) { | ||||
|         infoMsg = ''; | ||||
|          | ||||
|  | ||||
|         // If the data returned is more than 10 lines, get only the last line | ||||
|         var i, start; | ||||
|         if (data.rsp.length > 10) | ||||
|             start = data.rsp.length - 1; | ||||
|         else | ||||
|             start = 0; | ||||
|          | ||||
|  | ||||
|         for (i = start; i < data.rsp.length; i++) | ||||
|             infoMsg += data.rsp[i] + '</br>'; | ||||
|     } else { | ||||
|         infoMsg = data.rsp; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Create info bar with close button | ||||
|     var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>').css('margin', '5px 0px'); | ||||
|     var icon = $('<span class="ui-icon ui-icon-info"></span>').css({ | ||||
|         'display': 'inline-block', | ||||
|         'margin': '10px 5px' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Create close button to close info bar | ||||
|     var close = $('<span class="ui-icon ui-icon-close"></span>').css({ | ||||
|         'display': 'inline-block', | ||||
| @@ -660,25 +660,25 @@ function updateImageDialog(data) { | ||||
|     }).click(function() { | ||||
|         $(this).parent().remove(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     var msg = $('<p>' + infoMsg + '</p>').css({ | ||||
|         'display': 'inline-block', | ||||
|         'width': '90%' | ||||
|     }); | ||||
|      | ||||
|     infoBar.append(icon, msg, close);     | ||||
|  | ||||
|     infoBar.append(icon, msg, close); | ||||
|     infoBar.prependTo($('.ui-dialog #' + dialogId)); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Set definable image attributes | ||||
|  *  | ||||
|  * | ||||
|  * @param data Data returned from HTTP request | ||||
|  */ | ||||
| function setImageDefAttrs(data) { | ||||
|     // Clear hash table containing definable image attributes | ||||
|     defAttrs = new Array(); | ||||
|      | ||||
|  | ||||
|     // Get definable attributes | ||||
|     var attrs = data.rsp[2].split(/\n/); | ||||
|  | ||||
| @@ -686,19 +686,19 @@ function setImageDefAttrs(data) { | ||||
|     var attr, key, descr; | ||||
|     for (var i in attrs) { | ||||
|         attr = attrs[i]; | ||||
|          | ||||
|  | ||||
|         // If the line is not empty | ||||
|         if (attr) { | ||||
|             // If the line has the attribute name  | ||||
|             // If the line has the attribute name | ||||
|             if (attr.indexOf(':') && attr.indexOf(' ')) { | ||||
|                 // Get attribute name and description | ||||
|                 key = jQuery.trim(attr.substring(0, attr.indexOf(':'))); | ||||
|                 descr = jQuery.trim(attr.substring(attr.indexOf(':') + 1)); | ||||
|                 descr = descr.replace(new RegExp('<', 'g'), '[').replace(new RegExp('>', 'g'), ']'); | ||||
|                                  | ||||
|  | ||||
|                 // Set hash table where key = attribute name and value = description | ||||
|                 defAttrs[key] = descr; | ||||
|             } else {                 | ||||
|             } else { | ||||
|                 // Append description to hash table | ||||
|                 defAttrs[key] = defAttrs[key] + '\n' + attr.replace(new RegExp('<', 'g'), '[').replace(new RegExp('>', 'g'), ']'); | ||||
|             } | ||||
| @@ -713,7 +713,7 @@ function loadCreateImage() { | ||||
|     // Get nodes tab | ||||
|     var tab = getProvisionTab(); | ||||
|     var tabId = 'createImageTab'; | ||||
|      | ||||
|  | ||||
|     // Generate new tab ID | ||||
|     if ($('#' + tabId).size()) { | ||||
|         tab.select(tabId); | ||||
| @@ -723,7 +723,7 @@ function loadCreateImage() { | ||||
|     var imageOsVers = $.cookie("osvers").split(","); | ||||
|     var imageArch = $.cookie("osarchs").split(","); | ||||
|     var profiles = $.cookie("profiles").split(","); | ||||
|      | ||||
|  | ||||
|     var createImgForm = $('<div class="form"></div>'); | ||||
|     var createImgFS = $('<fieldset></fieldset>').append('<legend>Create Image</legend>'); | ||||
|     createImgForm.append(createImgFS); | ||||
| @@ -746,20 +746,20 @@ function loadCreateImage() { | ||||
|  | ||||
|     // Netboot interface input | ||||
|     createImgFS.append($('<div><label>Netboot interface:</label><input type="text" id="netbootif"/></div>')); | ||||
|      | ||||
|  | ||||
|     // Profile selector | ||||
|     var profileSelect = $('<select id="profile" onchange="hpcShow()">'); | ||||
|     for (var i in profiles) | ||||
|         profileSelect.append('<option value="' + profiles[i] + '">' + profiles[i] + '</option>'); | ||||
|     createImgFS.append($('<div><label>Profile:</label></div>').append(profileSelect)); | ||||
|      | ||||
|  | ||||
|     // Boot method drop down | ||||
|     createImgFS.append($('<div><label>Boot method:</label>' + | ||||
|         '<select id="bootmethod">' + | ||||
|             '<option value="stateless">stateless</option>' +  | ||||
|             '<option value="statelite">statelite</option>' +  | ||||
|             '<option value="stateless">stateless</option>' + | ||||
|             '<option value="statelite">statelite</option>' + | ||||
|         '</select></div>')); | ||||
|      | ||||
|  | ||||
|     // Create HPC software stack fieldset | ||||
|     createHpcFS(createImgForm); | ||||
|  | ||||
| @@ -770,25 +770,25 @@ function loadCreateImage() { | ||||
|     }); | ||||
|  | ||||
|     createImgForm.append(createImageBtn); | ||||
|      | ||||
|  | ||||
|     // Add tab | ||||
|     tab.add(tabId, 'Create', createImgForm, true); | ||||
|     tab.select(tabId); | ||||
|  | ||||
|     // Check the selected OS version and OS arch for HPC stack | ||||
|     // If they are valid, show the HCP stack fieldset | ||||
|     hpcShow();     | ||||
|     hpcShow(); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Create HPC fieldset | ||||
|  *  | ||||
|  * | ||||
|  * @param container The container to hold the HPC fieldset | ||||
|  */ | ||||
| function createHpcFS(container) { | ||||
|     var hpcFieldset = $('<fieldset id="hpcsoft"></fieldset>'); | ||||
|     hpcFieldset.append('<legend>HPC Software Stack</legend>'); | ||||
|      | ||||
|  | ||||
|     var str = 'Before selecting the software, you should have the following already completed on your xCAT cluster:<br/><br/>' | ||||
|             + '1. If you are using the xCAT hierarchy, your service nodes are installed and running.<br/>' | ||||
|             + '2. Your compute nodes are defined in xCAT, and you have verified your hardware control capabilities, ' | ||||
| @@ -797,12 +797,12 @@ function createHpcFS(container) { | ||||
|             + '4. You should install the software on the management node and copy all correponding packages into the location "/install/custom/otherpkgs/" based on ' | ||||
|             + 'these <a href="http://sourceforge.net/apps/mediawiki/xcat/index.php?title=IBM_HPC_Stack_in_an_xCAT_Cluster" target="_blank">documents</a>.<br/>'; | ||||
|     hpcFieldset.append(createInfoBar(str)); | ||||
|      | ||||
|  | ||||
|     // Advanced software | ||||
|     str = '<div id="partlysupport"><ul><li id="gpfsli"><input type="checkbox" onclick="softwareCheck(this)" name="gpfs">GPFS</li>' + | ||||
|         '<li id="rsctli"><input type="checkbox" onclick="softwareCheck(this)" name="rsct">RSCT</li>' +  | ||||
|         '<li id="peli"><input type="checkbox" onclick="softwareCheck(this)" name="pe">PE</li>' +  | ||||
|         '<li id="esslli"><input type="checkbox" onclick="esslCheck(this)" name="essl">ESSl & PESSL</li>' +  | ||||
|         '<li id="rsctli"><input type="checkbox" onclick="softwareCheck(this)" name="rsct">RSCT</li>' + | ||||
|         '<li id="peli"><input type="checkbox" onclick="softwareCheck(this)" name="pe">PE</li>' + | ||||
|         '<li id="esslli"><input type="checkbox" onclick="esslCheck(this)" name="essl">ESSl & PESSL</li>' + | ||||
|         '</ul></div>' + | ||||
|         '<div><ul><li id="gangliali"><input type="checkbox" onclick="softwareCheck(this)" name="ganglia">Ganglia</li>' + | ||||
|         '</ul></div>'; | ||||
| @@ -813,7 +813,7 @@ function createHpcFS(container) { | ||||
|  | ||||
| /** | ||||
|  * Check the dependance for ESSL and start the software check for ESSL | ||||
|  *  | ||||
|  * | ||||
|  * @param softwareObject The checkbox object of ESSL | ||||
|  */ | ||||
| function esslCheck(softwareObject) { | ||||
| @@ -821,11 +821,11 @@ function esslCheck(softwareObject) { | ||||
|     if (!$('#createImageTab input[name=pe]').attr('checked')) { | ||||
|         var warnBar = createWarnBar('You must first select the PE'); | ||||
|         $(':checkbox[name=essl]').attr("checked", false); | ||||
|          | ||||
|  | ||||
|         // Clear existing warnings and append new warning | ||||
|         $('#hpcsoft .ui-state-error').remove(); | ||||
|         $('#hpcsoft').prepend(warnBar); | ||||
|          | ||||
|  | ||||
|         return; | ||||
|     } else { | ||||
|         softwareCheck(softwareObject); | ||||
| @@ -834,7 +834,7 @@ function esslCheck(softwareObject) { | ||||
|  | ||||
| /** | ||||
|  * Check the parameters for the HPC software | ||||
|  *  | ||||
|  * | ||||
|  * @param softwareObject Checkbox object of the HPC software | ||||
|  * @return True if the checkbox is checked, false otherwise | ||||
|  */ | ||||
| @@ -869,14 +869,14 @@ function softwareCheck(softwareObject) { | ||||
|  | ||||
| /** | ||||
|  * Check if the RPMs are copied to the special location | ||||
|  *  | ||||
|  * | ||||
|  * @param data Data returned from HTTP request | ||||
|  */ | ||||
| function rpmCopyCheck(data) { | ||||
|     // Remove the loading image | ||||
|     var errorStr = ''; | ||||
|     var softwareName = data.msg; | ||||
|      | ||||
|  | ||||
|     // Check the return information | ||||
|     var reg = /.+:(.+): No such.*/; | ||||
|     var resultArray = data.rsp.split("\n"); | ||||
| @@ -891,7 +891,7 @@ function rpmCopyCheck(data) { | ||||
|         } | ||||
|     } | ||||
|     $('#createImageTab #' + softwareName + 'li').find('img').remove(); | ||||
|      | ||||
|  | ||||
|     // No error, show the check image | ||||
|     if (!errorStr) { | ||||
|         var infoPart = '<div style="display:inline-block; margin:0px"><span class="ui-icon ui-icon-circle-check"></span></div>'; | ||||
| @@ -901,7 +901,7 @@ function rpmCopyCheck(data) { | ||||
|         errorStr = 'To install the RSCT on your compute node. You should:<br/>' + errorStr + '</div>'; | ||||
|         var warnBar = createWarnBar(errorStr); | ||||
|         $(':checkbox[name=' + softwareName + ']').attr("checked", false); | ||||
|          | ||||
|  | ||||
|         // Clear existing warnings and append new warning | ||||
|         $('#hpcsoft .ui-state-error').remove(); | ||||
|         $('#hpcsoft').prepend(warnBar); | ||||
| @@ -910,7 +910,7 @@ function rpmCopyCheck(data) { | ||||
|  | ||||
| /** | ||||
|  * Generate the RPM command for rpmcheck | ||||
|  *  | ||||
|  * | ||||
|  * @param softwareName The name of the software | ||||
|  * @return The RPM command | ||||
|  */ | ||||
| @@ -924,13 +924,13 @@ function genRpmCmd(softwareName) { | ||||
|     for (var i in softwareList['base']) { | ||||
|         cmdString += softwareList['base'][i] + ' '; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     return cmdString; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Check if the RPMs for the HPC software are copied to the special location | ||||
|  *  | ||||
|  * | ||||
|  * @param softwareName The name of the software | ||||
|  */ | ||||
| function genLsCmd(softwareName) { | ||||
| @@ -949,7 +949,7 @@ function genLsCmd(softwareName) { | ||||
|  | ||||
| /** | ||||
|  * Check if all RPMs are installed | ||||
|  *  | ||||
|  * | ||||
|  * @param checkInfo 'rpm -q' output | ||||
|  * @return True if all RPMs are installed, false otherwise | ||||
|  */ | ||||
| @@ -969,7 +969,7 @@ function rpmCheck(checkInfo, name) { | ||||
|  | ||||
|     errorStr = errorStr.substr(0, errorStr.length - 1); | ||||
|     $(':checkbox[name=' + name + ']').attr('checked', false); | ||||
|      | ||||
|  | ||||
|     // Add the error | ||||
|     var warnBar = createWarnBar(errorStr); | ||||
|     $('#createImageTab #' + name + 'li').find('img').remove(); | ||||
| @@ -977,7 +977,7 @@ function rpmCheck(checkInfo, name) { | ||||
|     // Clear existing warnings and append new warning | ||||
|     $('#hpcsoft .ui-state-error').remove(); | ||||
|     $('#hpcsoft').prepend(warnBar); | ||||
|      | ||||
|  | ||||
|     return; | ||||
| } | ||||
|  | ||||
| @@ -996,7 +996,7 @@ function hpcShow() { | ||||
|  | ||||
| /** | ||||
|  * Load set image properties page | ||||
|  *  | ||||
|  * | ||||
|  * @param tgtImage Target image to set properties | ||||
|  */ | ||||
| function openEditImagePage(tgtImage) { | ||||
| @@ -1033,7 +1033,7 @@ function openEditImagePage(tgtImage) { | ||||
|         } else { | ||||
|             value = ''; | ||||
|         } | ||||
|          | ||||
|  | ||||
|         // Create label and input for attribute | ||||
|         div = $('<div></div>').css('display', 'inline'); | ||||
|         label = $('<label>' + key + ':</label>').css('vertical-align', 'middle'); | ||||
| @@ -1042,17 +1042,17 @@ function openEditImagePage(tgtImage) { | ||||
|             'float': 'none', | ||||
|             'width': 'inherit' | ||||
|         }); | ||||
|          | ||||
|  | ||||
|         // There is an element called groups that will override the defaults for the groups attribute. | ||||
|         // Hence, the input must have use CSS to override the float and width. | ||||
|          | ||||
|  | ||||
|         // Split attributes into 2 per row | ||||
|         if (attrIndex > 0 && !(attrIndex % 2)) { | ||||
|             div.css('display', 'inline-block'); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         attrIndex++; | ||||
|          | ||||
|  | ||||
|         // Create server browser | ||||
|         switch (key) { | ||||
|             case 'pkgdir': | ||||
| @@ -1178,22 +1178,22 @@ function openEditImagePage(tgtImage) { | ||||
|             default: | ||||
|                 // Do nothing | ||||
|         } | ||||
|          | ||||
|  | ||||
|         // Change border to blue onchange | ||||
|         input.bind('change', function(event) { | ||||
|             $(this).css('border-color', 'blue'); | ||||
|         }); | ||||
|          | ||||
|  | ||||
|         div.append(label, input); | ||||
|         setPropsForm.append(div); | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Change style for last division | ||||
|     div.css({ | ||||
|         'display': 'block', | ||||
|         'margin': '0px 0px 10px 0px' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Generate tooltips | ||||
|     setPropsForm.find('div input[title]').tooltip({ | ||||
|         position: "center right", | ||||
| @@ -1214,10 +1214,10 @@ function openEditImagePage(tgtImage) { | ||||
|      * Save | ||||
|      */ | ||||
|     var saveBtn = createButton('Save'); | ||||
|     saveBtn.bind('click', function(event) {     | ||||
|     saveBtn.bind('click', function(event) { | ||||
|         // Get all inputs | ||||
|         var inputs = $('#' + newTabId + ' input'); | ||||
|          | ||||
|  | ||||
|         // Go through each input | ||||
|         var args = ''; | ||||
|         var attrName, attrVal; | ||||
| @@ -1226,11 +1226,11 @@ function openEditImagePage(tgtImage) { | ||||
|             if ($(this).css('border-left-color') == 'rgb(0, 0, 255)') { | ||||
|                 // Change border color back to normal | ||||
|                 $(this).css('border-color', ''); | ||||
|                  | ||||
|  | ||||
|                 // Get attribute name and value | ||||
|                 attrName = $(this).parent().find('label').text().replace(':', ''); | ||||
|                 attrVal = $(this).val(); | ||||
|                  | ||||
|  | ||||
|                 // Build argument string | ||||
|                 if (args) { | ||||
|                     // Handle subsequent arguments | ||||
| @@ -1241,7 +1241,7 @@ function openEditImagePage(tgtImage) { | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|          | ||||
|  | ||||
|         // Send command to change image attributes | ||||
|         $.ajax( { | ||||
|             url : 'lib/cmd.php', | ||||
| @@ -1257,7 +1257,7 @@ function openEditImagePage(tgtImage) { | ||||
|         }); | ||||
|     }); | ||||
|     setPropsForm.append(saveBtn); | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Cancel | ||||
|      */ | ||||
| @@ -1278,15 +1278,15 @@ function openEditImagePage(tgtImage) { | ||||
| /** | ||||
|  * Load copy CD page | ||||
|  */ | ||||
| function openCopyCdDialog() {     | ||||
| function openCopyCdDialog() { | ||||
|     // Create copy Linux form | ||||
|     var dialogId = 'imageCopyCd'; | ||||
|     var copyLinuxForm = $('<div id="' + dialogId + '" class="form"></div>'); | ||||
|              | ||||
|  | ||||
|     // Create info bar | ||||
|     var infoBar = createInfoBar('Copy Linux distributions and service levels from CDs or DVDs to the install directory.'); | ||||
|     copyLinuxForm.append(infoBar); | ||||
|              | ||||
|  | ||||
|     // Create Linux ISO input | ||||
|     var iso = $('<div></div>'); | ||||
|     var isoLabel = $('<label> Linux ISO/DVD:</label>').css('vertical-align', 'middle'); | ||||
| @@ -1294,12 +1294,12 @@ function openCopyCdDialog() { | ||||
|     iso.append(isoLabel); | ||||
|     iso.append(isoInput); | ||||
|     copyLinuxForm.append(iso); | ||||
|      | ||||
|  | ||||
|     // Create architecture input | ||||
|     copyLinuxForm.append('<div><label>Architecture:</label><input type="text" id="arch" name="arch" title="The hardware architecture of this node. Valid values: x86_64, x86, ia64, ppc64, and s390x."/></div>'); | ||||
|     copyLinuxForm.append('<div><label>Architecture:</label><input type="text" id="arch" name="arch" title="The hardware architecture of this node. Valid values: s390x."/></div>'); | ||||
|     // Create distribution input | ||||
|     copyLinuxForm.append('<div><label>Distribution:</label><input type="text" id="distro" name="distro" title="The operating system name. Valid values: rhel*, centos*, fedora*, sles* (where * is the version #)."/></div>'); | ||||
|              | ||||
|     copyLinuxForm.append('<div><label>Distribution:</label><input type="text" id="distro" name="distro" title="The operating system name. Valid values: rhel*, sles* (where * is the version #).<br>Note: dashes are parsed to fill in distro, profile, os, and arch fields in xCAT table."/></div>'); | ||||
|  | ||||
|     /** | ||||
|      * Browse | ||||
|      */ | ||||
| @@ -1328,7 +1328,7 @@ function openCopyCdDialog() { | ||||
|         height : '300', | ||||
|         basePath : '/install' // Limit user to only install directory | ||||
|     }); | ||||
|      | ||||
|  | ||||
| 	// Generate tooltips | ||||
|     copyLinuxForm.find('div input[title],select[title]').tooltip({ | ||||
|         position: "center right", | ||||
| @@ -1349,7 +1349,7 @@ function openCopyCdDialog() { | ||||
|             this.getTip().css('z-index', $.topZIndex()); | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Open dialog to copy CD | ||||
|     copyLinuxForm.dialog({ | ||||
|         title:'Copy CD', | ||||
| @@ -1362,12 +1362,12 @@ function openCopyCdDialog() { | ||||
|             "Copy": function() { | ||||
|                 // Show loader | ||||
|                 $('.ui-dialog #imageCopyCd').append(createLoader('')); | ||||
|                  | ||||
|  | ||||
|                 // Change dialog buttons | ||||
|                 $(this).dialog('option', 'buttons', { | ||||
|                     'Close': function() {$(this).dialog("close");} | ||||
|                 }); | ||||
|                                  | ||||
|  | ||||
|                 // Get image attributes | ||||
|                 var iso = $(this).find('input[name="iso"]'); | ||||
|                 var arch = $(this).find('input[name="arch"]'); | ||||
| @@ -1383,7 +1383,7 @@ function openCopyCdDialog() { | ||||
|                         args : '-n;' + distro.val() + ';-a;' + arch.val() + ';' + iso.val(), | ||||
|                         msg : dialogId | ||||
|                     }, | ||||
|                      | ||||
|  | ||||
|                     success : updateImageDialog | ||||
|                 }); | ||||
|             }, | ||||
| @@ -1429,7 +1429,7 @@ function createImage() { | ||||
|             msg : '' | ||||
|         }, | ||||
|         success : function(data) { | ||||
|              | ||||
|  | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| @@ -5,7 +5,7 @@ var provisionTabs; // Provision tabs | ||||
|  | ||||
| /** | ||||
|  * Set the provision tab | ||||
|  *  | ||||
|  * | ||||
|  * @param obj Tab object | ||||
|  */ | ||||
| function setProvisionTab(obj) { | ||||
| @@ -14,7 +14,7 @@ function setProvisionTab(obj) { | ||||
|  | ||||
| /** | ||||
|  * Get the provision tab | ||||
|  *  | ||||
|  * | ||||
|  * @param Nothing | ||||
|  * @return Tab object | ||||
|  */ | ||||
| @@ -63,10 +63,10 @@ function loadProvisionPage() { | ||||
|             success : setGroupsCookies | ||||
|         }); | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Create info bar | ||||
|     var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.'); | ||||
|      | ||||
|  | ||||
|     // Create provision page | ||||
|     var provPg = $('<div class="form"></div>'); | ||||
|     provPg.append(infoBar); | ||||
| @@ -79,13 +79,13 @@ function loadProvisionPage() { | ||||
|  | ||||
|     // Create radio buttons for platforms | ||||
|     var hwList = $('<ol>Platforms available:</ol>'); | ||||
|     var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>'); | ||||
|     var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>'); | ||||
|     var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>'); | ||||
|     var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>'); | ||||
|     var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>'); | ||||
|     var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>'); | ||||
|      | ||||
|     var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>'); | ||||
|     var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>'); | ||||
|     var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>'); | ||||
|     var ipmi = $('<li><input type="radio" name="hw" value="ipmi" disabled/>iDataPlex</li>'); | ||||
|     var blade = $('<li><input type="radio" name="hw" value="blade" disabled/>BladeCenter</li>'); | ||||
|     var hmc = $('<li><input type="radio" name="hw" value="hmc" disabled/>System p</li>'); | ||||
|  | ||||
|     hwList.append(esx); | ||||
|     hwList.append(kvm); | ||||
|     hwList.append(zvm); | ||||
| @@ -101,7 +101,7 @@ function loadProvisionPage() { | ||||
|     okBtn.bind('click', function(event) { | ||||
|         // Get hardware that was selected | ||||
|         var hw = $(this).parent().find('input[name="hw"]:checked').val(); | ||||
|          | ||||
|  | ||||
|         var inst = 0; | ||||
|         var newTabId = hw + 'ProvisionTab' + inst; | ||||
|         while ($('#' + newTabId).length) { | ||||
| @@ -109,7 +109,7 @@ function loadProvisionPage() { | ||||
|             inst = inst + 1; | ||||
|             newTabId = hw + 'ProvisionTab' + inst; | ||||
|         } | ||||
|          | ||||
|  | ||||
|         // Create an instance of the plugin | ||||
|         var title = ''; | ||||
|         var plugin; | ||||
| @@ -146,7 +146,7 @@ function loadProvisionPage() { | ||||
|         plugin.loadProvisionPage(newTabId); | ||||
|     }); | ||||
|     provPg.append(okBtn); | ||||
|      | ||||
|  | ||||
|     // Create resources tab | ||||
|     var resrcPg = $('<div class="form"></div>'); | ||||
|  | ||||
| @@ -156,20 +156,20 @@ function loadProvisionPage() { | ||||
|  | ||||
|     // Create radio buttons for platforms | ||||
|     var rsrcHwList = $('<ol>Platforms available:</ol>'); | ||||
|     esx = $('<li><input type="radio" name="rsrcHw" value="esx" checked/>ESX</li>'); | ||||
|     kvm = $('<li><input type="radio" name="rsrcHw" value="kvm"/>KVM</li>'); | ||||
|     zvm = $('<li><input type="radio" name="rsrcHw" value="zvm"/>z\/VM</li>'); | ||||
|     ipmi = $('<li><input type="radio" name="rsrcHw" value="ipmi"/>iDataPlex</li>'); | ||||
|     blade = $('<li><input type="radio" name="rsrcHw" value="blade"/>BladeCenter</li>'); | ||||
|     hmc = $('<li><input type="radio" name="rsrcHw" value="hmc"/>System p</li>'); | ||||
|      | ||||
|     esx = $('<li><input type="radio" name="rsrcHw" value="esx" disabled/>ESX</li>'); | ||||
|     kvm = $('<li><input type="radio" name="rsrcHw" value="kvm" disabled/>KVM</li>'); | ||||
|     zvm = $('<li><input type="radio" name="rsrcHw" value="zvm" checked/>z\/VM</li>'); | ||||
|     ipmi = $('<li><input type="radio" name="rsrcHw" value="ipmi" disabled/>iDataPlex</li>'); | ||||
|     blade = $('<li><input type="radio" name="rsrcHw" value="blade" disabled/>BladeCenter</li>'); | ||||
|     hmc = $('<li><input type="radio" name="rsrcHw" value="hmc" disabled/>System p</li>'); | ||||
|  | ||||
|     rsrcHwList.append(esx); | ||||
|     rsrcHwList.append(kvm); | ||||
|     rsrcHwList.append(zvm); | ||||
|     rsrcHwList.append(blade); | ||||
|     rsrcHwList.append(ipmi); | ||||
|     rsrcHwList.append(hmc); | ||||
|      | ||||
|  | ||||
|     resrcPg.append(rsrcHwList); | ||||
|  | ||||
|     var okBtn = createButton('Ok'); | ||||
| @@ -212,7 +212,7 @@ function loadProvisionPage() { | ||||
|                     displayName = "z\/VM"; | ||||
|                     break; | ||||
|             } | ||||
|              | ||||
|  | ||||
|             // Add resource tab and load resources | ||||
|             tab.add(newTabId, displayName, loader, true); | ||||
|             plugin.loadResources(); | ||||
| @@ -221,8 +221,8 @@ function loadProvisionPage() { | ||||
|         // Select tab | ||||
|         tab.select(newTabId); | ||||
|     }); | ||||
|      | ||||
|     resrcPg.append(okBtn);     | ||||
|  | ||||
|     resrcPg.append(okBtn); | ||||
|  | ||||
|     // Add provision tab | ||||
|     tab.add('provisionTab', 'Provision', provPg, false); | ||||
| @@ -230,21 +230,21 @@ function loadProvisionPage() { | ||||
|     tab.add('imagesTab', 'Images', '', false); | ||||
|     // Add resource tab | ||||
|     tab.add('resourceTab', 'Resources', resrcPg, false); | ||||
|      | ||||
|  | ||||
|     // Load tabs onselect | ||||
|     $('#provisionPageTabs').bind('tabsselect', function(event, ui){  | ||||
|         // Load image page  | ||||
|     $('#provisionPageTabs').bind('tabsselect', function(event, ui){ | ||||
|         // Load image page | ||||
|         if (!$('#imagesTab').children().length && ui.index == 1) { | ||||
|             $('#imagesTab').append($('<center></center>').append(createLoader(''))); | ||||
|             loadImagesPage(); | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Open the quick provision tab | ||||
|     if (window.location.search) { | ||||
|         tab.add('quickProvisionTab', 'Quick Provision', '', true); | ||||
|         tab.select('quickProvisionTab'); | ||||
|          | ||||
|  | ||||
|         var provForm = $('<div class="form"></div>'); | ||||
|         $('#quickProvisionTab').append(provForm); | ||||
|         appendProvisionSection('quick', provForm); | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										208
									
								
								xCAT-UI/js/ui.js
									
									
									
									
									
								
							
							
						
						
									
										208
									
								
								xCAT-UI/js/ui.js
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /** | ||||
|  * Tab constructor | ||||
|  *  | ||||
|  * | ||||
|  * @param tabId Tab ID | ||||
|  * @param tabName Tab name | ||||
|  */ | ||||
| @@ -12,7 +12,7 @@ var Tab = function(tabId) { | ||||
|  | ||||
| /** | ||||
|  * Initialize the tab | ||||
|  *  | ||||
|  * | ||||
|  * @param tabName Tab name to initialize | ||||
|  */ | ||||
| Tab.prototype.init = function() { | ||||
| @@ -32,14 +32,14 @@ Tab.prototype.init = function() { | ||||
|         if ($.cookie('tabindex_history')) { | ||||
|             order = $.cookie('tabindex_history').split(','); | ||||
|             order[1] = order[0];    // Set index 1 to last selected tab | ||||
|             order[0] = ui.index;    // Set index 0 to currently selected tab         | ||||
|             order[0] = ui.index;    // Set index 0 to currently selected tab | ||||
|         } else { | ||||
|             // Create an array to track the tab selected | ||||
|             order = new Array; | ||||
|             order[0] = ui.index; | ||||
|             order[1] = ui.index; | ||||
|         } | ||||
|          | ||||
|  | ||||
|         $.cookie('tabindex_history', order); | ||||
|     }); | ||||
|  | ||||
| @@ -52,7 +52,7 @@ Tab.prototype.init = function() { | ||||
|  | ||||
| /** | ||||
|  * Return the tab object | ||||
|  *  | ||||
|  * | ||||
|  * @return Object representing the tab | ||||
|  */ | ||||
| Tab.prototype.object = function() { | ||||
| @@ -61,7 +61,7 @@ Tab.prototype.object = function() { | ||||
|  | ||||
| /** | ||||
|  * Add a new tab | ||||
|  *  | ||||
|  * | ||||
|  * @param tabId Tab ID | ||||
|  * @param tabName Tab name | ||||
|  * @param tabCont Tab content | ||||
| @@ -77,21 +77,21 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) { | ||||
|     newTab.append(tabCont); | ||||
|     this.tab.append(newTab); | ||||
|     this.tab.tabs("add", "#" + tabId, tabName); | ||||
|      | ||||
|  | ||||
|     // Append close button | ||||
|     if (closeable) { | ||||
|         var header = this.tab.find('ul.ui-tabs-nav a[href="#' + tabId +'"]').parent(); | ||||
|         header.append('<span class=\"tab-close ui-icon ui-icon-close\"></span>'); | ||||
|      | ||||
|  | ||||
|         // Get this tab | ||||
|         var tabs = this.tab; | ||||
|         var tabLink = 'a[href="\#' + tabId + '"]';     | ||||
|         var tabLink = 'a[href="\#' + tabId + '"]'; | ||||
|         var thisTab = $(tabLink, tabs).parent(); | ||||
|                          | ||||
|  | ||||
|         // Close tab when close button is clicked | ||||
|         thisTab.find('span.tab-close').bind('click', function(event) { | ||||
|             var tabIndex = ($('li', tabs).index(thisTab)); | ||||
|              | ||||
|  | ||||
|             // Do not remove first tab | ||||
|             if (tabIndex != 0) { | ||||
|                 // Go back to last tab if user is trying to close currently selected tab | ||||
| @@ -102,9 +102,9 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) { | ||||
|                         tabs.tabs('select', parseInt(order[1])); | ||||
|                     } else { | ||||
|                         tabs.tabs('select', 0); | ||||
|                     }     | ||||
|                 }                             | ||||
|                  | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 tabs.tabs('remove', tabIndex); | ||||
|             } | ||||
|         }); | ||||
| @@ -113,7 +113,7 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) { | ||||
|  | ||||
| /** | ||||
|  * Select a tab | ||||
|  *  | ||||
|  * | ||||
|  * @param id Tab ID to select | ||||
|  */ | ||||
| Tab.prototype.select = function(id) { | ||||
| @@ -122,11 +122,11 @@ Tab.prototype.select = function(id) { | ||||
|  | ||||
| /** | ||||
|  * Remove a tab | ||||
|  *  | ||||
|  * | ||||
|  * @param id Tab ID to remove | ||||
|  */ | ||||
| Tab.prototype.remove = function(id) { | ||||
|     var selectorStr = 'a[href="\#' + id + '"]';     | ||||
|     var selectorStr = 'a[href="\#' + id + '"]'; | ||||
|     var selectTab = $(selectorStr, this.tab).parent(); | ||||
|     var index = ($('li', this.tab).index(selectTab)); | ||||
|     this.tab.tabs("remove", index); | ||||
| @@ -134,7 +134,7 @@ Tab.prototype.remove = function(id) { | ||||
|  | ||||
| /** | ||||
|  * Table constructor | ||||
|  *  | ||||
|  * | ||||
|  * @param tabId Tab ID | ||||
|  * @param tabName Tab name | ||||
|  */ | ||||
| @@ -150,7 +150,7 @@ var Table = function(tableId) { | ||||
|  | ||||
| /** | ||||
|  * Initialize the table | ||||
|  *  | ||||
|  * | ||||
|  * @param Headers Array of table headers | ||||
|  */ | ||||
| Table.prototype.init = function(headers) { | ||||
| @@ -174,7 +174,7 @@ Table.prototype.init = function(headers) { | ||||
|  | ||||
| /** | ||||
|  * Return the table object | ||||
|  *  | ||||
|  * | ||||
|  * @return Object representing the table | ||||
|  */ | ||||
| Table.prototype.object = function() { | ||||
| @@ -183,7 +183,7 @@ Table.prototype.object = function() { | ||||
|  | ||||
| /** | ||||
|  * Add a row to the table | ||||
|  *  | ||||
|  * | ||||
|  * @param rowCont Array of table row contents | ||||
|  */ | ||||
| Table.prototype.add = function(rowCont) { | ||||
| @@ -204,7 +204,7 @@ Table.prototype.add = function(rowCont) { | ||||
|  | ||||
| /** | ||||
|  * Add a footer to the table | ||||
|  *  | ||||
|  * | ||||
|  * @param rowCont Array of table row contents | ||||
|  */ | ||||
| Table.prototype.addFooter = function(rowCont) { | ||||
| @@ -225,7 +225,7 @@ Table.prototype.remove = function(id) { | ||||
|  | ||||
| /** | ||||
|  * Datatable class constructor | ||||
|  *  | ||||
|  * | ||||
|  * @param tabId Tab ID | ||||
|  * @param tabName Tab name | ||||
|  */ | ||||
| @@ -236,7 +236,7 @@ var DataTable = function(tableId) { | ||||
|  | ||||
| /** | ||||
|  * Initialize the datatable | ||||
|  *  | ||||
|  * | ||||
|  * @param Headers Array of table headers | ||||
|  */ | ||||
| DataTable.prototype.init = function(headers) { | ||||
| @@ -260,7 +260,7 @@ DataTable.prototype.init = function(headers) { | ||||
|  | ||||
| /** | ||||
|  * Return the datatable object | ||||
|  *  | ||||
|  * | ||||
|  * @return Object representing the table | ||||
|  */ | ||||
| DataTable.prototype.object = function() { | ||||
| @@ -269,7 +269,7 @@ DataTable.prototype.object = function() { | ||||
|  | ||||
| /** | ||||
|  * Add a row to the datatable | ||||
|  *  | ||||
|  * | ||||
|  * @param rowCont Array of table row contents | ||||
|  */ | ||||
| DataTable.prototype.add = function(rowCont) { | ||||
| @@ -290,7 +290,7 @@ DataTable.prototype.add = function(rowCont) { | ||||
|  | ||||
| /** | ||||
|  * Create status bar | ||||
|  *  | ||||
|  * | ||||
|  * @param barId Status bar ID | ||||
|  */ | ||||
| function createStatusBar(barId) { | ||||
| @@ -302,21 +302,21 @@ function createStatusBar(barId) { | ||||
|     	'max-height': '150px', | ||||
|     	'overflow': 'auto' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Create info icon | ||||
|     var icon = $('<span class="ui-icon ui-icon-circle-check"></span>').css({ | ||||
|         'display': 'inline-block', | ||||
|         'margin': '10px 5px', | ||||
|         'vertical-align': 'top' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Create message section | ||||
|     var msg = $('<div></div>').css({ | ||||
|         'display': 'inline-block', | ||||
|         'margin': '10px 0px', | ||||
|         'width': '90%' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Create hide button | ||||
|     var hide = $('<span class="ui-icon ui-icon-minus"></span>').css({ | ||||
|         'display': 'inline-block', | ||||
| @@ -326,7 +326,7 @@ function createStatusBar(barId) { | ||||
|         // Remove info box on-click | ||||
|         $(this).parent().hide(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     statusBar.append(icon); | ||||
|     statusBar.append(msg); | ||||
|     statusBar.append(hide); | ||||
| @@ -335,7 +335,7 @@ function createStatusBar(barId) { | ||||
|  | ||||
| /** | ||||
|  * Create info bar | ||||
|  *  | ||||
|  * | ||||
|  * @param msg Info message | ||||
|  * @return Info bar | ||||
|  */ | ||||
| @@ -353,7 +353,7 @@ function createInfoBar(msg) { | ||||
|         'display': 'inline-block', | ||||
|         'width': '90%' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     infoBar.append(icon); | ||||
|     infoBar.append(barMsg); | ||||
|     return infoBar; | ||||
| @@ -361,7 +361,7 @@ function createInfoBar(msg) { | ||||
|  | ||||
| /** | ||||
|  * Create warning bar | ||||
|  *  | ||||
|  * | ||||
|  * @param msg Warning message | ||||
|  * @return Warning bar | ||||
|  */ | ||||
| @@ -375,7 +375,7 @@ function createWarnBar(msg) { | ||||
|         'display': 'inline-block', | ||||
|         'width': '90%' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     warnBar.append(icon); | ||||
|     warnBar.append(barMsg); | ||||
|     return warnBar; | ||||
| @@ -383,7 +383,7 @@ function createWarnBar(msg) { | ||||
|  | ||||
| /** | ||||
|  * Create a loader | ||||
|  *  | ||||
|  * | ||||
|  * @param loaderId Loader ID | ||||
|  */ | ||||
| function createLoader(loaderId) { | ||||
| @@ -393,7 +393,7 @@ function createLoader(loaderId) { | ||||
|  | ||||
| /** | ||||
|  * Create a button | ||||
|  *  | ||||
|  * | ||||
|  * @param name Name of the button | ||||
|  */ | ||||
| function createButton(name) { | ||||
| @@ -403,7 +403,7 @@ function createButton(name) { | ||||
|  | ||||
| /** | ||||
|  * Create a menu | ||||
|  *  | ||||
|  * | ||||
|  * @param items An array of items to go into the menu | ||||
|  * @return A division containing the menu | ||||
|  */ | ||||
| @@ -424,17 +424,17 @@ function createMenu(items) { | ||||
|         } else { | ||||
|             item.append(items[i]); | ||||
|         } | ||||
|                  | ||||
|  | ||||
|         menu.append(item); | ||||
|     } | ||||
|      | ||||
|  | ||||
|     return menu; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Initialize the page | ||||
|  */ | ||||
| function initPage() {     | ||||
| function initPage() { | ||||
|     // Load theme | ||||
|     var theme = $.cookie('xcat_theme'); | ||||
|     if (theme) { | ||||
| @@ -459,7 +459,7 @@ function initPage() { | ||||
|                 break; | ||||
|             default: | ||||
|                 includeCss("css/themes/jquery-ui-start.css"); | ||||
|         }                 | ||||
|         } | ||||
|     } else { | ||||
|         includeCss("css/themes/jquery-ui-start.css"); | ||||
|     } | ||||
| @@ -469,10 +469,10 @@ function initPage() { | ||||
|     includeCss("css/superfish.css"); | ||||
|     // includeCss("css/jstree.css"); | ||||
|     includeCss("css/jquery.jqplot.css"); | ||||
|      | ||||
|  | ||||
|     // Load custom stylesheet | ||||
|     includeCss("css/style.css"); | ||||
|      | ||||
|  | ||||
|     // JQuery plugins | ||||
|     includeJs("js/jquery/jquery.dataTables.min.js"); | ||||
|     includeJs("js/jquery/jquery.form.min.js"); | ||||
| @@ -490,13 +490,13 @@ function initPage() { | ||||
|     includeJs("js/jquery/jqplot.categoryAxisRenderer.min.js"); | ||||
|     includeJs("js/jquery/jqplot.dateAxisRenderer.min.js"); | ||||
|     includeJs("js/jquery/jquery.topzindex.min.js"); | ||||
|      | ||||
|  | ||||
|     // Page plugins | ||||
|     includeJs("js/configure/configure.js");     | ||||
|     includeJs("js/configure/configure.js"); | ||||
|     includeJs("js/monitor/monitor.js"); | ||||
|     includeJs("js/nodes/nodes.js"); | ||||
|     includeJs("js/provision/provision.js"); | ||||
|      | ||||
|  | ||||
|     // Custom plugins | ||||
|     includeJs("js/custom/esx.js"); | ||||
|     includeJs("js/custom/kvm.js"); | ||||
| @@ -506,11 +506,11 @@ function initPage() { | ||||
|     includeJs("js/custom/hmc.js"); | ||||
|     includeJs("js/custom/customUtils.js"); | ||||
|  | ||||
|     // Enable settings link      | ||||
|     // Enable settings link | ||||
|     $('#xcat_settings').click(function() { | ||||
|         openSettings(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Set header to theme | ||||
|     var background = '', color = ''; | ||||
|     var theme = $.cookie('xcat_theme'); | ||||
| @@ -539,17 +539,17 @@ function initPage() { | ||||
|                 break; | ||||
|             default: | ||||
|                 background = '#6EAC2C'; | ||||
|         }                 | ||||
|         } | ||||
|     } else { | ||||
|         background = '#6EAC2C'; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     $('#header').addClass('ui-state-default'); | ||||
|     $('#header').css('border', '0px'); | ||||
|      | ||||
|  | ||||
|     // Set theme to user span | ||||
|     $('#login_user').css('color', color); | ||||
|      | ||||
|  | ||||
|     // Style for selected page | ||||
|     var style = { | ||||
|         'background-color': background, | ||||
| @@ -560,26 +560,20 @@ function initPage() { | ||||
|     var url = window.location.pathname; | ||||
|     var page = url.replace('/xcat/', ''); | ||||
|     var headers = $('#header ul li a'); | ||||
|          | ||||
|  | ||||
|     // Show the page | ||||
|     $("#content").children().remove(); | ||||
|     if (page == 'configure.php') { | ||||
|         includeJs("js/configure/update.js"); | ||||
|         includeJs("js/configure/discover.js"); | ||||
|         includeJs("js/configure/service.js"); | ||||
|         includeJs("js/configure/users.js"); | ||||
|         includeJs("js/configure/files.js"); | ||||
|         headers.eq(1).css(style); | ||||
|         loadConfigPage(); | ||||
|     } else if (page == 'provision.php') { | ||||
|         includeJs("js/provision/images.js"); | ||||
|         headers.eq(2).css(style); | ||||
|         loadProvisionPage(); | ||||
|     } else if (page == 'monitor.php') { | ||||
|         includeJs("js/monitor/xcatmon.js"); | ||||
|         includeJs("js/monitor/rmcmon.js"); | ||||
|         includeJs("js/monitor/gangliamon.js"); | ||||
|         headers.eq(3).css(style); | ||||
|         loadMonitorPage(); | ||||
|     } else if (page == 'help.php') { | ||||
|         includeJs("js/help/help.js"); | ||||
|         headers.eq(4).css(style); | ||||
| @@ -589,8 +583,6 @@ function initPage() { | ||||
|         includeJs("js/nodes/nodeset.js"); | ||||
|         includeJs("js/nodes/rnetboot.js"); | ||||
|         includeJs("js/nodes/updatenode.js"); | ||||
|         includeJs("js/nodes/physical.js"); | ||||
|         includeJs("js/nodes/mtm.js"); | ||||
|         includeJs("js/nodes/rscan.js"); | ||||
|         headers.eq(0).css(style); | ||||
|         loadNodesPage(); | ||||
| @@ -599,7 +591,7 @@ function initPage() { | ||||
|  | ||||
| /** | ||||
|  * Include javascript file in <head> | ||||
|  *  | ||||
|  * | ||||
|  * @param file File to include | ||||
|  */ | ||||
| function includeJs(file) { | ||||
| @@ -620,7 +612,7 @@ function includeJs(file) { | ||||
|  | ||||
| /** | ||||
|  * Include CSS link in <head> | ||||
|  *  | ||||
|  * | ||||
|  * @param file File to include | ||||
|  */ | ||||
| function includeCss(file) { | ||||
| @@ -642,7 +634,7 @@ function includeCss(file) { | ||||
|  | ||||
| /** | ||||
|  * Write ajax response to a paragraph | ||||
|  *  | ||||
|  * | ||||
|  * @param rsp Ajax response | ||||
|  * @param pattern Pattern to replace with a break | ||||
|  * @return Paragraph containing ajax response | ||||
| @@ -650,7 +642,7 @@ function includeCss(file) { | ||||
| function writeRsp(rsp, pattern) { | ||||
|     // Create paragraph to hold ajax response | ||||
|     var prg = $('<pre></pre>'); | ||||
|      | ||||
|  | ||||
|     for ( var i in rsp) { | ||||
|         if (rsp[i]) { | ||||
|             // Create regular expression for given pattern | ||||
| @@ -661,7 +653,7 @@ function writeRsp(rsp, pattern) { | ||||
|             } else { | ||||
|                 prg.append(rsp[i]); | ||||
|                 prg.append('<br/>'); | ||||
|             }             | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -670,7 +662,7 @@ function writeRsp(rsp, pattern) { | ||||
|  | ||||
| /** | ||||
|  * Open a dialog and show given message | ||||
|  *  | ||||
|  * | ||||
|  * @param type Type of dialog, i.e. warn or info | ||||
|  * @param msg Message to show | ||||
|  */ | ||||
| @@ -678,7 +670,7 @@ function openDialog(type, msg) { | ||||
|     var msgDialog = $('<div></div>'); | ||||
|     var title = ""; | ||||
|     if (type == "warn") { | ||||
|         // Create warning message  | ||||
|         // Create warning message | ||||
|     	msgDialog.append(createWarnBar(msg)); | ||||
|     	title = "Warning"; | ||||
|     } else { | ||||
| @@ -686,7 +678,7 @@ function openDialog(type, msg) { | ||||
|     	msgDialog.append(createInfoBar(msg)); | ||||
|     	title = "Info"; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     // Open dialog | ||||
|     msgDialog.dialog({ | ||||
|     	title: title, | ||||
| @@ -696,7 +688,7 @@ function openDialog(type, msg) { | ||||
|         }, | ||||
|         width: 500, | ||||
|         buttons: { | ||||
|             "Ok": function(){  | ||||
|             "Ok": function(){ | ||||
|                 $(this).dialog("close"); | ||||
|             } | ||||
|         } | ||||
| @@ -705,7 +697,7 @@ function openDialog(type, msg) { | ||||
|  | ||||
| /** | ||||
|  * Create an iframe to hold the output of an xCAT command | ||||
|  *  | ||||
|  * | ||||
|  * @param src The URL of the document to show in the iframe | ||||
|  * @return Info box containing the iframe | ||||
|  */ | ||||
| @@ -714,7 +706,7 @@ function createIFrame(src) { | ||||
|     var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>').css({ | ||||
|         'margin-bottom': '5px' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Create info and close icons | ||||
|     var icon = $('<span class="ui-icon ui-icon-info"></span>').css({ | ||||
|         'display': 'inline-block', | ||||
| @@ -728,28 +720,28 @@ function createIFrame(src) { | ||||
|         // Remove info box on-click | ||||
|         $(this).parent().remove(); | ||||
|     }); | ||||
|          | ||||
|  | ||||
|     var iframe = $('<iframe></iframe>').attr('src', src).css({ | ||||
|         'display': 'block', | ||||
|         'border': '0px', | ||||
|         'margin': '10px', | ||||
|         'width': '100%' | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     var loader = createLoader('iLoader').css({ | ||||
|         'display': 'block', | ||||
|         'margin': '10px 0px' | ||||
|     }); | ||||
|          | ||||
|  | ||||
|     infoBar.append(icon); | ||||
|     infoBar.append($('<div style="display: inline-block; width: 90%;"></div>').append(loader, iframe)); | ||||
|     infoBar.append(close); | ||||
|      | ||||
|  | ||||
|     // Remove loader when done | ||||
|     iframe.load(function() { | ||||
|         loader.remove(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     return infoBar; | ||||
| } | ||||
|  | ||||
| @@ -762,19 +754,19 @@ function openSettings() { | ||||
|     var dialog = $('<div class="form"></div>'); | ||||
|     var info = createInfoBar('Select from the following options'); | ||||
|     dialog.append(info); | ||||
|      | ||||
|  | ||||
|     var style = { | ||||
|         'color': 'blue', | ||||
|         'cursor': 'pointer', | ||||
|         'padding': '5px' | ||||
|     }; | ||||
|      | ||||
|  | ||||
|     var changeThemeOption = $('<div><center><a style="color: blue;">Change xCAT theme</a></center></div>').css(style); | ||||
|     dialog.append(changeThemeOption); | ||||
|      | ||||
|  | ||||
|     var changePasswordOption = $('<div><center><a style="color: blue;">Change password</a></center></div>').css(style); | ||||
|     dialog.append(changePasswordOption); | ||||
|      | ||||
|  | ||||
|     // Open form as a dialog | ||||
|     dialog.dialog({ | ||||
|         modal: true, | ||||
| @@ -789,13 +781,13 @@ function openSettings() { | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     // Bind to click event | ||||
|     changeThemeOption.click(function() { | ||||
|         dialog.dialog("close"); | ||||
|         changeTheme(); | ||||
|     }); | ||||
|      | ||||
|  | ||||
|     changePasswordOption.click(function() { | ||||
|         dialog.dialog("close"); | ||||
|         changePassword(); | ||||
| @@ -810,7 +802,7 @@ function changeTheme() { | ||||
|     var dialog = $('<div class="form"></div>'); | ||||
|     var info = createInfoBar('Select the xCAT theme you desire'); | ||||
|     dialog.append(info); | ||||
|      | ||||
|  | ||||
|     // Create select drop down for themes | ||||
|     var oList = $('<ol></ol>'); | ||||
|     oList.append($('<li><input type="radio" name="theme" value="cupertino">Cupertino</li>')); | ||||
| @@ -820,7 +812,7 @@ function changeTheme() { | ||||
|     oList.append($('<li><input type="radio" name="theme" value="sunny">Sunny</li>')); | ||||
|     oList.append($('<li><input type="radio" name="theme" value="ui_dark">UI Darkness</li>')); | ||||
|     dialog.append(oList); | ||||
|      | ||||
|  | ||||
|     if ($.cookie('xcat_theme')) { | ||||
|         // Select theme | ||||
|         oList.find('input[value="' + $.cookie('xcat_theme') + '"]').attr('checked', true); | ||||
| @@ -841,12 +833,12 @@ function changeTheme() { | ||||
|                 // Save selected theme | ||||
|                 var theme = $(this).find('input[name="theme"]:checked').val(); | ||||
|                 $.cookie('xcat_theme', theme);    // Do not expire cookie, keep it as long as possible | ||||
|                  | ||||
|  | ||||
|                 // Show instructions to apply theme | ||||
|                 $(this).empty(); | ||||
|                 var info = createInfoBar('You will need to reload this page in order for changes to take effect'); | ||||
|                 $(this).append(info); | ||||
|                  | ||||
|  | ||||
|                 // Only show close button | ||||
|                 $(this).dialog("option", "buttons", { | ||||
|                     "Close" : function() { | ||||
| @@ -869,10 +861,10 @@ function changePassword() { | ||||
|     var dialog = $('<div id="changePassword" class="form"></div>'); | ||||
|     var info = createInfoBar('Change your password'); | ||||
|     dialog.append(info); | ||||
|      | ||||
|  | ||||
|     dialog.append('<div><label>New password:</label><input type="password" name="newPassword"/></div>'); | ||||
|     dialog.append('<div><label>Confirm password:</label><input type="password" name="confirmPassword"/></div>'); | ||||
|      | ||||
|  | ||||
|     // Open form as a dialog | ||||
|     dialog.dialog({ | ||||
|         modal: true, | ||||
| @@ -885,22 +877,22 @@ function changePassword() { | ||||
|             "Ok": function(){ | ||||
|                 // Remove any warning messages | ||||
|                 $(this).find('.ui-state-error').remove(); | ||||
|                  | ||||
|  | ||||
|                 var errorMessage = ""; | ||||
|                  | ||||
|  | ||||
|                 // Check each input is provided | ||||
|                 $('#changePassword input').each(function() { | ||||
|                     if (!$(this).val()) { | ||||
|                         errorMessage = "Please provide a value for each missing input!"; | ||||
|                     } | ||||
|                 }); | ||||
|                  | ||||
|  | ||||
|                 // Do not continue if error found | ||||
|                 if (errorMessage) { | ||||
|                     dialog.prepend(createWarnBar(errorMessage)); | ||||
|                     return; | ||||
|                 } | ||||
|                  | ||||
|  | ||||
|                 // Check new and confirm passwords match | ||||
|                 var user = $.cookie('xcat_username'); | ||||
|                 var newPassword = $('#changePassword input[name="newPassword"]').val(); | ||||
| @@ -909,14 +901,14 @@ function changePassword() { | ||||
|                     dialog.prepend(createWarnBar("Please confirm new password!")); | ||||
|                     return; | ||||
|                 } | ||||
|                  | ||||
|  | ||||
|                 // Change dialog buttons | ||||
|                 $('#changePassword').dialog('option', 'buttons', { | ||||
|                     'Close':function(){ | ||||
|                         $('#changePassword').dialog('destroy').remove(); | ||||
|                     } | ||||
|                 }); | ||||
|                  | ||||
|  | ||||
|                 // Send request to change password | ||||
|                 var url = window.location.pathname; | ||||
|                 var page = url.replace('/xcat/', ''); | ||||
| @@ -933,13 +925,13 @@ function changePassword() { | ||||
|                         args : 'passwd;' + user + ';' + newPassword, | ||||
|                         msg : '' | ||||
|                     }, | ||||
|                      | ||||
|  | ||||
|                     success : function (data) { | ||||
|                         // Show response message | ||||
|                         var rspMessage = ""; | ||||
|                         for (var i in data.rsp) | ||||
|                             rspMessage += data.rsp[i] + "<br/>"; | ||||
|                          | ||||
|  | ||||
|                          $('#changePassword').prepend(createInfoBar(rspMessage)); | ||||
|                     } | ||||
|                 }); | ||||
| @@ -953,7 +945,7 @@ function changePassword() { | ||||
|  | ||||
| /** | ||||
|  * Adjust datatable column size | ||||
|  *  | ||||
|  * | ||||
|  * @param tableId Table ID | ||||
|  */ | ||||
| function adjustColumnSize(tableId) { | ||||
| @@ -963,7 +955,7 @@ function adjustColumnSize(tableId) { | ||||
|  | ||||
| /** | ||||
|  * Set menu theme | ||||
|  *  | ||||
|  * | ||||
|  * @param menu Menu object | ||||
|  */ | ||||
| function setMenu2Theme(menu) { | ||||
| @@ -995,18 +987,18 @@ function setMenu2Theme(menu) { | ||||
|                 break; | ||||
|             default: | ||||
|                 background = '#6EAC2C'; | ||||
|         }                 | ||||
|         } | ||||
|     } else { | ||||
|         background = '#6EAC2C'; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     menu.css('background', background); | ||||
|     menu.find('a:eq(0)').css('color', color); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Set menu back to normal before applying theme | ||||
|  *  | ||||
|  * | ||||
|  * @param menu Menu object | ||||
|  */ | ||||
| function setMenu2Normal(menu) { | ||||
| @@ -1017,7 +1009,7 @@ function setMenu2Normal(menu) { | ||||
|  | ||||
| /** | ||||
|  * Get nodes that are checked in a given datatable | ||||
|  *  | ||||
|  * | ||||
|  * @param datatableId The datatable ID | ||||
|  * @return Nodes that were checked | ||||
|  */ | ||||
| @@ -1028,10 +1020,10 @@ function getNodesChecked(datatableId) { | ||||
|     var nodes = $('#' + datatableId + ' input[type=checkbox]:checked'); | ||||
|     for (var i in nodes) { | ||||
|         var tgtNode = nodes.eq(i).attr('name'); | ||||
|          | ||||
|  | ||||
|         if (tgtNode) { | ||||
|             tgts += tgtNode; | ||||
|              | ||||
|  | ||||
|             // Add a comma at the end | ||||
|             if (i < nodes.length - 1) { | ||||
|                 tgts += ','; | ||||
| @@ -1044,7 +1036,7 @@ function getNodesChecked(datatableId) { | ||||
|  | ||||
| /** | ||||
|  * Check if return message contains errors | ||||
|  *  | ||||
|  * | ||||
|  * @param msg  Return message | ||||
|  * @return 0  If return message contains no errors | ||||
|  *        -1  If return message contains errors | ||||
|   | ||||
| @@ -81,7 +81,7 @@ function submit_request($req, $skipVerify, $opts_array){ | ||||
|  | ||||
|     // Open syslog, include the process ID and also send the log to standard error, | ||||
|     // and use a user defined logging mechanism | ||||
|     openlog("xcat", LOG_PID | LOG_PERROR, LOG_LOCAL0); | ||||
|     openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0); | ||||
|  | ||||
|     // Open a socket to xcatd | ||||
|     syslog(LOG_INFO, "Opening socket to xcatd..."); | ||||
|   | ||||
| @@ -79,7 +79,7 @@ function submit_request($req, $skipVerify, $opts_array){ | ||||
|     // Open syslog, include the process ID and also send | ||||
|     // the log to standard error, and use a user defined | ||||
|     // logging mechanism | ||||
|     openlog("xcat", LOG_PID | LOG_PERROR, LOG_LOCAL0); | ||||
|     openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0); | ||||
|  | ||||
|     // Open a socket to xcatd | ||||
|     syslog(LOG_INFO, "Opening socket to xcatd..."); | ||||
|   | ||||
| @@ -25,7 +25,6 @@ function loadPage() { | ||||
|                 <li><a href="index.php" class="top_link">Nodes</a></li>         | ||||
|                 <li><a href="configure.php" class="top_link">Configure</a></li> | ||||
|                 <li><a href="provision.php" class="top_link">Provision</a></li> | ||||
|                 <li><a href="monitor.php" class="top_link">Monitor</a></li> | ||||
|                 <li><a href="help.php" class="top_link">Help</a></li> | ||||
|             </ul>'; | ||||
|              | ||||
|   | ||||
| @@ -19,6 +19,12 @@ Requires: xCAT-UI-deps >= 2.6 | ||||
| Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}} | ||||
| Prefix: /opt/xcat | ||||
|  | ||||
| %define s390x %(if [ "$s390x" = "1" ];then echo 1; else echo 0; fi) | ||||
| %define nots390x %(if [ "$s390x" = "1" ];then echo 0; else echo 1; fi) | ||||
|  | ||||
| # Define a different location for various httpd configs in s390x mode | ||||
| %define httpconfigdir %(if [ "$s390x" = "1" ];then echo "xcathttpdsave"; else echo "xcat"; fi) | ||||
|  | ||||
| %ifos linux | ||||
| # httpd is provided as apache2 on SLES and httpd on RHEL | ||||
| Requires: httpd | ||||
| @@ -35,39 +41,24 @@ Provides a browser-based interface for xCAT (Extreme Cloud Administration Toolki | ||||
| # Minify Javascript files using Google Compiler | ||||
| echo "Minifying Javascripts... This will take a couple of minutes." | ||||
|  | ||||
| COMPILER_JAR='/xcat2/build/tools/compiler.jar' | ||||
| #COMPILER_JAR='/xcat2/build/tools/compiler.jar' | ||||
| COMPILER_JAR='/root/scripts/compiler.jar' | ||||
| UI_JS="js/" | ||||
|  | ||||
| %ifos linux | ||||
| JAVA='/opt/ibm/java-ppc64-60/jre/bin/java' | ||||
| JAVA='/usr/bin/java' | ||||
| # Find all Javascript files | ||||
| declare -a FILES | ||||
| FILES=`find ${UI_JS} -name '*.js'` | ||||
| for i in ${FILES[*]}; do | ||||
| 	# Ignore Javascripts that are already minified | ||||
| 	if [[ ! $i =~ '.*\.min\.js$' ]]; then | ||||
| 		echo "  Minifying $i ..." | ||||
| 		`${JAVA} -jar ${COMPILER_JAR} --warning_level=QUIET --js=$i --js_output_file=$i.min` | ||||
| 		 | ||||
| 		# Remove old Javascript and replace it with minified version | ||||
| 		rm -rf $i | ||||
| 		mv $i.min $i | ||||
|     fi | ||||
| done | ||||
|     # Ignore Javascripts that are already minified | ||||
|     if [[ ! $i =~ '.*\.min\.js$' ]]; then | ||||
|         echo "  Minifying $i ..." | ||||
|         `${JAVA} -jar ${COMPILER_JAR} --warning_level=QUIET --js=$i --js_output_file=$i.min` | ||||
|  | ||||
| %else  # AIX | ||||
| JAVA='/usr/java6_64/bin/java' | ||||
| # Find all Javascript files | ||||
| FILES=`find ${UI_JS} -name '*.js'` | ||||
| for i in ${FILES[*]}; do | ||||
| 	# Ignore Javascripts that are already minified | ||||
| 	if [[ ! $i = @(*.min.js) ]]; then | ||||
| 		echo "  Minifying $i ..." | ||||
| 		`${JAVA} -jar ${COMPILER_JAR} --warning_level=QUIET --js=$i --js_output_file=$i.min` | ||||
| 		 | ||||
| 		# Remove old Javascript and replace it with minified version | ||||
| 		rm -rf $i | ||||
| 		mv $i.min $i | ||||
|         # Remove old Javascript and replace it with minified version | ||||
|         rm -rf $i | ||||
|         mv $i.min $i | ||||
|     fi | ||||
| done | ||||
| %endif | ||||
| @@ -81,6 +72,12 @@ rm -rf $RPM_BUILD_ROOT | ||||
| mkdir -p $RPM_BUILD_ROOT%{prefix}/ui | ||||
| cp -r * $RPM_BUILD_ROOT%{prefix}/ui | ||||
| chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/* | ||||
| mkdir -p $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig | ||||
| mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d | ||||
| mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d | ||||
| mkdir -p $RPM_BUILD_ROOT%{prefix}/etc/%httpconfigdir/conf.orig | ||||
| #mkdir -p $RPM_BUILD_ROOT%{prefix}/etc/apache2/conf.d | ||||
| #mkdir -p $RPM_BUILD_ROOT%{prefix}/etc/httpd/conf.d | ||||
|  | ||||
| # Copy over xCAT UI plugins | ||||
| mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin | ||||
| @@ -88,11 +85,24 @@ cp xcat/plugins/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin | ||||
| chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/web.pm | ||||
| chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/webportal.pm | ||||
|  | ||||
| #Copy the different conf files for httpd | ||||
| cp etc/apache2/conf.d/xcat-ui.conf.apach22 $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach22 | ||||
| cp etc/apache2/conf.d/xcat-ui.conf.apach24 $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 | ||||
|  | ||||
| #install lower version(<2.4) apache/httpd conf files by default | ||||
| cp $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach22 $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ui.conf | ||||
| cp $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach22 $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ui.conf | ||||
|  | ||||
| # Create symbolic link to webportal command | ||||
| mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin | ||||
| ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal | ||||
| mkdir -p $RPM_BUILD_ROOT%{prefix}/bin | ||||
| ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT%{prefix}/bin/webportal | ||||
|  | ||||
| %files | ||||
| /etc/apache2/conf.d/xcat-ui.conf | ||||
| /etc/httpd/conf.d/xcat-ui.conf | ||||
| /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach22 | ||||
| /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 | ||||
|  | ||||
| %defattr(-,root,root) | ||||
| %{prefix} | ||||
|  | ||||
| @@ -100,19 +110,28 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal | ||||
| #********** Pre-install ********** | ||||
| # Inspect whether PHP related RPM packages are installed | ||||
| %ifos linux | ||||
| 	if [ -e "/etc/redhat-release" ]; then | ||||
| 		if [ ! -e "/etc/httpd/conf.d/php.conf" ]; then | ||||
| 			echo "" | ||||
| 			echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI."; | ||||
| 			exit -1; | ||||
| 		fi | ||||
| 	else 	# SUSE | ||||
| 		if [ ! -e "/etc/apache2/conf.d/php5.conf" ]; then | ||||
| 			echo "" | ||||
| 			echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI." | ||||
| 			exit -1; | ||||
| 		fi | ||||
| 	fi | ||||
|     if [ -e "/etc/redhat-release" ]; then | ||||
|         rpm -q php >/dev/null | ||||
|         if [ $? != 0 ]; then | ||||
|             echo "" | ||||
|             echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI."; | ||||
|             exit -1; | ||||
|         fi | ||||
|     elif [ -e "/opt/ibm/cmo/version" ]; then  # IBM Cloud Manager Appliance | ||||
|         rpm -q php >/dev/null | ||||
|         if [ $? != 0 ]; then | ||||
|             echo "" | ||||
|             echo "Error! Can not find php. Please make sure php is installed before installing xCAT-UI."; | ||||
|             exit -1; | ||||
|         fi | ||||
|     else    # SUSE | ||||
|         rpm -q apache2-mod_php5 php5 >/dev/null | ||||
|         if [ $? != 0 ]; then | ||||
|             echo "" | ||||
|             echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI." | ||||
|             exit -1; | ||||
|         fi | ||||
|     fi | ||||
| %else   # AIX | ||||
|     if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf" ]; then | ||||
|         echo "Installing xCAT-UI on AIX..." | ||||
| @@ -127,92 +146,74 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal | ||||
| #********** Post-install ********** | ||||
| # Get apache name | ||||
| %ifos linux | ||||
| 	if [ -e "/etc/redhat-release" ]; then | ||||
| 	  	apachedaemon='httpd' | ||||
| 	  	apacheuser='apache' | ||||
| 	else    # SUSE | ||||
| 	  	apachedaemon='apache2' | ||||
| 	  	apacheuser='wwwrun' | ||||
| 	fi | ||||
|     if [ "$1" = 1 ]    # Install | ||||
|     then | ||||
|         # Automatically put encrypted password into the xCAT passwd database | ||||
|           %{prefix}/sbin/chtab key=xcat,username=root passwd.password=`grep root /etc/shadow|cut -d : -f 2` | ||||
|  | ||||
| 	if [ "$1" = 1 ]    # Install | ||||
| 	then	  	 | ||||
| 	  	# Update apache conf | ||||
| 	  	/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf | ||||
| 	  	/bin/ln -s %{prefix}/ui/etc/apache2/conf.d/xcat-ui.conf /etc/$apachedaemon/conf.d/xcat-ui.conf | ||||
| 	  	 | ||||
| 		# Automatically put encrypted password into the xCAT passwd database | ||||
| 	  	%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`grep root /etc/shadow|cut -d : -f 2` | ||||
| 	 | ||||
| 	  	echo "To use xCAT-UI, point your browser to http://"`hostname -f`"/xcat" | ||||
| 	fi | ||||
| 	 | ||||
| 	if [ "$1" = 1 ] || [ "$1" = 2 ]		# Install or upgrade | ||||
| 	then | ||||
| 		# Restart xCAT | ||||
| 		/etc/init.d/xcatd restart | ||||
| 		 | ||||
| 		# Copy php.ini file into /opt/xcat/ui and turn off output_buffering | ||||
| 		if [ -e "/etc/redhat-release" ]; then | ||||
| 			/bin/sed /etc/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini | ||||
| 	 	else 	# SUSE | ||||
| 	    	/bin/sed /etc/php5/apache2/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini | ||||
| 	  	fi | ||||
| 	  	 | ||||
| 		# Restart Apache Server | ||||
| 		/etc/init.d/$apachedaemon restart | ||||
| 		true | ||||
| 	fi | ||||
| %else	# AIX | ||||
| 	ihs_config_dir='/usr/IBM/HTTPServer/conf' | ||||
| 	if [ "$1" = 1 ] #initial install | ||||
| 	then | ||||
| 	    # Check if IBM HTTP Server is installed in the default directory | ||||
| 	    # Update the apache config | ||||
| 	    echo "Updating IBM HTTP server configuration for xCAT..." | ||||
| 	    bin/rm -f /usr/IBM/HTTPServer/conf/xcat-ui.conf | ||||
| 	    cp /usr/IBM/HTTPServer/conf/httpd.conf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak | ||||
| 	    cat ../ui/etc/apache2/conf.d/xcat-ui.conf >> /usr/IBM/HTTPServer/conf/httpd.conf | ||||
| 	    /usr/IBM/HTTPServer/bin/apachectl restart | ||||
| 	 | ||||
| 	    # Put the encrypted password in /etc/security/passwd into the xcat passwd database | ||||
| 	    CONT=`cat /etc/security/passwd` | ||||
| 	    %{prefix}/sbin/chtab key=xcat,username=root passwd.password=`echo $CONT |cut -d ' ' -f 4` | ||||
| 	fi | ||||
|           echo "To use xCAT-UI, point your browser to http://"`hostname -f`"/xcat" | ||||
|     fi | ||||
|  | ||||
| 	if [ "$1" = 1 ] || [ "$1" = 2 ]      # Install or upgrade | ||||
| 	then | ||||
| 	    # Uncomment this if we change xcat-ui.conf again | ||||
| 	    # /etc/init.d/$apachedaemon restart | ||||
| 	    true | ||||
| 	fi | ||||
| %endif | ||||
|     # If httpd is 2.4 or newer, use the file with the new configuration options | ||||
|     #Apply the correct httpd/apache configuration file according to the httpd/apache version | ||||
|     if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] | ||||
|     then | ||||
|         /bin/rm -rf /etc/httpd/conf.d/xcat-ui.conf | ||||
|         /bin/rm -rf /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf | ||||
|         /bin/cp -f /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 /etc/httpd/conf.d/xcat-ui.conf | ||||
|         /bin/cp -f /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 /etc/apache2/conf.d/xcat-ui.conf | ||||
|     fi | ||||
|  | ||||
| %preun | ||||
| #********** Pre-uninstall ********** | ||||
| %ifos linux | ||||
| 	if [ "$1" = 0 ]         # RPM being removed | ||||
| 	then | ||||
| 		if [ -e "/etc/redhat-release" ]; then | ||||
| 			apachedaemon='httpd' | ||||
| 			apacheuser='apache' | ||||
| 		else    # SUSE | ||||
| 			apachedaemon='apache2' | ||||
| 			apacheuser='wwwrun' | ||||
| 		fi | ||||
| 	 | ||||
| 		# Remove links made during the post install script | ||||
| 		echo "Undoing $apachedaemon configuration for xCAT..." | ||||
| 		/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf | ||||
| 		/bin/rm -f %{prefix}/ui/php.ini | ||||
| 		/etc/init.d/$apachedaemon reload | ||||
| 	fi | ||||
|     if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] | ||||
|     then | ||||
|         /bin/rm -rf /etc/httpd/conf.d/xcat-ui.conf | ||||
|         /bin/rm -rf /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf | ||||
|         /bin/cp -f /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 /etc/httpd/conf.d/xcat-ui.conf | ||||
|         /bin/cp -f /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 /etc/apache2/conf.d/xcat-ui.conf | ||||
|     fi | ||||
|  | ||||
|     if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] | ||||
|     then | ||||
|         /bin/rm -rf /etc/httpd/conf.d/xcat-ui.conf | ||||
|         /bin/rm -rf /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf | ||||
|         /bin/cp -f /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 /etc/httpd/conf.d/xcat-ui.conf | ||||
|         /bin/cp -f /etc/%httpconfigdir/conf.orig/xcat-ui.conf.apach24 /etc/apache2/conf.d/xcat-ui.conf | ||||
|     fi | ||||
|  | ||||
|  | ||||
|     if [ "$1" = 1 ] || [ "$1" = 2 ]             # Install or upgrade | ||||
|     then | ||||
|         # Restart xCAT | ||||
|         /etc/init.d/xcatd restart | ||||
|  | ||||
|         # Copy php.ini file into /opt/xcat/ui and turn off output_buffering | ||||
|         if [ -e "/etc/redhat-release" ]; then | ||||
|             /bin/sed /etc/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini | ||||
|         elif [ -e "/opt/ibm/cmo/version" ]; then  # IBM Cloud Manager Appliance | ||||
|             /bin/sed /etc/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini | ||||
|         else    # SUSE | ||||
|             /bin/sed /etc/php5/apache2/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini | ||||
|         fi | ||||
|  | ||||
|         # Restart Apache Server | ||||
|         /etc/init.d/httpd restart | ||||
|         true | ||||
|     fi | ||||
| %else   # AIX | ||||
| 	# Remove links made during the post install script | ||||
| 	echo "Undoing IBM HTTP Server configuration for xCAT..." | ||||
| 	if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak" ];then | ||||
|     	cp /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak /usr/IBM/HTTPServer/conf/httpd.conf | ||||
|     	rm -rf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak | ||||
| 	fi | ||||
| 	/usr/IBM/HTTPServer/bin/apachectl restart | ||||
|     ihs_config_dir='/usr/IBM/HTTPServer/conf' | ||||
|     if [ "$1" = 1 ] #initial install | ||||
|     then | ||||
|         # Check if IBM HTTP Server is installed in the default directory | ||||
|         # Update the apache config | ||||
|         echo "Updating IBM HTTP server configuration for xCAT..." | ||||
|         bin/rm -f /usr/IBM/HTTPServer/conf/xcat-ui.conf | ||||
|         cp /usr/IBM/HTTPServer/conf/httpd.conf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak | ||||
|         cat ../ui/etc/apache2/conf.d/xcat-ui.conf >> /usr/IBM/HTTPServer/conf/httpd.conf | ||||
|         /usr/IBM/HTTPServer/bin/apachectl restart | ||||
|  | ||||
|         # Put the encrypted password in /etc/security/passwd into the xcat passwd database | ||||
|         CONT=`cat /etc/security/passwd` | ||||
|         %{prefix}/sbin/chtab key=xcat,username=root passwd.password=`echo $CONT |cut -d ' ' -f 4` | ||||
|     fi | ||||
|  | ||||
| %endif | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user