mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	Cleaned up and simplified code.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8316 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -201,7 +201,7 @@ span.ui-icon-info { | ||||
| } | ||||
|  | ||||
| .tab p { | ||||
| 	font: 12px verdana, arial, helvetica, sans-serif; | ||||
| 	word-wrap: break-word; | ||||
| } | ||||
|  | ||||
| .tab a { | ||||
| @@ -227,7 +227,7 @@ span.ui-icon-info { | ||||
| 	font: 12px verdana, arial, helvetica, sans-serif; | ||||
| 	color: #424242; | ||||
| 	padding: 10px; | ||||
| 	background-color: #F2F2F2; | ||||
| 	background-color: #A9D0F5; | ||||
| 	border-width: 1px; | ||||
| 	border-style: solid; | ||||
| 	border-color: #BDBDBD; | ||||
| @@ -317,40 +317,6 @@ legend { | ||||
| 	margin: 0; | ||||
| } | ||||
|  | ||||
| /*--------------- Status bar ---------------*/ | ||||
| .statusBar { | ||||
| 	border: solid 1px #F5D0A9; | ||||
| 	-moz-border-radius: .5em; | ||||
| 	-webkit-border-radius: .5em; | ||||
| 	border-radius: .5em; | ||||
| 	padding: 10px; | ||||
| 	background: #F8ECE0; | ||||
| } | ||||
|  | ||||
| .statusBar p { | ||||
| 	font: 12px verdana, arial, helvetica, sans-serif; | ||||
| 	max-width: 700px; | ||||
| 	word-wrap: break-word; | ||||
| } | ||||
|  | ||||
| /*--------------- Info bar ---------------*/ | ||||
| .infoBar { | ||||
| 	border: solid 1px #D8D8D8; | ||||
| 	padding: 0px 10px; | ||||
| 	background: #E0ECF8; | ||||
| } | ||||
|  | ||||
| .infoBar span { | ||||
| 	width: 20px; | ||||
| 	display: inline-table; | ||||
| } | ||||
|  | ||||
| .infoBar p { | ||||
| 	padding: 0px 10px; | ||||
| 	display: inline-table; | ||||
| 	word-wrap: break-word; | ||||
| } | ||||
|  | ||||
| /*--------------- jQuery datatable ---------------*/ | ||||
| .dataTables_wrapper { | ||||
| 	overflow: auto; | ||||
|   | ||||
| @@ -118,7 +118,7 @@ function loadTableNames(data) { | ||||
| 	$('#' + tabId).append(tablesDIV); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Select a table to view or edit'); | ||||
| 	var infoBar = createInfoBar('Select a table to view or edit.'); | ||||
| 	tablesDIV.append(infoBar); | ||||
|  | ||||
| 	// Create a list for the tables | ||||
|   | ||||
| @@ -14,11 +14,10 @@ function loadUpdatePage() { | ||||
| 	$('#updateTab').append(repositoryDiv); | ||||
| 	$('#updateTab').append(rpmDiv); | ||||
|  | ||||
| 	var infoBar = createInfoBar('Select the RPM and repository, then press Update'); | ||||
| 	var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.'); | ||||
| 	repositoryDiv.append(infoBar); | ||||
|  | ||||
| 	repositoryDiv.append("<fieldset><legend>Repository</legend></fieldset>"); | ||||
|  | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/systemcmd.php', | ||||
| 		dataType : 'json', | ||||
| @@ -30,7 +29,6 @@ function loadUpdatePage() { | ||||
| 	}); | ||||
|  | ||||
| 	rpmDiv.append("<fieldset></fieldset>"); | ||||
|  | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/systemcmd.php', | ||||
| 		dataType : 'json', | ||||
| @@ -50,53 +48,48 @@ function loadUpdatePage() { | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function showRepository(data) { | ||||
| 	var DevelRepository = ""; | ||||
| 	var StableRepository = ""; | ||||
| 	var Show = ""; | ||||
| 	var develRepository = ""; | ||||
| 	var stableRepository = ""; | ||||
| 	var show = ""; | ||||
|  | ||||
| 	// get the corresponding repository by OS Type | ||||
| 	if ("aix" == data.rsp) { | ||||
| 		DevelRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/"; | ||||
| 		StableRepository = "http://xcat.sourceforge.net/aix/xcat-core/"; | ||||
| 		develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/"; | ||||
| 		stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/"; | ||||
| 	} else { | ||||
| 		DevelRepository = "http://xcat.sourceforge.net/yum/devel/xcat-core/"; | ||||
| 		StableRepository = "http://xcat.sourceforge.net/yum/xcat-core/"; | ||||
| 		develRepository = "http://xcat.sourceforge.net/yum/devel/xcat-core/"; | ||||
| 		stableRepository = "http://xcat.sourceforge.net/yum/xcat-core/"; | ||||
| 	} | ||||
|  | ||||
| 	var repoList = $('<ol></ol>'); | ||||
|  | ||||
| 	// display the Devel Repository, remember user's last selection | ||||
| 	Show = Show + "<li><input type='radio' "; | ||||
| 	show = show + "<li><input type='radio' "; | ||||
| 	if (1 == $.cookie('xcatrepository')) { | ||||
| 		Show = Show + "checked='true'"; | ||||
| 		show = show + "checked='true'"; | ||||
| 	} | ||||
|  | ||||
| 	Show = Show + "name='reporadio' value='" + DevelRepository + "'>"; | ||||
| 	Show = Show + DevelRepository + "(<strong>Devel</strong>)</li>"; | ||||
|  | ||||
| 	repoList.append(Show); | ||||
| 	show = show + "name='reporadio' value='" + develRepository + "'>"; | ||||
| 	show = show + develRepository + "(<strong>Devel</strong>)</li>"; | ||||
| 	repoList.append(show); | ||||
|  | ||||
| 	// display the Stable Repository, remember user's last selection | ||||
| 	Show = "<li><input type='radio' "; | ||||
| 	show = "<li><input type='radio' "; | ||||
| 	if (2 == $.cookie('xcatrepository')) { | ||||
| 		Show = Show + "checked='true'"; | ||||
| 		show = show + "checked='true'"; | ||||
| 	} | ||||
|  | ||||
| 	Show = Show + "name='reporadio' value='" + StableRepository + "'>"; | ||||
| 	Show = Show + StableRepository + "(<strong>Stable</strong>)</li>"; | ||||
|  | ||||
| 	repoList.append(Show); | ||||
| 	show = show + "name='reporadio' value='" + stableRepository + "'>"; | ||||
| 	show = show + stableRepository + "(<strong>Stable</strong>)</li>"; | ||||
| 	repoList.append(show); | ||||
|  | ||||
| 	// display the Input Repository, remember user's last selection | ||||
| 	if (($.cookie('xcatrepository')) && (1 != $.cookie('xcatrepository')) && (2 != $.cookie('xcatrepository'))) { | ||||
| 		Show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: "; | ||||
| 		Show += "<input style='width: 500px' id='repositoryaddr' value='" + $.cookie('xcatrepository') + "'</li>"; | ||||
| 		show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: "; | ||||
| 		show += "<input style='width: 500px' id='repositoryaddr' value='" + $.cookie('xcatrepository') + "'</li>"; | ||||
| 	} else { | ||||
| 		Show = "<li><input type='radio' name='reporadio' value=''>Other: "; | ||||
| 		Show += "<input style='width: 500px' id='repositoryaddr' value=''</li>"; | ||||
| 		show = "<li><input type='radio' name='reporadio' value=''>Other: "; | ||||
| 		show += "<input style='width: 500px' id='repositoryaddr' value=''</li>"; | ||||
| 	} | ||||
|  | ||||
| 	repoList.append(Show); | ||||
| 	repoList.append(show); | ||||
| 	$('#repository fieldset').append(repoList); | ||||
| } | ||||
|  | ||||
| @@ -108,52 +101,50 @@ function showRepository(data) { | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function showRpmInfo(data) { | ||||
| 	var Rpms = null; | ||||
| 	var Show = ""; | ||||
| 	var RpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc", "xCAT-UI"); | ||||
| 	var rpms = null; | ||||
| 	var show = ""; | ||||
| 	var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc", "xCAT-UI"); | ||||
| 	var temp = 0; | ||||
| 	if (null == data.rsp) { | ||||
| 		$('#rpm fieldset').append("Get Rpm Info Error!"); | ||||
| 		$('#rpm fieldset').append("Error getting RPMs!"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	Rpms = data.rsp.split(/\n/); | ||||
| 	rpms = data.rsp.split(/\n/); | ||||
| 	// no rpm installed, return | ||||
| 	if (1 > Rpms.length) { | ||||
| 		$('#rpm fieldset').append("No Rpm installed!"); | ||||
| 	if (1 > rpms.length) { | ||||
| 		$('#rpm fieldset').append("No RPMs installed!"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	// clear the old data | ||||
| 	$('#rpm fieldset').children().remove(); | ||||
| 	$('#rpm fieldset').append("<legend>xCAT Rpm Info</legend>"); | ||||
|  | ||||
| 	Show = "<table id=rpmtable >"; | ||||
| 	Show += "<thead><tr>"; | ||||
| 	Show += "<th><input type='checkbox' id='selectall' value='' onclick='updateSelectAll()'></th>"; | ||||
| 	Show += "<th><b>Package Name</b></th><th><b>Version</b></th>"; | ||||
| 	Show += "</tr></thead>"; | ||||
|  | ||||
| 	for (temp = 0; temp < Rpms.length; temp++) { | ||||
| 	$('#rpm fieldset').append("<legend>xCAT RPMs</legend>"); | ||||
| 	show = "<table id=rpmtable >"; | ||||
| 	show += "<thead><tr>"; | ||||
| 	show += "<th><input type='checkbox' id='selectall' value='' onclick='updateSelectAll()'></th>"; | ||||
| 	show += "<th><b>Package Name</b></th><th><b>Version</b></th>"; | ||||
| 	show += "</tr></thead>"; | ||||
| 	for (temp = 0; temp < rpms.length; temp++) { | ||||
| 		// empty line continue | ||||
| 		if ("" == Rpms[temp]) { | ||||
| 		if ("" == rpms[temp]) { | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		// the rpm is not installed, continue | ||||
| 		if (-1 != Rpms[temp].indexOf("not")) { | ||||
| 		if (-1 != rpms[temp].indexOf("not")) { | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		// show the version in table | ||||
| 		Show += "<tr>"; | ||||
| 		Show += "<td><input type='checkbox' value='" + RpmNames[temp] + "'></td>"; | ||||
| 		Show += "<td>" + RpmNames[temp] + "</td><td>" + Rpms[temp].substr(RpmNames[temp].length + 1) + "</td>"; | ||||
| 		Show += "</tr>"; | ||||
| 		show += "<tr>"; | ||||
| 		show += "<td><input type='checkbox' value='" + rpmNames[temp] + "'></td>"; | ||||
| 		show += "<td>" + rpmNames[temp] + "</td><td>" + rpms[temp].substr(rpmNames[temp].length + 1) + "</td>"; | ||||
| 		show += "</tr>"; | ||||
| 	} | ||||
| 	Show += "</table>"; | ||||
| 	Show += "<br\>"; | ||||
| 	$('#rpm fieldset').append(Show); | ||||
| 	show += "</table>"; | ||||
| 	show += "<br\>"; | ||||
| 	$('#rpm fieldset').append(show); | ||||
|  | ||||
| 	// add the update button | ||||
| 	var updateButton = createButton('Update'); | ||||
| @@ -201,7 +192,6 @@ function updateRpm() { | ||||
| 			rpmPathType = "2"; | ||||
| 		} else { | ||||
| 			rpmPathType = "1"; | ||||
| 			; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -212,7 +202,6 @@ function updateRpm() { | ||||
| 		} | ||||
|  | ||||
| 		var pattern = new RegExp("^" + temp + ",|," + temp + ","); | ||||
|  | ||||
| 		if (pattern.test(rpms)) { | ||||
| 			return true; | ||||
| 		} | ||||
| @@ -226,11 +215,11 @@ function updateRpm() { | ||||
| 	// Check RPM and repository | ||||
| 	var errMsg = ''; | ||||
| 	if (!rpms) { | ||||
| 		errMsg = "Please select the rpm!<br>"; | ||||
| 		errMsg = "Please select an RPM!<br>"; | ||||
| 	} | ||||
|  | ||||
| 	if (!rpmPath) { | ||||
| 		errMsg += "Please select or input the repository!"; | ||||
| 		errMsg += "Please select or input a repository!"; | ||||
| 	} | ||||
|  | ||||
| 	if (!rpms || !rpmPath) { | ||||
| @@ -302,7 +291,6 @@ function ShowUpdateResult(data) { | ||||
| 		var resDetail = $('<div id="resDetail"></div>'); | ||||
| 		resDetail.hide(); | ||||
| 		$('#update').append(resDetail); | ||||
|  | ||||
| 		for (temp = 0; temp < resArray.length; temp++) { | ||||
| 			resDetail.append(resArray[temp] + "<br>"); | ||||
| 		} | ||||
|   | ||||
| @@ -132,7 +132,7 @@ bladePlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 	statBar.append(loader); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Provision a blade node'); | ||||
| 	var infoBar = createInfoBar('Provision a blade node.'); | ||||
| 	provForm.append(infoBar); | ||||
|  | ||||
| 	// Append to provision tab | ||||
|   | ||||
| @@ -132,7 +132,7 @@ 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 | ||||
|   | ||||
| @@ -165,7 +165,7 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 	statBar.append(loader); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Provision a hmc node'); | ||||
| 	var infoBar = createInfoBar('Provision an hmc node.'); | ||||
| 	provForm.append(infoBar); | ||||
|  | ||||
| 	// Append to provision tab | ||||
|   | ||||
| @@ -132,7 +132,7 @@ 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 | ||||
|   | ||||
| @@ -132,7 +132,7 @@ 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 | ||||
|   | ||||
| @@ -53,7 +53,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { | ||||
| 		var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>').hide(); | ||||
|  | ||||
| 		// Create info bar | ||||
| 		var infoBar = createInfoBar('Clone a node'); | ||||
| 		var infoBar = createInfoBar('Clone a zvm node.'); | ||||
|  | ||||
| 		// Create clone form | ||||
| 		var cloneForm = $('<div class="form"></div>'); | ||||
| @@ -94,11 +94,17 @@ zvmPlugin.prototype.loadClonePage = function(node) { | ||||
| 		cloneForm.append('<div><label>Disk password:</label><input type="password" id="diskPw" name="diskPw" title="The password that will be used for accessing the disk. This input is optional."/></div>'); | ||||
|  | ||||
| 		// Generate tooltips | ||||
| 		cloneForm.find('div input[title]').tooltip({ | ||||
| 			position: "center right",	// Place tooltip on the right edge | ||||
| 			offset: [-2, 10],	// A little tweaking of the position | ||||
| 			effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 			opacity: 0.7		// Custom opacity setting | ||||
| 		cloneForm.find('div input[title]').tooltip( { | ||||
| 			position : "center right", | ||||
| 			offset : [ -2, 10 ], | ||||
| 			effect : "fade", | ||||
| 			opacity : 0.7, | ||||
| 			events : { | ||||
| 				def : "mouseover,mouseout", | ||||
| 				input : "mouseover,mouseout", | ||||
| 				widget : "focus mouseover,blur mouseout", | ||||
| 				tooltip : "mouseover,mouseout" | ||||
| 			} | ||||
| 		}); | ||||
| 		 | ||||
| 		/** | ||||
|   | ||||
| @@ -64,33 +64,35 @@ function loadHcpInfo(data) { | ||||
| 	// Get user directory entry | ||||
| 	var userEntry = data.rsp; | ||||
| 	if (userEntry[0].indexOf('Failed') < 0) { | ||||
|     	// Get disk pools | ||||
|     	$.ajax( { | ||||
|     		url : 'lib/cmd.php', | ||||
|     		dataType : 'json', | ||||
|     		data : { | ||||
|     			cmd : 'lsvm', | ||||
|     			tgt : hcp, | ||||
|     			args : '--diskpoolnames', | ||||
|     			msg : hcp | ||||
|     		}, | ||||
|      | ||||
|     		success : setDiskPoolCookies | ||||
|     	}); | ||||
|      | ||||
|     	// Get network names | ||||
|     	$.ajax( { | ||||
|     		url : 'lib/cmd.php', | ||||
|     		dataType : 'json', | ||||
|     		data : { | ||||
|     			cmd : 'lsvm', | ||||
|     			tgt : hcp, | ||||
|     			args : '--getnetworknames', | ||||
|     			msg : hcp | ||||
|     		}, | ||||
|      | ||||
|     		success : setNetworkCookies | ||||
|     	}); | ||||
| 		if (hcp) { | ||||
|         	// Get disk pools | ||||
|         	$.ajax( { | ||||
|         		url : 'lib/cmd.php', | ||||
|         		dataType : 'json', | ||||
|         		data : { | ||||
|         			cmd : 'lsvm', | ||||
|         			tgt : hcp, | ||||
|         			args : '--diskpoolnames', | ||||
|         			msg : hcp | ||||
|         		}, | ||||
|          | ||||
|         		success : setDiskPoolCookies | ||||
|         	}); | ||||
|          | ||||
|         	// Get network names | ||||
|         	$.ajax( { | ||||
|         		url : 'lib/cmd.php', | ||||
|         		dataType : 'json', | ||||
|         		data : { | ||||
|         			cmd : 'lsvm', | ||||
|         			tgt : hcp, | ||||
|         			args : '--getnetworknames', | ||||
|         			msg : hcp | ||||
|         		}, | ||||
|          | ||||
|         		success : setNetworkCookies | ||||
|         	}); | ||||
| 		} // End of if (hcp) | ||||
| 	} else { | ||||
| 		// Create warning dialog 		 | ||||
| 		var warnDialog = $('<div class="ui-state-error ui-corner-all">' | ||||
| @@ -2077,10 +2079,10 @@ function createZProvisionExisting(inst) { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	provExisting.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade",		 | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
| @@ -2339,10 +2341,10 @@ function createZProvisionNew(inst) { | ||||
| 		 | ||||
| 		// Generate tooltips | ||||
| 		diskBody.find('td input[title]').tooltip({ | ||||
| 			position: "top right",	// Place tooltip on the right edge | ||||
| 			offset: [-4, 4],	// Moves tooltip upwards 4px and 4px to the right | ||||
| 			effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 			opacity: 0.7		// Custom opacity setting | ||||
| 			position: "top right", | ||||
| 			offset: [-4, 4], | ||||
| 			effect: "fade", | ||||
| 			opacity: 0.7 | ||||
| 		}); | ||||
| 	}); | ||||
| 	 | ||||
| @@ -2358,10 +2360,10 @@ function createZProvisionNew(inst) { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	provNew.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
|   | ||||
| @@ -429,9 +429,10 @@ function loadNodes4Ganglia(data) { | ||||
| 	gangliaCol.unbind('click'); | ||||
|  | ||||
| 	// Create enough space for loader to be displayed | ||||
| 	$('#nodesDataTable tbody tr td:nth-child(3)').css('min-width', '60px'); | ||||
| 	$('#nodesDataTable tbody tr td:nth-child(4)').css('min-width', '60px'); | ||||
| 	$('#nodesDataTable tbody tr td:nth-child(5)').css('min-width', '80px'); | ||||
| 	var style = {'min-width': '60px', 'text-align': 'center'}; | ||||
| 	$('#nodesDataTable tbody tr td:nth-child(3)').css(style); | ||||
| 	$('#nodesDataTable tbody tr td:nth-child(4)').css(style); | ||||
| 	$('#nodesDataTable tbody tr td:nth-child(5)').css(style); | ||||
|  | ||||
| 	// Instead refresh the ping status and power status | ||||
| 	pingCol.bind('click', function(event) { | ||||
| @@ -512,7 +513,7 @@ function loadGangliaStatus(data) { | ||||
| 		status = jQuery.trim(ganglia[i][1]); | ||||
|  | ||||
| 		// Get the row containing the node | ||||
| 		rowNum = getRowNum(node); | ||||
| 		rowNum = findRowIndexUsingCol(node, '#nodesDataTable', 1); | ||||
|  | ||||
| 		// Update the power status column | ||||
| 		dTable.fnUpdate(status, rowNum, 4); | ||||
|   | ||||
| @@ -200,7 +200,7 @@ function rmcWorkingCheck(){ | ||||
| } | ||||
|  | ||||
| function loadRmcMonShow(){ | ||||
| 	$('#rmcMonStatus').empty().append("Getting monitoring Data(This step may take a long time)."); | ||||
| 	$('#rmcMonStatus').empty().append("Getting monitoring Data (This step may take a long time)."); | ||||
| 	$('#rmcMonStatus').append(createLoader()); | ||||
| 	 | ||||
| 	//init the selected Attributes string | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  */ | ||||
| var nodesTabs; 		// Node tabs | ||||
| var origAttrs = new Object();	// Original node attributes | ||||
| var defAttrs; 	// Definable node attributes | ||||
| var defAttrs; 		// Definable node attributes | ||||
|  | ||||
| /** | ||||
|  * Set the nodes tab | ||||
| @@ -45,7 +45,7 @@ function loadNodesPage() { | ||||
| 		groupDIV.append(loader); | ||||
| 		 | ||||
| 		// Create info bar | ||||
| 		var info = createInfoBar('Select a group to view its nodes'); | ||||
| 		var info = createInfoBar('Select a group to view its nodes.'); | ||||
| 		$('#nodes').append(info); | ||||
|  | ||||
| 		// Get groups | ||||
| @@ -218,6 +218,13 @@ function loadGroups(data) { | ||||
| 					msg : '' | ||||
| 				}, | ||||
|  | ||||
| 				/** | ||||
| 				 * Set definable node attributes and open dialog | ||||
| 				 *  | ||||
| 				 * @param data | ||||
| 				 *            Data returned from HTTP request | ||||
| 				 * @return Nothing | ||||
| 				 */ | ||||
| 				success : function(data) { | ||||
| 					setDefAttrs(data); | ||||
| 					openSetPropsDialog(); | ||||
| @@ -274,10 +281,10 @@ function loadGroups(data) { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	addNodeLink.tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	$('#groups').append(addNodeLink); | ||||
| @@ -418,12 +425,12 @@ function loadNodes(data) { | ||||
| 		 | ||||
| 		// Generate tooltips | ||||
| 		icon.tooltip({ | ||||
| 			position: "center right",	// Place tooltip on the right edge | ||||
| 			offset: [-2, 10],			// A little tweaking of the position | ||||
| 			position: "center right", | ||||
| 			offset: [-2, 10], | ||||
| 			effect: "fade",	 | ||||
| 			opacity: 0.8, | ||||
| 			relative: true, | ||||
| 			effect: "fade",				// Use the built-in fadeIn/fadeOut | ||||
| 										// effect | ||||
| 			opacity: 0.8				// Custom opacity setting | ||||
| 			delay: 500 | ||||
| 		}); | ||||
| 		 | ||||
| 		// Go through each header | ||||
| @@ -463,7 +470,7 @@ function loadNodes(data) { | ||||
|  | ||||
| 	var powerLnk = $('<a>Power</a>'); | ||||
| 	 | ||||
| 	// Power on (rpower) | ||||
| 	// Power on | ||||
| 	var powerOnLnk = $('<a>Power on</a>'); | ||||
| 	powerOnLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -472,7 +479,7 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
| 	// Power off (rpower) | ||||
| 	// Power off | ||||
| 	var powerOffLnk = $('<a>Power off</a>'); | ||||
| 	powerOffLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -515,7 +522,7 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	// Delete (rmvm) | ||||
| 	// Delete | ||||
| 	var deleteLnk = $('<a>Delete</a>'); | ||||
| 	deleteLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -533,7 +540,7 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	// Run script (xdsh) | ||||
| 	// Run script | ||||
| 	var scriptLnk = $('<a>Run script</a>'); | ||||
| 	scriptLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -542,7 +549,7 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	// Update (updatenode) | ||||
| 	// Update | ||||
| 	var updateLnk = $('<a>Update</a>'); | ||||
| 	updateLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -551,7 +558,7 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	// Set boot state (nodeset) | ||||
| 	// Set boot state | ||||
| 	var setBootStateLnk = $('<a>Set boot state</a>'); | ||||
| 	setBootStateLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -561,7 +568,7 @@ function loadNodes(data) { | ||||
|  | ||||
| 	}); | ||||
|  | ||||
| 	// Boot to network (rnetboot) | ||||
| 	// Boot to network | ||||
| 	var boot2NetworkLnk = $('<a>Boot to network</a>'); | ||||
| 	boot2NetworkLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -570,7 +577,7 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	// Remote console (rcons) | ||||
| 	// Remote console | ||||
| 	var rcons = $('<a>Open console</a>'); | ||||
| 	rcons.bind('click', function(event){ | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable'); | ||||
| @@ -579,12 +586,12 @@ function loadNodes(data) { | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
| 	// Set node properties | ||||
| 	var setProps = $('<a>Set node properties</a>'); | ||||
| 	setProps.bind('click', function(event){ | ||||
| 	// Edit properties | ||||
| 	var editProps = $('<a>Edit properties</a>'); | ||||
| 	editProps.bind('click', function(event){ | ||||
| 		var tgtNodes = getNodesChecked('nodesDataTable').split(','); | ||||
| 		for (var i in tgtNodes) { | ||||
| 			loadSetPropsPage(tgtNodes[i]); | ||||
| 			loadEditPropsPage(tgtNodes[i]); | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
| @@ -597,11 +604,10 @@ function loadNodes(data) { | ||||
| 	// Advanced actions | ||||
| 	var advancedActions; | ||||
| 	if ('compute' == group) { | ||||
| 		advancedActions = [ boot2NetworkLnk, scriptLnk, setBootStateLnk, updateLnk, rcons, setProps ]; | ||||
| 		advancedActions = [ boot2NetworkLnk, scriptLnk, setBootStateLnk, updateLnk, rcons, editProps ]; | ||||
| 	} else { | ||||
| 		advancedActions = [ boot2NetworkLnk, scriptLnk, setBootStateLnk, updateLnk, setProps ]; | ||||
| 		advancedActions = [ boot2NetworkLnk, scriptLnk, setBootStateLnk, updateLnk, editProps ]; | ||||
| 	} | ||||
|  | ||||
| 	var advancedActionMenu = createMenu(advancedActions); | ||||
|  | ||||
| 	/** | ||||
| @@ -664,7 +670,6 @@ function loadNodes(data) { | ||||
| 	pingCol.bind('click', function(event) { | ||||
| 		refreshPingStatus(group); | ||||
| 	}); | ||||
| 	 | ||||
| 	powerCol.bind('click', function(event) { | ||||
| 		refreshPowerStatus(group); | ||||
| 	}); | ||||
| @@ -709,7 +714,6 @@ function loadNodes(data) { | ||||
| 	/** | ||||
| 	 * Get power and ping for each node | ||||
| 	 */ | ||||
|  | ||||
| 	// Get power status | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/cmd.php', | ||||
| @@ -738,26 +742,23 @@ function loadNodes(data) { | ||||
| 		success : loadPingStatus | ||||
| 	}); | ||||
| 	 | ||||
| 	if (!defAttrs.length) { | ||||
|     	// Get definable node attributes | ||||
|     	$.ajax( { | ||||
|     		url : 'lib/cmd.php', | ||||
|     		dataType : 'json', | ||||
|     		data : { | ||||
|     			cmd : 'lsdef', | ||||
|     			tgt : '', | ||||
|     			args : '-t;node;-h', | ||||
|     			msg : '' | ||||
|     		}, | ||||
|      | ||||
|     		success : setDefAttrs | ||||
|     	}); | ||||
| 	} | ||||
| 	// Get definable node attributes | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/cmd.php', | ||||
| 		dataType : 'json', | ||||
| 		data : { | ||||
| 			cmd : 'lsdef', | ||||
| 			tgt : '', | ||||
| 			args : '-t;node;-h', | ||||
| 			msg : '' | ||||
| 		}, | ||||
|  | ||||
| 		success : setDefAttrs | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Additional ajax requests need to be made for zVM | ||||
| 	 */ | ||||
|  | ||||
| 	// Get index of HCP column | ||||
| 	var i = $.inArray('hcp', sorted); | ||||
| 	if (i) { | ||||
| @@ -773,7 +774,6 @@ function loadNodes(data) { | ||||
| 		for (var h in hcps) { | ||||
| 			// Get node without domain name | ||||
| 			args = h.split('.'); | ||||
| 			 | ||||
| 			// Check if SMAPI is online | ||||
| 			$.ajax( { | ||||
| 				url : 'lib/cmd.php', | ||||
| @@ -788,7 +788,7 @@ function loadNodes(data) { | ||||
| 				// Load hardware control point (HCP) specific info | ||||
| 				// Get disk pools and network names | ||||
| 				success : loadHcpInfo | ||||
| 			});			 | ||||
| 			});		 | ||||
| 		} // End of for | ||||
| 	} // End of if | ||||
| } | ||||
| @@ -804,19 +804,18 @@ function loadPowerStatus(data) { | ||||
| 	// Get datatable | ||||
| 	var dTable = $('#nodesDataTable').dataTable(); | ||||
| 	var power = data.rsp; | ||||
| 	var rowNum, node, status, args; | ||||
| 	var rowPos, node, status, args; | ||||
|  | ||||
| 	for (var i in power) { | ||||
| 		// power[0] = nodeName and power[1] = state | ||||
| 		args = power[i].split(':'); | ||||
| 		node = jQuery.trim(args[0]); | ||||
| 		status = jQuery.trim(args[1]); | ||||
|  | ||||
| 		// Get the row containing the node | ||||
| 		rowNum = getRowNum(node); | ||||
| 		rowPos = findRowIndexUsingCol(node, '#nodesDataTable', 1); | ||||
|  | ||||
| 		// Update the power status column | ||||
| 		dTable.fnUpdate(status, rowNum, 3); | ||||
| 		dTable.fnUpdate(status, rowPos, 3); | ||||
| 	} | ||||
| 	 | ||||
| 	// Hide power loader | ||||
| @@ -865,14 +864,12 @@ function loadPingStatus(data) { | ||||
| 	var rowPos, node, status; | ||||
|  | ||||
| 	// Get all nodes within the datatable | ||||
| 	var rows = dTable.fnGetNodes(); | ||||
| 	for (var i in ping) { | ||||
| 		// ping[0] = nodeName and ping[1] = state | ||||
| 		node = jQuery.trim(ping[i][0]); | ||||
| 		status = jQuery.trim(ping[i][1]); | ||||
|  | ||||
| 		// Get the row containing the node | ||||
| 		rowPos = getRowNum(node); | ||||
| 		rowPos = findRowIndexUsingCol(node, '#nodesDataTable', 1); | ||||
|  | ||||
| 		// Update the ping status column | ||||
| 		dTable.fnUpdate(status, rowPos, 2); | ||||
| @@ -998,11 +995,11 @@ function loadUnlockPage(tgtNodes) { | ||||
|  | ||||
| 	// Generate new tab ID | ||||
| 	var instance = 0; | ||||
| 	var newTabId = 'UnlockTab' + instance; | ||||
| 	var newTabId = 'unlockTab' + instance; | ||||
| 	while ($('#' + newTabId).length) { | ||||
| 		// If one already exists, generate another one | ||||
| 		instance = instance + 1; | ||||
| 		newTabId = 'UnlockTab' + instance; | ||||
| 		newTabId = 'unlockTab' + instance; | ||||
| 	} | ||||
|  | ||||
| 	var unlockForm = $('<div class="form"></div>'); | ||||
| @@ -1017,7 +1014,7 @@ function loadUnlockPage(tgtNodes) { | ||||
| 	statusBar.append(loader); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Give the root password for this node range to setup its SSH keys'); | ||||
| 	var infoBar = createInfoBar('Give the root password for this node range to setup its SSH keys.'); | ||||
| 	unlockForm.append(infoBar); | ||||
|  | ||||
| 	unlockForm.append('<div><label>Target node range:</label><input type="text" id="node" name="node" readonly="readonly" value="' + tgtNodes + '" title="The node or node range to unlock"/></div>'); | ||||
| @@ -1025,10 +1022,10 @@ function loadUnlockPage(tgtNodes) { | ||||
|  | ||||
| 	// Generate tooltips | ||||
| 	unlockForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
| @@ -1065,7 +1062,7 @@ function loadUnlockPage(tgtNodes) { | ||||
|     		$(this).attr('disabled', 'true'); | ||||
|     	} else { | ||||
|     		// Show warning message | ||||
| 			var warn = createWarnBar('You are missing some values'); | ||||
| 			var warn = createWarnBar('You are missing some values!'); | ||||
| 			warn.prependTo($(this).parent().parent()); | ||||
|     	} | ||||
|     }); | ||||
| @@ -1110,7 +1107,7 @@ function loadScriptPage(tgtNodes) { | ||||
| 	statBar.append(loader); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Run a script against this node range'); | ||||
| 	var infoBar = createInfoBar('Load a script to run against this node range.'); | ||||
| 	scriptForm.append(infoBar); | ||||
|  | ||||
| 	// Target node or group | ||||
| @@ -1129,10 +1126,10 @@ function loadScriptPage(tgtNodes) { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	scriptForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
|  | ||||
| 	// Script | ||||
| @@ -1237,11 +1234,11 @@ function loadDeletePage(tgtNodes) { | ||||
|  | ||||
| 	// Generate new tab ID | ||||
| 	var inst = 0; | ||||
| 	newTabId = 'DeleteTab' + inst; | ||||
| 	newTabId = 'deleteTab' + inst; | ||||
| 	while ($('#' + newTabId).length) { | ||||
| 		// If one already exists, generate another one | ||||
| 		inst = inst + 1; | ||||
| 		newTabId = 'DeleteTab' + inst; | ||||
| 		newTabId = 'deleteTab' + inst; | ||||
| 	} | ||||
|  | ||||
| 	// Create status bar, hide on load | ||||
| @@ -1283,7 +1280,7 @@ function loadDeletePage(tgtNodes) { | ||||
| 	deleteForm.append(statBar); | ||||
| 	 | ||||
| 	// Word wrap | ||||
| 	var instr = $('<p>Do you want to delete ' + tgtNodesStr + '?</p>').css('word-wrap', 'break-word'); | ||||
| 	var instr = $('<p>Are you sure you want to delete ' + tgtNodesStr + '?</p>').css('word-wrap', 'break-word'); | ||||
| 	deleteForm.append(instr); | ||||
|  | ||||
| 	/** | ||||
| @@ -1364,12 +1361,11 @@ function updateStatusBar(data) { | ||||
| 		} | ||||
|  | ||||
| 		// Update data table | ||||
| 		var rows = dTable.fnGetNodes(); | ||||
| 		var rowPos; | ||||
| 		for (var i in tgts) { | ||||
| 			if (!failed) { | ||||
| 				// Get the row containing the node link and delete it | ||||
| 				var row = getNodeRow(tgts[i], rows); | ||||
| 				var rowPos = dTable.fnGetPosition(row); | ||||
| 				rowPos = findRowIndexUsingCol(tgts[i], '#nodesDataTable', 1); | ||||
| 				dTable.fnDeleteRow(rowPos); | ||||
| 			} | ||||
| 		} | ||||
| @@ -1443,25 +1439,21 @@ function updatePowerStatus(data) { | ||||
| 	// Get datatable | ||||
| 	var dTable = $('#nodesDataTable').dataTable(); | ||||
|  | ||||
| 	// Get all nodes within the datatable | ||||
| 	var rows = dTable.fnGetNodes(); | ||||
|  | ||||
| 	// Get xCAT response | ||||
| 	var rsp = data.rsp; | ||||
| 	// Loop through each line | ||||
| 	var node, status, rowPos, strPos; | ||||
| 	for (var i in rsp) { | ||||
| 		// Get the node | ||||
| 		var node = rsp[i].split(":")[0]; | ||||
| 		node = rsp[i].split(":")[0]; | ||||
|  | ||||
| 		// If there is no error | ||||
| 		var status; | ||||
| 		if (rsp[i].indexOf("Error") < 0 || rsp[i].indexOf("Failed") < 0) { | ||||
| 			// Get the row containing the node link | ||||
| 			var row = getNodeRow(node, rows); | ||||
| 			var rowPos = dTable.fnGetPosition(row); | ||||
| 			rowPos = findRowIndexUsingCol(node, '#nodesDataTable', 1); | ||||
|  | ||||
| 			// If it was power on, then the data return would contain "Starting" | ||||
| 			var strPos = rsp[i].indexOf("Starting"); | ||||
| 			strPos = rsp[i].indexOf("Starting"); | ||||
| 			if (strPos > -1) { | ||||
| 				status = 'on'; | ||||
| 			} else { | ||||
| @@ -1575,11 +1567,6 @@ function setOSImageCookies(data) { | ||||
| 	var osArchsHash = new Object(); | ||||
|  | ||||
| 	for (var i = 1; i < rsp.length; i++) { | ||||
| 		// osimage table columns: imagename, profile, imagetype, provmethod, | ||||
| 		// osname, osvers, osdistro, osarch, synclists, comments, disable | ||||
| 		// e.g. sles11.1-s390x-statelite-compute, compute, linux, statelite, | ||||
| 		// Linux, sles11.1, , s390x, , s, | ||||
|  | ||||
| 		// Get the image name | ||||
| 		var cols = rsp[i].split(','); | ||||
| 		var osImage = cols[0].replace(new RegExp('"', 'g'), ''); | ||||
| @@ -1629,34 +1616,6 @@ function setGroupsCookies(data) { | ||||
| 	$.cookie('groups', rsp); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get row element that contains given node | ||||
|  *  | ||||
|  * @param tgtNode | ||||
|  *            Node to find | ||||
|  * @param rows | ||||
|  *            Rows within the datatable | ||||
|  * @return Row element | ||||
|  */ | ||||
| function getNodeRow(tgtNode, rows) { | ||||
| 	// Find the row | ||||
| 	for (var i in rows) { | ||||
| 		// Get all columns within the row | ||||
| 		var cols = rows[i].children; | ||||
| 		// Get the 1st column (node name) | ||||
| 		var cont = cols[1].children; | ||||
| 		var node = cont[0].innerHTML; | ||||
|  | ||||
| 		// If the node matches the target node | ||||
| 		if (node == tgtNode) { | ||||
| 			// Return the row | ||||
| 			return rows[i]; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get nodes that are checked in a given datatable | ||||
|  *  | ||||
| @@ -1686,47 +1645,34 @@ function getNodesChecked(datatableId) { | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get the column index for a given column name | ||||
|  * Find the row index using a column search value | ||||
|  *  | ||||
|  * @param colName | ||||
|  *            The column name to search | ||||
|  * @return The index containing the column name | ||||
|  * @param searchStr | ||||
|  *            String to search for | ||||
|  * @param table | ||||
|  *            Table to check | ||||
|  * @param col | ||||
|  *            Column to find string under | ||||
|  * @return The row index containing the search string | ||||
|  */ | ||||
| function getColNum(colName){ | ||||
| 	var colNum; | ||||
| 	var columns = $('table thead tr').children(); | ||||
| function findRowIndexUsingCol(searchStr, table, col){ | ||||
| 	var dTable, rows, cols; | ||||
| 	 | ||||
| 	for(colNum = 1; colNum < columns.length; colNum++){ | ||||
| 		if (colName == columns[colNum].innerHTML){ | ||||
| 			return colNum; | ||||
| 		} | ||||
| 	} | ||||
| 	return -1; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get the row index for a given node name | ||||
|  *  | ||||
|  * @param nodeName | ||||
|  *            Node name | ||||
|  * @return The row index containing the node name | ||||
|  */ | ||||
| function getRowNum(nodeName){ | ||||
| 	// Get datatable | ||||
| 	var dTable = $('#nodesDataTable').dataTable(); | ||||
| 	 | ||||
| 	// Get all data from datatable | ||||
| 	var data = dTable.fnGetData(); | ||||
| 	 | ||||
| 	var row; | ||||
| 	var nodeItem; | ||||
| 			 | ||||
| 	for(row = 0; row < data.length; row++){ | ||||
| 		nodeItem = data[row][1]; | ||||
| 		if(nodeItem.indexOf('>' + nodeName + '<') > -1){ | ||||
| 			return row; | ||||
| 	dTable = $(table).dataTable(); | ||||
| 	rows = dTable.fnGetData(); | ||||
|  | ||||
| 	// Loop through each row | ||||
| 	for (var i = 0; i < rows.length; i++) { | ||||
| 		// Get columns in row | ||||
| 		cols = dTable.fnGetData(i); | ||||
| 		// If column contains string | ||||
| 		if ( cols[col].indexOf(searchStr) > -1 ) { | ||||
| 			// Return index | ||||
| 			return i; | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	return -1; | ||||
| } | ||||
|  | ||||
| @@ -1760,9 +1706,10 @@ function loadRconsPage(tgtNodes){ | ||||
| 	var urlPath = window.location.pathname; | ||||
| 	var redirectUrl = 'https://'; | ||||
| 	var pos = 0; | ||||
| 	 | ||||
| 	// We only support one node | ||||
| 	if (-1 != tgtNodes.indexOf(',')){ | ||||
| 		alert("Sorry, the Rcons Page only support one node."); | ||||
| 		alert("You can only open one console at a time!"); | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| @@ -1816,7 +1763,7 @@ function updateNodeAttrs(group) { | ||||
| 	 | ||||
| 	// Create the arguments | ||||
| 	var args; | ||||
| 	var row, colPos, value; | ||||
| 	var rowPos, colPos, value; | ||||
| 	var attrName; | ||||
| 	// Go through each node where an attribute was changed | ||||
| 	for (var i in nodes) { | ||||
| @@ -1824,8 +1771,8 @@ function updateNodeAttrs(group) { | ||||
| 			args = ''; | ||||
| 			 | ||||
|         	// Get the row containing the node link | ||||
|         	row = getNodeRow(nodes[i], rows); | ||||
|         	$(row).find('td').each(function (){ | ||||
|         	rowPos = findRowIndexUsingCol(nodes[i], '#nodesDataTable', 1); | ||||
|         	$(rows[rowPos]).find('td').each(function (){ | ||||
|         		if ($(this).css('color') == 'red') { | ||||
|         			// Change color back to normal | ||||
|         			$(this).css('color', ''); | ||||
| @@ -1857,7 +1804,7 @@ function updateNodeAttrs(group) { | ||||
|         			cmd : 'chdef', | ||||
|         			tgt : '', | ||||
|         			args : '-t;node;-o;' + nodes[i] + ';' + args, | ||||
|         			msg : 'out=nodesTab;node=' + nodes[i] | ||||
|         			msg : 'out=nodesTab;tgt=' + nodes[i] | ||||
|         		}, | ||||
|  | ||||
|         		success: showChdefOutput | ||||
| @@ -1888,13 +1835,13 @@ function restoreNodeAttrs() { | ||||
| 	var rows = dTable.fnGetNodes(); | ||||
| 		 | ||||
| 	// Go through each node where an attribute was changed | ||||
| 	var row, colPos; | ||||
| 	var rowPos, colPos; | ||||
| 	var attrName, origVal; | ||||
| 	for (var i in nodes) { | ||||
| 		if (nodes[i]) {			 | ||||
| 			// Get the row containing the node link | ||||
|         	row = getNodeRow(nodes[i], rows); | ||||
|         	$(row).find('td').each(function (){ | ||||
|         	rowPos = findRowIndexUsingCol(tgts[i], '#nodesDataTable', 1); | ||||
|         	$(rows[rowPos]).find('td').each(function (){ | ||||
|         		if ($(this).css('color') == 'red') { | ||||
|         			// Change color back to normal | ||||
|         			$(this).css('color', ''); | ||||
| @@ -1907,7 +1854,6 @@ function restoreNodeAttrs() { | ||||
|         			origVal = origAttrs[nodes[i]][attrName]; | ||||
|         			 | ||||
|         			// Update column | ||||
|         			rowPos = getRowNum(nodes[i]); | ||||
|         			dTable.fnUpdate(origVal, rowPos, colPos); | ||||
|         		} | ||||
|         	}); | ||||
| @@ -1966,7 +1912,7 @@ function createCommentsToolTip(comment) { | ||||
|     			cmd : 'chdef', | ||||
|     			tgt : '', | ||||
|     			args : '-t;node;-o;' + node + ';usercomment=' + comments, | ||||
|     			msg : 'out=nodesTab;node=' + node | ||||
|     			msg : 'out=nodesTab;tgt=' + node | ||||
|     		}, | ||||
|     		 | ||||
|     		success: showChdefOutput | ||||
| @@ -2016,7 +1962,7 @@ function showChdefOutput(data) { | ||||
| 	var out = data.rsp; | ||||
| 	var args = data.msg.split(';'); | ||||
| 	var tabID = args[0].replace('out=', ''); | ||||
| 	var node = args[1].replace('node=', ''); | ||||
| 	var tgt = args[1].replace('tgt=', ''); | ||||
| 	 | ||||
| 	// Find info bar on nodes tab, if any | ||||
| 	var info = $('#' + tabID).find('.ui-state-highlight'); | ||||
| @@ -2027,13 +1973,12 @@ function showChdefOutput(data) { | ||||
| 	} | ||||
| 		 | ||||
| 	// Go through output and append to paragraph | ||||
| 	var node, status; | ||||
| 	var pg = $('<p></p>'); | ||||
| 	var prg = $('<p></p>'); | ||||
| 	for (var i in out) { | ||||
| 		pg.append(node + ': ' + out[i] + '<br>'); | ||||
| 		prg.append(tgt + ': ' + out[i] + '<br>'); | ||||
| 	} | ||||
| 	 | ||||
| 	info.append(pg); | ||||
| 	info.append(prg); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -2080,36 +2025,26 @@ function setDefAttrs(data) { | ||||
|  *            Target node to set properties | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function loadSetPropsPage(tgtNode) { | ||||
| function loadEditPropsPage(tgtNode) { | ||||
| 	// Get nodes tab | ||||
| 	var tab = getNodesTab(); | ||||
|  | ||||
| 	// Generate new tab ID | ||||
| 	var inst = 0; | ||||
| 	var newTabId = 'setPropsTab' + inst; | ||||
| 	var newTabId = 'editPropsTab' + inst; | ||||
| 	while ($('#' + newTabId).length) { | ||||
| 		// If one already exists, generate another one | ||||
| 		inst = inst + 1; | ||||
| 		newTabId = 'setPropsTab' + inst; | ||||
| 		newTabId = 'editPropsTab' + inst; | ||||
| 	} | ||||
|  | ||||
| 	// Open new tab | ||||
| 	// Create set properties form | ||||
| 	var setPropsForm = $('<div class="form"></div>'); | ||||
|  | ||||
| 	// Create status bar | ||||
| 	var barId = 'setPropsStatusBar' + inst; | ||||
| 	var statBar = createStatusBar(barId); | ||||
| 	statBar.hide(); | ||||
| 	setPropsForm.append(statBar); | ||||
|  | ||||
| 	// Create loader | ||||
| 	var loader = createLoader('setPropsLoader' + inst); | ||||
| 	statBar.append(loader); | ||||
| 	var editPropsForm = $('<div class="form"></div>'); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Choose the properties you wish to change on the node. When you are finished, click Save.'); | ||||
| 	setPropsForm.append(infoBar); | ||||
| 	editPropsForm.append(infoBar); | ||||
|  | ||||
| 	// Create an input for each definable attribute | ||||
| 	var div, label, input, descr, value; | ||||
| @@ -2136,9 +2071,9 @@ function loadSetPropsPage(tgtNode) { | ||||
| 		 | ||||
| 		div.append(label); | ||||
| 		div.append(input); | ||||
| 		setPropsForm.append(div); | ||||
| 		editPropsForm.append(div); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	// Change style for last division | ||||
| 	div.css({ | ||||
| 		'display': 'block', | ||||
| @@ -2146,11 +2081,11 @@ function loadSetPropsPage(tgtNode) { | ||||
| 	}); | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	setPropsForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect | ||||
| 		opacity: 0.8,		// Custom opacity setting | ||||
| 	editPropsForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.8, | ||||
| 		delay: 0, | ||||
| 		predelay: 800, | ||||
| 		events: { | ||||
| @@ -2201,13 +2136,13 @@ function loadSetPropsPage(tgtNode) { | ||||
|     			cmd : 'chdef', | ||||
|     			tgt : '', | ||||
|     			args : '-t;node;-o;' + tgtNode + ';' + args, | ||||
|     			msg : 'out=' + newTabId + ';node=' + tgtNode | ||||
|     			msg : 'out=' + newTabId + ';tgt=' + tgtNode | ||||
|     		}, | ||||
|  | ||||
|     		success: showChdefOutput | ||||
|     	}); | ||||
| 	}); | ||||
| 	setPropsForm.append(saveBtn); | ||||
| 	editPropsForm.append(saveBtn); | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Cancel | ||||
| @@ -2217,10 +2152,10 @@ function loadSetPropsPage(tgtNode) { | ||||
| 		// Close the tab | ||||
| 		tab.remove($(this).parent().parent().attr('id')); | ||||
| 	}); | ||||
| 	setPropsForm.append(cancelBtn); | ||||
| 	editPropsForm.append(cancelBtn); | ||||
|  | ||||
| 	// Append to discover tab | ||||
| 	tab.add(newTabId, 'Properties', setPropsForm, true); | ||||
| 	tab.add(newTabId, 'Edit', editPropsForm, true); | ||||
|  | ||||
| 	// Select new tab | ||||
| 	tab.select(newTabId); | ||||
| @@ -2268,10 +2203,10 @@ function openSetPropsDialog() { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	setPropsForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect | ||||
| 		opacity: 0.8,		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.8, | ||||
| 		delay: 0, | ||||
| 		predelay: 800, | ||||
| 		events: { | ||||
|   | ||||
| @@ -46,7 +46,7 @@ function loadNodesetPage(tgtNodes) { | ||||
| 	statBar.append(loader); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Set the boot state for a node range'); | ||||
| 	var infoBar = createInfoBar('Set the boot state for a node range.'); | ||||
| 	nodesetForm.append(infoBar); | ||||
|  | ||||
| 	// Create target node or group | ||||
| @@ -126,10 +126,10 @@ function loadNodesetPage(tgtNodes) { | ||||
|  | ||||
| 	// Generate tooltips | ||||
| 	nodesetForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
|   | ||||
| @@ -199,7 +199,7 @@ function createGraphical(bpa, fsp, area){ | ||||
| 	 | ||||
| 	//there is not selected lpars, show the info bar | ||||
| 	if (0 == temp){ | ||||
| 		area.append(createInfoBar('Hover CEC and select lpars to do operations.')); | ||||
| 		area.append(createInfoBar('Hover over a CEC and select the LPARs to do operations against.')); | ||||
| 	} | ||||
| 	//show selected lpars | ||||
| 	else{ | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function loadNetbootPage(tgtNodes) { | ||||
| 	// Get node OS (AIX, rh*, centos*, fedora*, or sles*) | ||||
| 	// Get node OS | ||||
| 	var osHash = new Object(); | ||||
| 	var nodes = tgtNodes.split(','); | ||||
| 	for (var i in nodes) { | ||||
| @@ -101,10 +101,10 @@ function loadNetbootPage(tgtNodes) { | ||||
|  | ||||
| 	// Generate tooltips | ||||
| 	netbootForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
|   | ||||
| @@ -201,10 +201,10 @@ function loadUpdatenodePage(tgtNodes) { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	updatenodeForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect			 | ||||
| 		opacity: 0.7		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.7 | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
|   | ||||
| @@ -48,8 +48,6 @@ function loadImages(data) { | ||||
| 	$.cookie('images2update', ''); | ||||
| 	// Clear hash table containing image attributes | ||||
| 	origAttrs = ''; | ||||
| 	// Clear hash table containing definable image attributes | ||||
| 	defAttrs = new Array(); | ||||
|  | ||||
| 	var image; | ||||
| 	var args; | ||||
| @@ -128,58 +126,58 @@ function loadImages(data) { | ||||
| 	var actionBar = $('<div class="actionBar"></div>'); | ||||
|  | ||||
| 	/** | ||||
| 	 * The following actions are available to perform against a given image: | ||||
| 	 * copy CD and set properties | ||||
| 	 * The following actions are available for images: | ||||
| 	 * copy Linux distribution and edit image properties | ||||
| 	 */ | ||||
|  | ||||
| 	// Copy CDs | ||||
| 	var copyCdLnk = $('<a>Copy CDs</a>'); | ||||
| 	copyCdLnk.bind('click', function(event) { | ||||
| 		loadCopyCdsPage(); | ||||
| 	// Create copy Linux button | ||||
| 	var copyLinuxBtn = createButton('Copy Linux'); | ||||
| 	copyLinuxBtn.bind('click', function(event) { | ||||
| 		loadCopyLinuxPage(); | ||||
| 	}); | ||||
| 	 | ||||
| 	// Set image properties | ||||
| 	var setProps = $('<a>Set properties</a>'); | ||||
| 	setProps.bind('click', function(event){ | ||||
| 	// Create edit button | ||||
| 	var editBtn = createButton('Edit'); | ||||
| 	editBtn.bind('click', function(event){ | ||||
| 		var tgtImages = getNodesChecked('imagesDataTable').split(','); | ||||
| 		for (var i in tgtImages) { | ||||
| 			 loadSetImagePropsPage(tgtImages[i]); | ||||
| 			 loadEditImagePage(tgtImages[i]); | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Create an action menu | ||||
| 	 */ | ||||
| 	var actionsDiv = $('<div></div>'); | ||||
| 	var actions = [ copyCdLnk, setProps ]; | ||||
| 	var actionMenu = createMenu(actions); | ||||
| 	actionMenu.superfish(); | ||||
| 	actionsDiv.append(actionMenu); | ||||
| 	actionBar.append(actionsDiv); | ||||
| 	$('#imagesTab').append(actionBar); | ||||
| 	 | ||||
| 	// Insert table | ||||
| 	$('#imagesTab').append(dTable.object()); | ||||
| 	 | ||||
| 	// Save changes | ||||
| 	var saveLnk = $('<a>Save</a>'); | ||||
| 	saveLnk.bind('click', function(event){ | ||||
| 	// Create save button | ||||
| 	var saveBtn = createButton('Save'); | ||||
| 	// Do not show button until table is edited | ||||
| 	saveBtn.css({ | ||||
| 		'display': 'inline', | ||||
| 		'margin-left': '550px' | ||||
| 	}).hide(); | ||||
| 	saveBtn.bind('click', function(event){ | ||||
| 		updateImageAttrs(); | ||||
| 	}); | ||||
| 	 | ||||
| 	// Undo changes | ||||
| 	var undoLnk = $('<a>Undo</a>'); | ||||
| 	undoLnk.bind('click', function(event){ | ||||
| 	// Create undo button | ||||
| 	var undoBtn = createButton('Undo'); | ||||
| 	// Do not show button until table is edited | ||||
| 	undoBtn.css({ | ||||
| 		'display': 'inline' | ||||
| 	}).hide(); | ||||
| 	undoBtn.bind('click', function(event){ | ||||
| 		restoreImageAttrs(); | ||||
| 	}); | ||||
|  | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Create menu to save and undo table changes | ||||
| 	 * Create an action bar | ||||
| 	 */ | ||||
| 	// It will be hidden until a change is made | ||||
| 	var tableActionsMenu = createMenu([saveLnk, undoLnk]).hide(); | ||||
| 	tableActionsMenu.css('margin-left', '490px'); | ||||
| 	actionsDiv.append(tableActionsMenu); | ||||
| 	var actionsBar = $('<div></div>').css('margin', '10px 0px'); | ||||
| 	actionsBar.append(copyLinuxBtn); | ||||
| 	actionsBar.append(editBtn); | ||||
| 	actionsBar.append(saveBtn); | ||||
| 	actionsBar.append(undoBtn); | ||||
| 	$('#imagesTab').append(actionsBar); | ||||
| 	 | ||||
| 	// Insert table | ||||
| 	$('#imagesTab').append(dTable.object()); | ||||
|  | ||||
| 	// Turn table into a datatable | ||||
| 	var myDataTable = $('#imagesDataTable').dataTable({ | ||||
| @@ -218,13 +216,13 @@ function loadImages(data) { | ||||
| 			flagImage2Update(image); | ||||
| 			 | ||||
| 			// Show table menu actions | ||||
| 			tableActionsMenu.show(); | ||||
| 			saveBtn.show(); | ||||
| 			undoBtn.show(); | ||||
|  | ||||
| 			return (value); | ||||
| 		}, { | ||||
| 			onblur : 'submit', 	// Clicking outside editable area submits | ||||
| 								// changes | ||||
| 			type : 'textarea', | ||||
| 			onblur : 'submit', 	// Clicking outside editable area submits changes | ||||
| 			type : 'textarea',	// Input type to use | ||||
| 			placeholder: ' ', | ||||
| 			height : '30px' 	// The height of the text area | ||||
| 		}); | ||||
| @@ -283,7 +281,7 @@ function updateImageAttrs() { | ||||
| 		 | ||||
| 	// Create the arguments | ||||
| 	var args; | ||||
| 	var row, colPos, value; | ||||
| 	var rowPos, colPos, value; | ||||
| 	var attrName; | ||||
| 	// Go through each node where an attribute was changed | ||||
| 	for (var i in images) { | ||||
| @@ -291,8 +289,8 @@ function updateImageAttrs() { | ||||
| 			args = ''; | ||||
| 			 | ||||
|         	// Get the row containing the image name | ||||
|         	row = getImageRow(images[i], rows); | ||||
|         	$(row).find('td').each(function (){ | ||||
|         	rowPos = findRowIndexUsingCol(images[i], '#imagesDataTable', 1); | ||||
|         	$(rows[rowPos]).find('td').each(function (){ | ||||
|         		if ($(this).css('color') == 'red') { | ||||
|         			// Change color back to normal | ||||
|         			$(this).css('color', ''); | ||||
| @@ -324,7 +322,7 @@ function updateImageAttrs() { | ||||
|         			cmd : 'chdef', | ||||
|         			tgt : '', | ||||
|         			args : '-t;osimage;-o;' + images[i] + ';' + args, | ||||
|         			msg : 'out=imagesTab;node=' + images[i] | ||||
|         			msg : 'out=imagesTab;tgt=' + images[i] | ||||
|         		}, | ||||
|  | ||||
|         		success: showChdefOutput | ||||
| @@ -355,13 +353,13 @@ function restoreImageAttrs() { | ||||
| 	var rows = dTable.fnGetNodes(); | ||||
| 		 | ||||
| 	// Go through each node where an attribute was changed | ||||
| 	var row, colPos; | ||||
| 	var rowPos, colPos; | ||||
| 	var attrName, origVal; | ||||
| 	for (var i in images) { | ||||
| 		if (images[i]) {			 | ||||
| 			// Get the row containing the image name | ||||
|         	row = getImageRow(images[i], rows); | ||||
|         	$(row).find('td').each(function (){ | ||||
| 			rowPos = findRowIndexUsingCol(images[i], '#imagesDataTable', 1); | ||||
|         	$(rows[rowPos]).find('td').each(function (){ | ||||
|         		if ($(this).css('color') == 'red') { | ||||
|         			// Change color back to normal | ||||
|         			$(this).css('color', ''); | ||||
| @@ -374,7 +372,6 @@ function restoreImageAttrs() { | ||||
|         			origVal = origAttrs[images[i]][attrName]; | ||||
|         			 | ||||
|         			// Update column | ||||
|         			rowPos = findRowIndexUsingCol(images[i], '#imagesDataTable', 1); | ||||
|         			dTable.fnUpdate(origVal, rowPos, colPos); | ||||
|         		} | ||||
|         	}); | ||||
| @@ -386,38 +383,6 @@ function restoreImageAttrs() { | ||||
| 	$.cookie('images2update', ''); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Find the row index using a column search value | ||||
|  *  | ||||
|  * @param searchStr | ||||
|  *            String to search for | ||||
|  * @param table | ||||
|  *            Table to check | ||||
|  * @param col | ||||
|  *            Column to find string under | ||||
|  * @return The row index containing the image name | ||||
|  */ | ||||
| function findRowIndexUsingCol(searchStr, table, col){ | ||||
| 	var dTable, rows, cols; | ||||
| 	 | ||||
| 	// Get datatable | ||||
| 	dTable = $(table).dataTable(); | ||||
| 	rows = dTable.fnGetData(); | ||||
| 	 | ||||
| 	// Loop through each row | ||||
| 	for (var i = 0; i < rows.length; i++) { | ||||
| 		// Get columns in row | ||||
| 		cols = dTable.fnGetData(i); | ||||
| 		// If column contains string | ||||
| 		if ( cols[col] == searchStr ) { | ||||
| 			// Return index | ||||
| 			return i; | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	return -1; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Set definable image attributes | ||||
|  *  | ||||
| @@ -426,6 +391,9 @@ function findRowIndexUsingCol(searchStr, table, col){ | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function setImageDefAttrs(data) { | ||||
| 	// Clear hash table containing definable image attributes | ||||
| 	defAttrs = new Array(); | ||||
| 	 | ||||
| 	// Get definable attributes | ||||
| 	var attrs = data.rsp[2].split(/\n/); | ||||
|  | ||||
| @@ -459,33 +427,23 @@ function setImageDefAttrs(data) { | ||||
|  *            Target image to set properties | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function loadSetImagePropsPage(tgtImage) { | ||||
| function loadEditImagePage(tgtImage) { | ||||
| 	// Get nodes tab | ||||
| 	var tab = getProvisionTab(); | ||||
|  | ||||
| 	// Generate new tab ID | ||||
| 	var inst = 0; | ||||
| 	var newTabId = 'setImagePropsTab' + inst; | ||||
| 	var newTabId = 'editImageTab' + inst; | ||||
| 	while ($('#' + newTabId).length) { | ||||
| 		// If one already exists, generate another one | ||||
| 		inst = inst + 1; | ||||
| 		newTabId = 'setImagePropsTab' + inst; | ||||
| 		newTabId = 'editImageTab' + inst; | ||||
| 	} | ||||
|  | ||||
| 	// Open new tab | ||||
| 	// Create set properties form | ||||
| 	var setPropsForm = $('<div class="form"></div>'); | ||||
|  | ||||
| 	// Create status bar | ||||
| 	var barId = 'setImagePropsStatusBar' + inst; | ||||
| 	var statBar = createStatusBar(barId); | ||||
| 	statBar.hide(); | ||||
| 	setPropsForm.append(statBar); | ||||
|  | ||||
| 	// Create loader | ||||
| 	var loader = createLoader('setImagePropsLoader' + inst); | ||||
| 	statBar.append(loader); | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Choose the properties you wish to change on the node. When you are finished, click Save.'); | ||||
| 	setPropsForm.append(infoBar); | ||||
| @@ -526,10 +484,10 @@ function loadSetImagePropsPage(tgtImage) { | ||||
| 	 | ||||
| 	// Generate tooltips | ||||
| 	setPropsForm.find('div input[title]').tooltip({ | ||||
| 		position: "center right",	// Place tooltip on the right edge | ||||
| 		offset: [-2, 10],	// A little tweaking of the position | ||||
| 		effect: "fade",		// Use the built-in fadeIn/fadeOut effect | ||||
| 		opacity: 0.8,		// Custom opacity setting | ||||
| 		position: "center right", | ||||
| 		offset: [-2, 10], | ||||
| 		effect: "fade", | ||||
| 		opacity: 0.8, | ||||
| 		events: { | ||||
| 		  def:     "mouseover,mouseout", | ||||
| 		  input:   "mouseover,mouseout", | ||||
| @@ -570,7 +528,7 @@ function loadSetImagePropsPage(tgtImage) { | ||||
|     		} | ||||
| 		}); | ||||
| 		 | ||||
| 		// Send command to change node attributes | ||||
| 		// Send command to change image attributes | ||||
|     	$.ajax( { | ||||
|     		url : 'lib/cmd.php', | ||||
|     		dataType : 'json', | ||||
| @@ -578,7 +536,7 @@ function loadSetImagePropsPage(tgtImage) { | ||||
|     			cmd : 'chdef', | ||||
|     			tgt : '', | ||||
|     			args : '-t;osimage;-o;' + tgtImage + ';' + args, | ||||
|     			msg : 'out=' + newTabId + ';node=' + tgtImage | ||||
|     			msg : 'out=' + newTabId + ';tgt=' + tgtImage | ||||
|     		}, | ||||
|  | ||||
|     		success: showChdefOutput | ||||
| @@ -597,71 +555,44 @@ function loadSetImagePropsPage(tgtImage) { | ||||
| 	setPropsForm.append(cancelBtn); | ||||
|  | ||||
| 	// Append to discover tab | ||||
| 	tab.add(newTabId, 'Properties', setPropsForm, true); | ||||
| 	tab.add(newTabId, 'Edit', setPropsForm, true); | ||||
|  | ||||
| 	// Select new tab | ||||
| 	tab.select(newTabId); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get row element that contains given image | ||||
|  *  | ||||
|  * @param tgtImage | ||||
|  *            Image to find | ||||
|  * @param rows | ||||
|  *            Rows within the datatable | ||||
|  * @return Row element | ||||
|  */ | ||||
| function getImageRow(tgtImage, rows) { | ||||
| 	// Find the row | ||||
| 	for (var i in rows) { | ||||
| 		// Get all columns within the row | ||||
| 		var cols = rows[i].children; | ||||
| 		// Get the 1st column (image name) | ||||
| 		var image = cols[1].innerHTML; | ||||
|  | ||||
| 		// If the node matches the target node | ||||
| 		if (image == tgtImage) { | ||||
| 			// Return the row | ||||
| 			return rows[i]; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Load copy CDs page | ||||
|  *  | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function loadCopyCdsPage() { | ||||
| function loadCopyLinuxPage() { | ||||
| 	// Get provision tab | ||||
| 	var tab = getProvisionTab(); | ||||
|  | ||||
| 	// Generate new tab ID | ||||
| 	var inst = 0; | ||||
| 	newTabId = 'copyCdsTab' + inst; | ||||
| 	newTabId = 'copyLinuxTab' + inst; | ||||
| 	while ($('#' + newTabId).length) { | ||||
| 		// If one already exists, generate another one | ||||
| 		inst = inst + 1; | ||||
| 		newTabId = 'copyCdsTab' + inst; | ||||
| 		newTabId = 'copyLinuxTab' + inst; | ||||
| 	} | ||||
| 	 | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Copy Linux distributions and service levels from CDs/DVDs to install directory'); | ||||
| 	var infoBar = createInfoBar('Copy Linux distributions and service levels from CDs or DVDs to the install directory.'); | ||||
|  | ||||
| 	// Create copy CDs form | ||||
| 	var copyCdsForm = $('<div class="form"></div>'); | ||||
| 	copyCdsForm.append(infoBar); | ||||
| 	// Create copy Linux form | ||||
| 	var copyLinuxForm = $('<div class="form"></div>'); | ||||
| 	copyLinuxForm.append(infoBar); | ||||
| 	 | ||||
| 	// Create file input | ||||
| 	// Create Linux distribution input | ||||
| 	var file = $('<div></div>'); | ||||
| 	var label = $('<label>File:</label>').css('vertical-align', 'middle'); | ||||
| 	var label = $('<label>Linux image:</label>').css('vertical-align', 'middle'); | ||||
| 	var input = $('<input type="text" id="file" name="file"/>').css('width', '300px'); | ||||
| 	file.append(label); | ||||
| 	file.append(input); | ||||
| 	copyCdsForm.append(file); | ||||
| 	copyLinuxForm.append(file); | ||||
| 	 | ||||
| 	// Create select button | ||||
| 	var selectBtn = createButton('Select'); | ||||
| @@ -689,16 +620,20 @@ function loadCopyCdsPage() { | ||||
| 	 | ||||
| 	// Create copy button | ||||
| 	var copyBtn = createButton('Copy'); | ||||
| 	copyCdsForm.append(copyBtn); | ||||
| 	copyLinuxForm.append(copyBtn); | ||||
| 	copyBtn.bind('click', function(event) { | ||||
| 		// Run Linux to install directory | ||||
| 		tab.remove($(this).parent().parent().attr('id')); | ||||
| 	}); | ||||
| 	 | ||||
| 	// Create cancel button | ||||
| 	var cancelBtn = createButton('Cancel'); | ||||
| 	copyCdsForm.append(cancelBtn); | ||||
| 	copyLinuxForm.append(cancelBtn); | ||||
| 	cancelBtn.bind('click', function(event) { | ||||
| 		// Close the tab | ||||
| 		tab.remove($(this).parent().parent().attr('id')); | ||||
| 	}); | ||||
|  | ||||
| 	tab.add(newTabId, 'Copy', copyCdsForm, true); | ||||
| 	tab.add(newTabId, 'Copy', copyLinuxForm, true); | ||||
| 	tab.select(newTabId); | ||||
| } | ||||
| @@ -37,7 +37,7 @@ function loadProvisionPage() { | ||||
| 	} | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Provision or re-provision a node on a selected platform'); | ||||
| 	var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.'); | ||||
| 	 | ||||
| 	// Create provision page | ||||
| 	var provPg = $('<div class="form"></div>'); | ||||
| @@ -50,7 +50,7 @@ function loadProvisionPage() { | ||||
| 	$('#content').append(tab.object()); | ||||
|  | ||||
| 	// Create radio buttons for platforms | ||||
| 	var hwList = $('<ol>Select a platform to provision on:</ol>'); | ||||
| 	var hwList = $('<ol>Platforms available:</ol>'); | ||||
| 	var ipmi = $('<li><input type="radio" name="hw" value="ipmi" checked/>ipmi</li>'); | ||||
| 	var blade = $('<li><input type="radio" name="hw" value="blade"/>blade</li>'); | ||||
| 	var hmc = $('<li><input type="radio" name="hw" value="hmc"/>hmc</li>'); | ||||
|   | ||||
| @@ -51,35 +51,35 @@ Tab.prototype.object = function() { | ||||
| /** | ||||
|  * Add a new tab | ||||
|  *  | ||||
|  * @param newTabId | ||||
|  *            New tab ID | ||||
|  * @param newTabName | ||||
|  *            New tab name | ||||
|  * @param newTabCont | ||||
|  *            New tab content | ||||
|  * @param tabId | ||||
|  *            Tab ID | ||||
|  * @param tabName | ||||
|  *            Tab name | ||||
|  * @param tabCont | ||||
|  *            Tab content | ||||
|  * @param closeable | ||||
|  * 			  New tab close button | ||||
|  * 			  Is tab closeable | ||||
|  * @return Nothing | ||||
|  */ | ||||
| Tab.prototype.add = function(newTabId, newTabName, newTabCont, closeable) { | ||||
| Tab.prototype.add = function(tabId, tabName, tabCont, closeable) { | ||||
| 	// Show tab | ||||
| 	if (this.tab.css("display") == "none") { | ||||
| 		this.tab.show(); | ||||
| 	} | ||||
|  | ||||
| 	var newTab = $('<div class="tab" id="' + newTabId + '"></div>'); | ||||
| 	newTab.append(newTabCont); | ||||
| 	var newTab = $('<div class="tab" id="' + tabId + '"></div>'); | ||||
| 	newTab.append(tabCont); | ||||
| 	this.tab.append(newTab); | ||||
| 	this.tab.tabs("add", "#" + newTabId, newTabName); | ||||
| 	this.tab.tabs("add", "#" + tabId, tabName); | ||||
| 	 | ||||
| 	// Append close button | ||||
| 	if (closeable) { | ||||
| 		var header = this.tab.find('ul.ui-tabs-nav a[href="#' + newTabId +'"]').parent(); | ||||
| 		var header = this.tab.find('ul.ui-tabs-nav a[href="#' + tabId +'"]').parent(); | ||||
| 		header.append('<span class=\"tab-close ui-icon ui-icon-close\"></span>'); | ||||
| 	 | ||||
| 		// Get this tab | ||||
| 		var tabs = this.tab; | ||||
| 		var tabLink = 'a[href="\#' + newTabId + '"]';	 | ||||
| 		var tabLink = 'a[href="\#' + tabId + '"]';	 | ||||
| 		var thisTab = $(tabLink, tabs).parent(); | ||||
| 						 | ||||
| 		// Close tab when close button is clicked | ||||
| @@ -312,7 +312,7 @@ NodesTable.prototype.remove = function(id) { | ||||
|  * @return Status bar | ||||
|  */ | ||||
| function createStatusBar(barId) { | ||||
| 	var statusBar = $('<div class="statusBar" id="' + barId + '"><div>'); | ||||
| 	var statusBar = $('<div class="ui-state-highlight ui-corner-all" id="' + barId + '"></div>').css('padding', '10px'); | ||||
| 	return statusBar; | ||||
| } | ||||
|  | ||||
| @@ -327,7 +327,6 @@ function createInfoBar(msg) { | ||||
| 	var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>'); | ||||
| 	var msg = $('<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>'); | ||||
| 	infoBar.append(msg); | ||||
|  | ||||
| 	return infoBar; | ||||
| } | ||||
|  | ||||
| @@ -342,7 +341,6 @@ function createWarnBar(msg) { | ||||
| 	var warnBar = $('<div class="ui-state-error ui-corner-all"></div>'); | ||||
| 	var msg = $('<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>'); | ||||
| 	warnBar.append(msg); | ||||
|  | ||||
| 	return warnBar; | ||||
| } | ||||
|  | ||||
| @@ -426,9 +424,7 @@ function initPage() { | ||||
| 	includeJs("js/jquery/jquery.jstree.js"); | ||||
| 	includeJs("js/jquery/jquery.flot.js"); | ||||
| 	includeJs("js/jquery/tooltip.min.js"); | ||||
| 	includeJs("js/jquery/jquery.serverBrowser.js"); | ||||
| 	includeJs("js/jquery/jquery.topzindex.min.js"); | ||||
| 	 | ||||
| 		 | ||||
| 	// Page plugins | ||||
| 	includeJs("js/configure/configure.js");	 | ||||
| 	includeJs("js/monitor/monitor.js"); | ||||
| @@ -453,6 +449,7 @@ function initPage() { | ||||
| 	// Show the page | ||||
| 	$("#content").children().remove(); | ||||
| 	if (page == 'index.php') { | ||||
| 		includeJs("js/jquery/jquery.topzindex.min.js"); | ||||
| 		includeJs("js/nodes/nodeset.js"); | ||||
| 		includeJs("js/nodes/rnetboot.js"); | ||||
| 		includeJs("js/nodes/updatenode.js"); | ||||
| @@ -466,6 +463,7 @@ function initPage() { | ||||
| 		headers.eq(1).css('background-color', '#A9D0F5'); | ||||
| 		loadConfigPage(); | ||||
| 	} else if (page == 'provision.php') { | ||||
| 		includeJs("js/jquery/jquery.serverBrowser.js"); | ||||
| 		includeJs("js/provision/images.js"); | ||||
| 		headers.eq(2).css('background-color', '#A9D0F5'); | ||||
| 		loadProvisionPage(); | ||||
| @@ -522,10 +520,11 @@ function writeRsp(rsp, pattern) { | ||||
| 			// Replace pattern with break | ||||
| 			if (pattern) { | ||||
| 				rsp[i] = rsp[i].replace(new RegExp(pattern, 'g'), '<br>'); | ||||
| 			} | ||||
| 			 | ||||
| 			prg.append(rsp[i]); | ||||
| 			prg.append('<br>');			 | ||||
| 				prg.append(rsp[i]); | ||||
| 			} else { | ||||
| 				prg.append(rsp[i]); | ||||
| 				prg.append('<br>'); | ||||
| 			}			 | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -45,10 +45,11 @@ $(document).ready(function() { | ||||
|  *  | ||||
|  * @param data | ||||
|  *            Data returned from AJAX call | ||||
|  * @param textstatus | ||||
|  * @param txtStatus | ||||
|  *            Status of login | ||||
|  * @return | ||||
|  */ | ||||
| function onlogin(data, textstatus) { | ||||
| function onlogin(data, txtStatus) { | ||||
| 	// Clear password field regardless of what happens | ||||
| 	$("#password").val(""); | ||||
| 	if (data.authenticated == "yes") { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user