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