Corrected spelling and grammatical mistakes. Formatted code to have a consistent format. Change color scheme to match the rest of the UI, so every page has the same 'look and feel'. Added comments into code.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9329 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -685,21 +685,22 @@ table a:hover { | ||||
|  | ||||
| /*--------------- Discovery section ---------------*/ | ||||
| .discoverstep { | ||||
| 	width: 200px; | ||||
| 	width: 220px; | ||||
| 	vertical-align: top; | ||||
| 	float: left; | ||||
| 	position: relative; | ||||
| 	overflow: auto; | ||||
| 	background-color: #CCCCFF; | ||||
| 	padding: 10px 0px 0px 5px; | ||||
| 	background-color: #A9D0F5; | ||||
| 	padding: 5px 0px; | ||||
| 	-moz-border-radius: .5em; | ||||
| 	-webkit-border-radius: .5em; | ||||
| 	border-radius: .5em; | ||||
| } | ||||
|  | ||||
| .discoverstep span { | ||||
| 	font: normal bold 13px/ 35px verdana, arial, helvetica, sans-serif; | ||||
| 	margin: 0px 0px 10px 0px; | ||||
| 	font: normal bold 12px/ 35px verdana, arial, helvetica, sans-serif; | ||||
| 	padding: 5px; | ||||
| 	margin: 0px 5px; /* Top right left bottom*/ | ||||
| } | ||||
|  | ||||
| .discovercontent { | ||||
|   | ||||
| @@ -1,13 +1,13 @@ | ||||
| /*associate the step name with step number*/ | ||||
| var steps = ['Discover Hardware',  | ||||
|              'Cluster Patterns', | ||||
|              'Supernode Numbers', | ||||
|              'More Cluster Patterns', | ||||
|              'Power On Hardware', | ||||
|              'Discover Frames', | ||||
|              'Prepare Management Node', | ||||
|              'Update Definitions', | ||||
|              'Create Lpars', | ||||
| var steps = ['Discover hardware',  | ||||
|              'Cluster patterns', | ||||
|              'Supernode numbers', | ||||
|              'More cluster patterns', | ||||
|              'Power on hardware', | ||||
|              'Discover frames', | ||||
|              'Prepare management node', | ||||
|              'Update definitions', | ||||
|              'Create LPARs', | ||||
|              'Complete']; | ||||
|  | ||||
| /*associate the function with step number*/ | ||||
| @@ -23,7 +23,7 @@ var initFunctions = [initSelectPlatform, | ||||
|                      complete]; | ||||
|  | ||||
| /*associate the function witch should be called before the page changed(when click next or back) | ||||
|  * if there is no need to call functions, use undefined.*/ | ||||
|  *if there is no need to call functions, use undefined.*/ | ||||
| var nextFunctions = [getPlatform, | ||||
|                      checkBasicPattern, | ||||
|                      checkSupernode, | ||||
| @@ -67,7 +67,7 @@ function loadDiscoverPage(){ | ||||
| function updateDiscoverStep(){ | ||||
| 	$('#discoverStepDiv').empty(); | ||||
| 	var showString = ''; | ||||
| 	for(var index in steps){ | ||||
| 	for (var index in steps){ | ||||
| 		showString += '<span'; | ||||
| 		if (currentStep == index){ | ||||
| 			showString += ' style="background-color:yellow;"'; | ||||
| @@ -101,7 +101,7 @@ function createDiscoverButtons(){ | ||||
| 		buttonDiv.append(backButton); | ||||
| 	} | ||||
| 	 | ||||
| 	if(nextButton){ | ||||
| 	if (nextButton){ | ||||
| 		buttonDiv.append(nextButton); | ||||
| 	} | ||||
|  | ||||
| @@ -244,7 +244,7 @@ function expandNR(nodeRange){ | ||||
| 		var start = Number(parts[0]); | ||||
| 		var end = Number(parts[1]); | ||||
| 		var len = parts[0].length; | ||||
| 		for(var i = parts[0]; i <= parts[1]; i++){ | ||||
| 		for (var i = parts[0]; i <= parts[1]; i++){ | ||||
| 			var ts = i.toString(); | ||||
| 			if (ts.length < len){ | ||||
| 				ts = "000000".substring(0, (len - ts.length)) + ts; | ||||
| @@ -261,25 +261,25 @@ function expandNR(nodeRange){ | ||||
| 	} | ||||
| 	 | ||||
| 	var begin = tempArray[0].match(/^(\D+)(\d+)$/); | ||||
| 	if(2 > begin){ | ||||
| 	if (2 > begin){ | ||||
| 		retArray.push(nodeRange); | ||||
| 		return retArray; | ||||
| 	} | ||||
| 	 | ||||
| 	var end = tempArray[1].match(/^(\D+)(\d+)$/); | ||||
| 	if(2 > end){ | ||||
| 	if (2 > end){ | ||||
| 		retArray.push(nodeRange); | ||||
| 		return retArray; | ||||
| 	} | ||||
| 	 | ||||
| 	if(begin[1] != end[1]){ | ||||
| 	if (begin[1] != end[1]){ | ||||
| 		retArray.push(nodeRange); | ||||
| 		return retArray; | ||||
| 	} | ||||
| 	 | ||||
| 	var prefix = begin[1]; | ||||
| 	var len = begin[2].length; | ||||
| 	for(var i = begin[2]; i <= end[2]; i++){ | ||||
| 	for (var i = begin[2]; i <= end[2]; i++){ | ||||
| 		var ts = i.toString(); | ||||
| 		if (ts.length < len){ | ||||
| 			ts = "000000".substring(0, (len - ts.length)) + ts; | ||||
| @@ -302,7 +302,7 @@ function collectInputValue(){ | ||||
| 	$('#discoverContentDiv input[type=text]').each(function(){ | ||||
| 		var name = $(this).attr('name'); | ||||
| 		var value = $(this).attr('value'); | ||||
| 		if('' != value){ | ||||
| 		if ('' != value){ | ||||
| 			setDiscoverEnv(name, value); | ||||
| 		} | ||||
| 		else{ | ||||
| @@ -514,7 +514,8 @@ function checkBasicPattern(operType){ | ||||
| 	 | ||||
| 	//the input value check is finished. | ||||
| 	if ('' != errMessage){ | ||||
| 		$('#patternDiv').prepend('<div class="ui-state-error ui-corner-all"><p>' + errMessage + '</p></div>'); | ||||
| 		var warnBar = createWarnBar(errMessage); | ||||
| 		$('#patternDiv').prepend(warnBar); | ||||
| 		return false; | ||||
| 	} | ||||
| 	 | ||||
| @@ -532,7 +533,8 @@ function checkBasicPattern(operType){ | ||||
| 	} | ||||
| 	 | ||||
| 	if ('' != errMessage){ | ||||
| 		$('#patternDiv').prepend('<div class="ui-state-error ui-corner-all"><p>' + errMessage + '</p></div>'); | ||||
| 		var warnBar = createWarnBar(errMessage); | ||||
| 		$('#patternDiv').prepend(warnBar); | ||||
| 		return false; | ||||
| 	} | ||||
| 	 | ||||
| @@ -614,8 +616,10 @@ function checkSupernode(operType){ | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	var warnBar; | ||||
| 	if (errString){ | ||||
| 		$('#supernodeDiv').prepend('<div class="ui-state-error ui-corner-all"><p>' + errString + '</p></div>'); | ||||
| 		warnBar = createWarnBar(errString); | ||||
| 		$('#supernodeDiv').prepend(warnBar); | ||||
| 		return false; | ||||
| 	} | ||||
| 	 | ||||
| @@ -623,7 +627,8 @@ function checkSupernode(operType){ | ||||
| 	if (eceNum != cecArray.length){ | ||||
| 		errString += 'The number of CEC calculated from supernode configure is ' + eceNum + ', but the number ' +  | ||||
| 					 'calculated from CECs\' Name Range is ' + cecArray.length + '. Reconfigure the supernode please.'; | ||||
| 		$('#supernodeDiv').prepend('<div class="ui-state-error ui-corner-all"><p>' + errString + '</p></div>'); | ||||
| 		warnBar = createWarnBar(errString); | ||||
| 		$('#supernodeDiv').prepend(warnBar); | ||||
| 		return false; | ||||
| 	} | ||||
| 	 | ||||
| @@ -838,7 +843,8 @@ function checkSiteTable(operType){ | ||||
| 		return true; | ||||
| 	} | ||||
| 	 | ||||
| 	$('#discoverContentDiv #siteDiv').prepend('<div class="ui-state-error ui-corner-all"><p>' + errMessage + '</p></div>'); | ||||
| 	var warnBar = createWarnBar(errMessage); | ||||
| 	$('#discoverContentDiv #siteDiv').prepend(warnBar); | ||||
| 	return false; | ||||
| } | ||||
|  | ||||
| @@ -931,6 +937,7 @@ function initDiscoverFrames(){ | ||||
| 						frameArray[i] + '</span></p>'); | ||||
| 				 | ||||
| 			} | ||||
| 			 | ||||
| 			for (var i in mtmsArray){ | ||||
| 				$('#mtmsTd').append('<p><input name="mtmsradio" type="radio" onclick="createMap(this)"><span>' +  | ||||
| 						mtmsArray[i] + '</span></p>'); | ||||
| @@ -1003,8 +1010,8 @@ function checkFrameMtms(operType){ | ||||
| 	var vpdFileCon = ''; | ||||
| 	$('#discoverShow .ui-state-error').remove(); | ||||
| 	if (0 < $('#discoverShow :radio').size()){ | ||||
| 		$('#discoverContentDiv #discoverShow').prepend('<div class="ui-state-error ui-corner-all"><p>' +  | ||||
| 				'Map all of the frame with mtms.</p></div>'); | ||||
| 		var warnBar = createWarnBar('Map all of the frame with mtms.'); | ||||
| 		$('#discoverContentDiv #discoverShow').prepend(warnBar); | ||||
| 		return false; | ||||
| 	} | ||||
| 	 | ||||
| @@ -1284,12 +1291,12 @@ function lsslpWriteHMC(){ | ||||
| 			var mtmsArray = data.rsp[0].split(';'); | ||||
| 			var tempPar = ''; | ||||
| 			 | ||||
| 			if(hmcArray.length != mtmsArray.length){ | ||||
| 			if (hmcArray.length != mtmsArray.length){ | ||||
| 				//error info | ||||
| 				$('#hmcLine2 img').remove(); | ||||
| 				$('#discoverContentDiv div').append('<div class="ui-state-error ui-corner-all"><p>' + | ||||
| 						'Error: Defined ' + hmcArray.length  + ' hmcs, but discovered ' + mtmsArray.length +  | ||||
| 						' hmcs. Check the configuration please.</p></div>'); | ||||
| 				var warnBar = createWarnBar('Error: Defined ' + hmcArray.length  + ' HMCs, but discovered ' + mtmsArray.length +  | ||||
| 					' HMCs. Please check the configuration.'); | ||||
| 				$('#discoverContentDiv div').prepend(warnBar); | ||||
| 				createDiscoverButtons(); | ||||
| 				return; | ||||
| 			} | ||||
| @@ -1423,13 +1430,13 @@ function ihCreateLpar(parentDiv){ | ||||
| 		var inputStr = getDiscoverEnv('partconf'); | ||||
| 		var testArray = reg.exec(inputStr); | ||||
| 		if (!testArray || inputStr != testArray[0]){ | ||||
| 			$('#discoverContentDiv').prepend('<div class="ui-state-error ui-corner-all">' +  | ||||
| 	                 '<p>Input the correct configuration rule.</p></div>'); | ||||
| 			var warnBar = createWarnBar('Input the correct configuration rule.'); | ||||
| 			$('#discoverContentDiv').prepend(warnBar); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		var ruleArray = inputStr.split(','); | ||||
| 		for(var i in ruleArray){ | ||||
| 		for (var i in ruleArray){ | ||||
| 			var octantCount = 0; | ||||
| 			var octantArray = ruleArray[i].split(':'); | ||||
| 			var octantRule = Number(octantArray[1]); | ||||
| @@ -1450,10 +1457,10 @@ function ihCreateLpar(parentDiv){ | ||||
| 			lparCount += octantCount * octantRule; | ||||
| 		} | ||||
| 		 | ||||
| 		if(getDiscoverEnv('lparNumPerCec') != lparCount){ | ||||
| 			$('#discoverContentDiv').prepend('<div class="ui-state-error ui-corner-all">' +  | ||||
|             	'<p>The Lpar number per CEC is ' + getDiscoverEnv('lparNumPerCec') + ', but the configuration ' + | ||||
|             	'rule calculation is ' + lparCount + '.</p></div>'); | ||||
| 		if (getDiscoverEnv('lparNumPerCec') != lparCount){ | ||||
| 			var warnBar = createWarnBar('The LPAR number per CEC is ' + getDiscoverEnv('lparNumPerCec') + ', but the configuration ' + | ||||
|             	'rule calculation is ' + lparCount + '.'); | ||||
| 			$('#discoverContentDiv').prepend(warnBar); | ||||
| 			return; | ||||
| 		} | ||||
| 		 | ||||
| @@ -1508,13 +1515,15 @@ function updateCreateLparDia(cecname, cecNum){ | ||||
| 		$('#createLparDiv').remove(); | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| function nonihCreateLpar(parentDiv){ | ||||
| 	var showStr = 'The machine type is not P7 IH, so you had to create lpars by command line manually.'; | ||||
| 	parentDiv.append(createInfoBar(showStr)); | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Step 10: compelte | ||||
|  * Step 10: complete | ||||
|  *           | ||||
|  * @param  | ||||
|  *  | ||||
| @@ -1528,5 +1537,4 @@ function complete(){ | ||||
| 	$('#discoverContentDiv').append(showStr); | ||||
| 	 | ||||
| 	createDiscoverButtons(); | ||||
|  | ||||
| } | ||||
| @@ -10,7 +10,7 @@ function loadUpdatePage() { | ||||
| 	statusDiv.hide(); | ||||
|  | ||||
| 	$('#updateTab').append(statusDiv); | ||||
| 	$('#updateTab').append('<br>'); | ||||
| 	$('#updateTab').append('<br/>'); | ||||
| 	$('#updateTab').append(repositoryDiv); | ||||
| 	$('#updateTab').append(rpmDiv); | ||||
|  | ||||
| @@ -52,7 +52,7 @@ function showRepository(data) { | ||||
| 	var stableRepository = ""; | ||||
| 	var show = ""; | ||||
|  | ||||
| 	// get the corresponding repository by OS Type | ||||
| 	// 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/"; | ||||
| @@ -63,28 +63,30 @@ function showRepository(data) { | ||||
|  | ||||
| 	var repoList = $('<ol></ol>'); | ||||
|  | ||||
| 	// display the Devel Repository, remember user's last selection | ||||
| 	// Display the Devel Repository, remember user's last selection | ||||
| 	show = show + "<li><input type='radio' "; | ||||
| 	if (1 == $.cookie('xcatrepository')) { | ||||
| 		show = show + "checked='true'"; | ||||
| 	} | ||||
| 	show = show + "name='reporadio' value='" + develRepository + "'>"; | ||||
| 	show = show + develRepository + "(<strong>Devel</strong>)</li>"; | ||||
| 	show = show + "<strong>Development</strong>: " + develRepository + "</li>"; | ||||
| 	repoList.append(show); | ||||
|  | ||||
| 	// display the Stable Repository, remember user's last selection | ||||
| 	// Display the Stable Repository, remember user's last selection | ||||
| 	show = "<li><input type='radio' "; | ||||
| 	if (2 == $.cookie('xcatrepository')) { | ||||
| 		show = show + "checked='true'"; | ||||
| 	} | ||||
| 	show = show + "name='reporadio' value='" + stableRepository + "'>"; | ||||
| 	show = show + stableRepository + "(<strong>Stable</strong>)</li>"; | ||||
| 	show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>"; | ||||
| 	show = show + "<strong>Stable</strong>: " + stableRepository + "</li>"; | ||||
| 	repoList.append(show); | ||||
|  | ||||
| 	// display the Input Repository, remember user's last selection | ||||
| 	if (($.cookie('xcatrepository')) && (1 != $.cookie('xcatrepository')) && (2 != $.cookie('xcatrepository'))) { | ||||
| 	// 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 += "<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>"; | ||||
| @@ -103,7 +105,8 @@ function showRepository(data) { | ||||
| function showRpmInfo(data) { | ||||
| 	var rpms = null; | ||||
| 	var show = ""; | ||||
| 	var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc", "xCAT-UI"); | ||||
| 	var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc", | ||||
| 			"xCAT-UI"); | ||||
| 	var temp = 0; | ||||
| 	if (null == data.rsp) { | ||||
| 		$('#rpm fieldset').append("Error getting RPMs!"); | ||||
| @@ -111,13 +114,13 @@ function showRpmInfo(data) { | ||||
| 	} | ||||
|  | ||||
| 	rpms = data.rsp.split(/\n/); | ||||
| 	// no rpm installed, return | ||||
| 	// No rpm installed, return | ||||
| 	if (1 > rpms.length) { | ||||
| 		$('#rpm fieldset').append("No RPMs installed!"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	// clear the old data | ||||
| 	// Clear the old data | ||||
| 	$('#rpm fieldset').children().remove(); | ||||
| 	$('#rpm fieldset').append("<legend>xCAT RPMs</legend>"); | ||||
| 	show = "<table id=rpmtable >"; | ||||
| @@ -126,27 +129,28 @@ function showRpmInfo(data) { | ||||
| 	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 | ||||
| 		// Empty line continue | ||||
| 		if ("" == rpms[temp]) { | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		// the rpm is not installed, continue | ||||
| 		// The RPM is not installed, continue | ||||
| 		if (-1 != rpms[temp].indexOf("not")) { | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		// show the version in table | ||||
| 		// 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 += "<td>" + rpmNames[temp] + "</td><td>" | ||||
| 				+ rpms[temp].substr(rpmNames[temp].length + 1) + "</td>"; | ||||
| 		show += "</tr>"; | ||||
| 	} | ||||
| 	show += "</table>"; | ||||
| 	show += "<br\>"; | ||||
| 	$('#rpm fieldset').append(show); | ||||
|  | ||||
| 	// add the update button | ||||
| 	// Add the update button | ||||
| 	var updateButton = createButton('Update'); | ||||
| 	$('#rpm fieldset').append(updateButton); | ||||
| 	updateButton.bind('click', function() { | ||||
| @@ -157,6 +161,7 @@ function showRpmInfo(data) { | ||||
| /** | ||||
|  * Select all checkboxes | ||||
|  *  | ||||
|  * @param Nothing | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function updateSelectAll() { | ||||
| @@ -182,7 +187,7 @@ function updateRpm() { | ||||
| 		rpmPath = ""; | ||||
| 	} | ||||
|  | ||||
| 	// select other and we should use the value in the input | ||||
| 	// Select other and we should use the value in the input | ||||
| 	if ("" == rpmPath) { | ||||
| 		// user input the repo, and we must stroe it in the cookie | ||||
| 		rpmPath = $('#repositoryaddr').val(); | ||||
| @@ -219,7 +224,7 @@ function updateRpm() { | ||||
| 	} | ||||
|  | ||||
| 	if (!rpmPath) { | ||||
| 		errMsg += "Please select or input a repository!"; | ||||
| 		errMsg += "Please select or specify a repository!"; | ||||
| 	} | ||||
|  | ||||
| 	if (!rpms || !rpmPath) { | ||||
| @@ -229,7 +234,7 @@ function updateRpm() { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	// remember users' choice and input | ||||
| 	// Remember users' choice and input | ||||
| 	$.cookie('xcatrepository', rpmPathType, { | ||||
| 		path : '/xcat', | ||||
| 		expires : 10 | ||||
| @@ -241,7 +246,7 @@ function updateRpm() { | ||||
| 	$('#update').append("<img id='loadingpic' src='images/loader.gif'>"); | ||||
| 	$('#rpm button').attr('disabled', 'true'); | ||||
|  | ||||
| 	// send the update command to server | ||||
| 	// Send the update command to server | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/cmd.php', | ||||
| 		dataType : 'json', | ||||
| @@ -252,7 +257,7 @@ function updateRpm() { | ||||
| 			msg : '' | ||||
| 		}, | ||||
|  | ||||
| 		success : ShowUpdateResult | ||||
| 		success : showUpdateResult | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| @@ -263,7 +268,7 @@ function updateRpm() { | ||||
|  *            Data returned from HTTP request | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function ShowUpdateResult(data) { | ||||
| function showUpdateResult(data) { | ||||
| 	var temp = 0; | ||||
| 	$('#loadingpic').remove(); | ||||
|  | ||||
| @@ -271,16 +276,16 @@ function ShowUpdateResult(data) { | ||||
| 	if (0 < resArray.length) { | ||||
| 		// Show last lines | ||||
| 		if (('' == resArray[resArray.length - 1]) && (resArray.length > 1)) { | ||||
| 			$('#update').append(resArray[resArray.length - 2]); | ||||
| 			$('#update').append('<pre>' + resArray[resArray.length - 2] + '</pre>'); | ||||
| 		} else { | ||||
| 			$('#update').append(resArray[resArray.length - 1]); | ||||
| 			$('#update').append('<pre>' + resArray[resArray.length - 1] + '</pre>'); | ||||
| 		} | ||||
|  | ||||
| 		// Create link to show details | ||||
| 		$('#update').append('<br/><a>Show details</a>'); | ||||
| 		$('#update a').css({ | ||||
| 			'color': '#0000FF', | ||||
| 			'cursor': 'pointer' | ||||
| 		$('#update a').css( { | ||||
| 			'color' : '#0000FF', | ||||
| 			'cursor' : 'pointer' | ||||
| 		}).bind('click', function() { | ||||
| 			// Toggle details and change text | ||||
| 			$('#resDetail').toggle(); | ||||
| @@ -291,15 +296,15 @@ function ShowUpdateResult(data) { | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
| 		var resDetail = $('<div id="resDetail"></div>'); | ||||
| 		var resDetail = $('<pre id="resDetail"></pre>'); | ||||
| 		resDetail.hide(); | ||||
| 		$('#update').append(resDetail); | ||||
| 		for (temp = 0; temp < resArray.length; temp++) { | ||||
| 			resDetail.append(resArray[temp] + "<br>"); | ||||
| 			resDetail.append(resArray[temp] + '<br/>'); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// update the rpm info | ||||
| 	// Update the rpm info | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/systemcmd.php', | ||||
| 		dataType : 'json', | ||||
|   | ||||
| @@ -40,7 +40,7 @@ hmcPlugin.prototype.loadInventory = function(data) { | ||||
|  | ||||
| 	// Loop through each line | ||||
| 	var fieldSet, legend, oList, item; | ||||
| 	for ( var k = 0; k < inv.length; k++) { | ||||
| 	for (var k = 0; k < inv.length; k++) { | ||||
| 		// Remove node name in front | ||||
| 		var str = inv[k].replace(node + ': ', ''); | ||||
| 		str = jQuery.trim(str); | ||||
| @@ -106,7 +106,7 @@ hmcPlugin.prototype.loadClonePage = function(node) { | ||||
| 		// Add clone tab | ||||
| 		tab.add(newTabId, 'Clone', cloneForm, true); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	tab.select(newTabId); | ||||
| }; | ||||
|  | ||||
| @@ -119,8 +119,8 @@ hmcPlugin.prototype.loadClonePage = function(node) { | ||||
|  */ | ||||
| hmcPlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 	// Get OS image names | ||||
| 	if (!$.cookie('imagenames')){ | ||||
| 		$.ajax( { | ||||
| 	if (!$.cookie('imagenames')) { | ||||
| 		$.ajax({ | ||||
| 			url : 'lib/cmd.php', | ||||
| 			dataType : 'json', | ||||
| 			data : { | ||||
| @@ -135,7 +135,7 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 	} | ||||
|  | ||||
| 	// Get groups | ||||
| 	if (!$.cookie('groups')){ | ||||
| 	if (!$.cookie('groups')) { | ||||
| 		$.ajax( { | ||||
| 			url : 'lib/cmd.php', | ||||
| 			dataType : 'json', | ||||
| @@ -174,17 +174,9 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 	// Create provision type drop down | ||||
| 	provForm.append('<div><label>Provision:</label><select><option value="existing">Existing node</option></select></div>'); | ||||
|  | ||||
| 	/** | ||||
| 	 * Create provision new node division | ||||
| 	 */ | ||||
| 	// You should copy whatever is in this function, put it here, and customize it | ||||
| 	//var provNew = createProvisionNew('hmc', inst); | ||||
| 	//provForm.append(provNew); | ||||
|  | ||||
| 	/** | ||||
| 	 * Create provision existing node division | ||||
| 	 */ | ||||
| 	// You should copy whatever is in this function, put it here, and customize it | ||||
| 	provForm.append(createHmcProvisionExisting(inst)); | ||||
|  | ||||
| 	var hmcProvisionBtn = createButton('Provision'); | ||||
| @@ -192,48 +184,48 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 		// Remove any warning messages | ||||
| 		var tempTab = $(this).parent().parent(); | ||||
| 		tempTab.find('.ui-state-error').remove(); | ||||
| 		 | ||||
|  | ||||
| 		var ready = true; | ||||
| 		var errMsg = ''; | ||||
| 		var tempNodes = ''; | ||||
| 		 | ||||
|  | ||||
| 		// Get nodes that were checked | ||||
| 		tempNodes = getCheckedByObj(tempTab.find('table')); | ||||
| 		if ('' == tempNodes){ | ||||
| 		if ('' == tempNodes) { | ||||
| 			errMsg += 'You need to select a node.<br>'; | ||||
| 			ready = false; | ||||
| 		} | ||||
| 		else{ | ||||
| 		} else { | ||||
| 			tempNodes = tempNodes.substr(0, tempNodes.length - 1); | ||||
| 		} | ||||
| 		 | ||||
|  | ||||
| 		// If all inputs are valid, ready to provision | ||||
| 		if (ready) {			 | ||||
| 		if (ready) { | ||||
| 			// Disable provision button | ||||
| 			$(this).attr('disabled', 'true'); | ||||
| 			 | ||||
|  | ||||
| 			// Show loader | ||||
| 			tempTab.find('#statBar').show(); | ||||
| 			tempTab.find('#loader').show(); | ||||
|  | ||||
| 			// Disable all selects, input and checkbox | ||||
| 			tempTab.find('input').attr('disabled', 'disabled'); | ||||
| 						 | ||||
|  | ||||
| 			// Get operating system image | ||||
| 			var os = tempTab.find('#osname').val(); | ||||
| 			var arch = tempTab.find('#arch').val(); | ||||
| 			var profile = tempTab.find('#pro').val(); | ||||
| 									 | ||||
|  | ||||
| 			/** | ||||
| 			 * (1) Set operating system | ||||
| 			 */ | ||||
| 			$.ajax( { | ||||
| 			$.ajax({ | ||||
| 				url : 'lib/cmd.php', | ||||
| 				dataType : 'json', | ||||
| 				data : { | ||||
| 					cmd : 'nodeadd', | ||||
| 					tgt : '', | ||||
| 					args : tempNodes + ';noderes.netboot=yaboot;nodetype.os=' + os + ';nodetype.arch=' + arch + ';nodetype.profile=' + profile, | ||||
| 					args : tempNodes + ';noderes.netboot=yaboot;nodetype.os=' + os | ||||
| 							+ ';nodetype.arch=' + arch + ';nodetype.profile=' + profile, | ||||
| 					msg : 'cmd=nodeadd;out=' + tempTab.attr('id') | ||||
| 				}, | ||||
|  | ||||
| @@ -246,22 +238,22 @@ hmcPlugin.prototype.loadProvisionPage = function(tabId) { | ||||
| 		} | ||||
| 	}); | ||||
| 	provForm.append(hmcProvisionBtn); | ||||
| 	 | ||||
| 	// update the node table on group select  | ||||
| 	provForm.find('#groupname').bind('change', function(){ | ||||
|  | ||||
| 	// Update the node table on group select | ||||
| 	provForm.find('#groupname').bind('change', function() { | ||||
| 		var groupName = $(this).val(); | ||||
| 		var nodeArea = $('#hmcSelectNodesTable' + inst); | ||||
| 		nodeArea.empty(); | ||||
| 		if (!groupName){ | ||||
| 		if (!groupName) { | ||||
| 			nodeArea.html('Select a group to view its nodes'); | ||||
| 			return; | ||||
| 		} | ||||
| 		 | ||||
|  | ||||
| 		nodeArea.append(createLoader()); | ||||
| 		createNodesArea(groupName, 'hmcSelectNodesTable'+ inst); | ||||
| 		createNodesArea(groupName, 'hmcSelectNodesTable' + inst); | ||||
| 	}); | ||||
| 	// Toggle provision new/existing on select | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Load resources | ||||
|  *  | ||||
| @@ -272,14 +264,14 @@ hmcPlugin.prototype.loadResources = function() { | ||||
| 	var tabId = 'hmcResourceTab'; | ||||
| 	// Remove loader | ||||
| 	$('#' + tabId).find('img').remove(); | ||||
| 	 | ||||
|  | ||||
| 	// Create info bar | ||||
| 	var infoBar = createInfoBar('Under construction'); | ||||
|  | ||||
| 	// Create resource form | ||||
| 	var resrcForm = $('<div class="form"></div>'); | ||||
| 	resrcForm.append(infoBar); | ||||
| 	 | ||||
|  | ||||
| 	$('#' + tabId).append(resrcForm); | ||||
| }; | ||||
|  | ||||
| @@ -295,95 +287,92 @@ hmcPlugin.prototype.addNode = function() { | ||||
| /** | ||||
|  * Create hmc provision existing form | ||||
|  *  | ||||
|  * @return: form content | ||||
|  * @return: Form content | ||||
|  */ | ||||
| function createHmcProvisionExisting(inst){ | ||||
| 	//create the group area. | ||||
| function createHmcProvisionExisting(inst) { | ||||
| 	// Create the group area | ||||
| 	var strGroup = '<div><label>Group:</label>'; | ||||
| 	var groupNames = $.cookie('groups'); | ||||
| 	if (groupNames){ | ||||
| 	if (groupNames) { | ||||
| 		strGroup += '<select id="groupname"><option></option>'; | ||||
| 		var temp = groupNames.split(','); | ||||
| 		for (var i in temp){ | ||||
| 		for (var i in temp) { | ||||
| 			strGroup += '<option value="' + temp[i] + '">' + temp[i] + '</option>'; | ||||
| 		} | ||||
| 		strGroup += '</select>'; | ||||
| 	} | ||||
| 	else{ | ||||
| 	} else { | ||||
| 		strGroup += '<input type="text" id="groupname">'; | ||||
| 	} | ||||
| 	strGroup += '</div>'; | ||||
| 	 | ||||
| 	//create nodes area | ||||
| 	var strNodes = '<div><label>Nodes:</label><div id="hmcSelectNodesTable' + inst +  | ||||
| 				  '" style="display:inline-block;width:700px;overflow-y:auto;">Select a group to view its nodes</div></div>'; | ||||
| 	 | ||||
| 	//create boot method | ||||
| 	var strBoot = '<div><label>Boot Method:</label><select id="boot">' +  | ||||
| 				'<option value="install">install</option>' +  | ||||
| 				'<option value="netboot">netboot</option>' + | ||||
| 				'<option value="statelite">statelite</option></select></div>'; | ||||
| 	 | ||||
|  | ||||
| 	// Create nodes area | ||||
| 	var strNodes = '<div><label>Nodes:</label><div id="hmcSelectNodesTable' | ||||
| 			+ inst | ||||
| 			+ '" style="display:inline-block;width:700px;overflow-y:auto;">Select a group to view its nodes</div></div>'; | ||||
|  | ||||
| 	// Create boot method | ||||
| 	var strBoot = '<div><label>Boot Method:</label><select id="boot">' | ||||
| 			+ '<option value="install">install</option>' | ||||
| 			+ '<option value="netboot">netboot</option>' | ||||
| 			+ '<option value="statelite">statelite</option></select></div>'; | ||||
|  | ||||
| 	// Create operating system | ||||
| 	var strOs = '<div><label>Operating system:</label>'; | ||||
| 	var osName = $.cookie('osvers'); | ||||
| 	if (osName){ | ||||
| 	if (osName) { | ||||
| 		strOs += '<select id="osname">'; | ||||
| 		var temp = osName.split(','); | ||||
| 		for (var i in temp){ | ||||
| 		for (var i in temp) { | ||||
| 			strOs += '<option value="' + temp[i] + '">' + temp[i] + '</option>'; | ||||
| 		} | ||||
| 		strOs += '</select>'; | ||||
| 	} | ||||
| 	else{ | ||||
| 	} else { | ||||
| 		strOs += '<input type="text" id="osname">'; | ||||
| 	} | ||||
| 	strOs += '</div>'; | ||||
| 	 | ||||
| 	//create architecture | ||||
|  | ||||
| 	// Create architecture | ||||
| 	var strArch = '<div><label>Architecture:</label>'; | ||||
| 	var archName = $.cookie('osarchs'); | ||||
| 	if ('' != archName){ | ||||
| 	if ('' != archName) { | ||||
| 		strArch += '<select id="arch">'; | ||||
| 		var temp = archName.split(','); | ||||
| 		for (var i in temp){ | ||||
| 		for (var i in temp) { | ||||
| 			strArch += '<option value="' + temp[i] + '">' + temp[i] + '</option>'; | ||||
| 		} | ||||
| 		strArch += '</select>'; | ||||
| 	} | ||||
| 	else{ | ||||
| 	} else { | ||||
| 		strArch += '<input type="text" id="arch">'; | ||||
| 	} | ||||
| 	strArch += '</div>'; | ||||
| 	 | ||||
| 	//create profile  | ||||
|  | ||||
| 	// Create profile | ||||
| 	var strPro = '<div><label>Profile:</label>'; | ||||
| 	var proName = $.cookie('profiles'); | ||||
| 	if ('' != proName){ | ||||
| 	if ('' != proName) { | ||||
| 		strPro += '<select id="pro">'; | ||||
| 		var temp = proName.split(','); | ||||
| 		for (var i in temp){ | ||||
| 		for (var i in temp) { | ||||
| 			strPro += '<option value="' + temp[i] + '">' + temp[i] + '</option>'; | ||||
| 		} | ||||
| 		strPro += '</select>'; | ||||
| 	} | ||||
| 	else{ | ||||
| 	} else { | ||||
| 		strPro += '<input type="text" id="pro">'; | ||||
| 	} | ||||
| 	strPro += '</div>'; | ||||
| 	 | ||||
|  | ||||
| 	var strRet = strGroup + strNodes + strBoot + strOs + strArch + strPro; | ||||
| 	return strRet; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * refresh the nodes area base on group selected | ||||
|  * Refresh the nodes area base on group selected | ||||
|  *  | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function createNodesArea(groupName, areaId){ | ||||
| function createNodesArea(groupName, areaId) { | ||||
| 	// Get group nodes | ||||
| 	$.ajax( { | ||||
| 	$.ajax({ | ||||
| 		url : 'lib/cmd.php', | ||||
| 		dataType : 'json', | ||||
| 		data : { | ||||
| @@ -406,19 +395,19 @@ function createNodesArea(groupName, areaId){ | ||||
| 			var index; | ||||
| 			var showStr = '<table><thead><tr><th><input type="checkbox" onclick="selectAllCheckbox(event, $(this))"></th>'; | ||||
| 			showStr += '<th>Node</th></tr></thead><tbody>'; | ||||
| 			for (index in nodes){ | ||||
| 			for (index in nodes) { | ||||
| 				var node = nodes[index][0]; | ||||
| 				if ('' == node){ | ||||
| 				if ('' == node) { | ||||
| 					continue; | ||||
| 				} | ||||
| 				showStr += '<tr><td><input type="checkbox" name="' + node + '"/></td><td>' + node + '</td></tr>'; | ||||
| 				showStr += '<tr><td><input type="checkbox" name="' + node + '"/></td><td>' | ||||
| 						+ node + '</td></tr>'; | ||||
| 			} | ||||
| 			showStr += '</tbody></table>'; | ||||
| 			areaObj.empty().append(showStr); | ||||
| 			if (index > 10){ | ||||
| 			if (index > 10) { | ||||
| 				areaObj.css('height', '300px'); | ||||
| 			} | ||||
| 			else{ | ||||
| 			} else { | ||||
| 				areaObj.css('height', 'auto'); | ||||
| 			} | ||||
| 		} // End of function(data) | ||||
| @@ -426,11 +415,11 @@ function createNodesArea(groupName, areaId){ | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * provision for existing system p node | ||||
|  * Provision for existing system p node | ||||
|  *  | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function pProvisionExisting(data){ | ||||
| function pProvisionExisting(data) { | ||||
| 	// Get ajax response | ||||
| 	var rsp = data.rsp; | ||||
| 	var args = data.msg.split(';'); | ||||
| @@ -439,21 +428,22 @@ function pProvisionExisting(data){ | ||||
| 	var cmd = args[0].replace('cmd=', ''); | ||||
| 	// Get provision tab instance | ||||
| 	var tabId = args[1].replace('out=', ''); | ||||
| 	 | ||||
| 	//get tab obj | ||||
|  | ||||
| 	// Get tab obj | ||||
| 	var tempTab = $('#' + tabId); | ||||
|  | ||||
| 	/** | ||||
| 	 * (2) Prepare node for boot | ||||
| 	 */ | ||||
| 	if (cmd == 'nodeadd') { | ||||
| 		// Get operating system | ||||
| 		var bootMethod = tempTab.find('#boot').val(); | ||||
| 		 | ||||
|  | ||||
| 		// Get nodes that were checked | ||||
| 		var tgts = getCheckedByObj(tempTab.find('table')); | ||||
| 		 | ||||
|  | ||||
| 		// Prepare node for boot | ||||
| 		$.ajax( { | ||||
| 		$.ajax({ | ||||
| 			url : 'lib/cmd.php', | ||||
| 			dataType : 'json', | ||||
| 			data : { | ||||
| @@ -465,14 +455,14 @@ function pProvisionExisting(data){ | ||||
|  | ||||
| 			success : pProvisionExisting | ||||
| 		}); | ||||
| 	}  | ||||
| 	 | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * (3) Boot node from network | ||||
| 	 */ | ||||
| 	else if (cmd == 'nodeset') { | ||||
| 		// Write ajax response to status bar | ||||
| 		var prg = writeRsp(rsp, '');	 | ||||
| 		var prg = writeRsp(rsp, ''); | ||||
| 		tempTab.find('#statBar').append(prg); | ||||
|  | ||||
| 		// If there was an error, do not continue | ||||
| @@ -480,12 +470,12 @@ function pProvisionExisting(data){ | ||||
| 			tempTab.find('#loader').remove(); | ||||
| 			return; | ||||
| 		} | ||||
| 				 | ||||
|  | ||||
| 		// Get nodes that were checked | ||||
| 		var tgts = getCheckedByObj(tempTab.find('table')); | ||||
| 		 | ||||
|  | ||||
| 		// Boot node from network | ||||
| 		$.ajax( { | ||||
| 		$.ajax({ | ||||
| 			url : 'lib/cmd.php', | ||||
| 			dataType : 'json', | ||||
| 			data : { | ||||
| @@ -497,36 +487,34 @@ function pProvisionExisting(data){ | ||||
|  | ||||
| 			success : pProvisionExisting | ||||
| 		}); | ||||
| 	}  | ||||
| 	 | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * (4) Done | ||||
| 	 */ | ||||
| 	else if (cmd == 'rnetboot') { | ||||
| 		// Write ajax response to status bar | ||||
| 		var prg = writeRsp(rsp, '');	 | ||||
| 		var prg = writeRsp(rsp, ''); | ||||
| 		tempTab.find('#statBar').append(prg); | ||||
| 		 | ||||
| 		tempTab.find('#loader').remove(); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * get all select elements' name in the obj,  | ||||
|  * Get all select elements' name in the obj | ||||
|  *  | ||||
|  * @return all nodes name, seperate by ',' | ||||
|  * @return All nodes name, seperate by ',' | ||||
|  */ | ||||
| function getCheckedByObj(obj){ | ||||
| function getCheckedByObj(obj) { | ||||
| 	var tempStr = ''; | ||||
| 	// Get nodes that were checked | ||||
| 	obj.find('input:checked').each(function(){ | ||||
| 		if($(this).attr('name')){ | ||||
| 	obj.find('input:checked').each(function() { | ||||
| 		if ($(this).attr('name')) { | ||||
| 			tempStr += $(this).attr('name') + ','; | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
| 	if ('' != tempStr){ | ||||
|  | ||||
| 	if ('' != tempStr) { | ||||
| 		tempStr = tempStr.substr(0, tempStr.length - 1); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -153,14 +153,14 @@ function xcatrmcRpmCheck(){ | ||||
| 			var needHelp = false; | ||||
| 			$('#rmcMonStatus').empty(); | ||||
| 			//check the xcat-rmc | ||||
| 			if(-1 != softInstallStatus[0].indexOf("not")){ | ||||
| 			if (-1 != softInstallStatus[0].indexOf("not")){ | ||||
| 				needHelp = true; | ||||
| 				$('#rmcMonStatus').append( | ||||
| 				'Please install the <a href="http://xcat.sourceforge.net/#download" target="install_window">xCAT-rmc</a> first.<br/>'); | ||||
| 			} | ||||
| 			 | ||||
| 			//check the rrdtool | ||||
| 			if(-1 != softInstallStatus[1].indexOf("not")){ | ||||
| 			if (-1 != softInstallStatus[1].indexOf("not")){ | ||||
| 				needHelp = true; | ||||
| 				$('#rmcMonStatus').append( | ||||
| 					'Please install the <a href="http://oss.oetiker.ch/rrdtool/download.en.html" target="install_window">RRD-tool</a> first.<br/>'); | ||||
| @@ -357,8 +357,8 @@ function showDetail(){ | ||||
| 	$('#rmcmonDetail').append(detailFilter); | ||||
| 	 | ||||
| 	select = $('<select id="metric"></select>'); | ||||
| 	for(var node in globalNodesDetail){ | ||||
| 		for(var attr in globalNodesDetail[node]){ | ||||
| 	for (var node in globalNodesDetail){ | ||||
| 		for (var attr in globalNodesDetail[node]){ | ||||
| 			select.append('<option value="' + attr + '">' + attr + '</option>'); | ||||
| 		} | ||||
| 		break; | ||||
| @@ -468,7 +468,6 @@ function showNode(nodeName){ | ||||
| 		$('#rmcmonDetail').show(); | ||||
| 	}); | ||||
|  | ||||
| 	 | ||||
| 	$('#nodeDetail').append(nodeTable); | ||||
| 	 | ||||
| 	for(var attr in globalNodesDetail[nodeName]){ | ||||
| @@ -497,18 +496,18 @@ function showNode(nodeName){ | ||||
| function filterSort(attrName, sortType, retArray){ | ||||
| 	var tempObj = {}; | ||||
| 	 | ||||
| 	for(var node in globalNodesDetail){ | ||||
| 	for (var node in globalNodesDetail){ | ||||
| 		tempObj['name'] = node;  | ||||
| 		tempObj['value'] = globalNodesDetail[node][attrName]; | ||||
| 		retArray.push(tempObj); | ||||
| 	} | ||||
| 	 | ||||
| 	//by node name | ||||
| 	if(3 == sortType){ | ||||
| 	if (3 == sortType){ | ||||
| 		retArray.sort(sortName); | ||||
| 	} | ||||
| 	//desend | ||||
| 	else if(2 == sortType){ | ||||
| 	else if (2 == sortType){ | ||||
| 		retArray.sort(sortDes); | ||||
| 	} | ||||
| 	//ascend | ||||
| @@ -520,7 +519,7 @@ function filterSort(attrName, sortType, retArray){ | ||||
| } | ||||
|  | ||||
| function sortAsc(x, y){ | ||||
| 	if(x['value'] > y['value']){ | ||||
| 	if (x['value'] > y['value']){ | ||||
| 		return 1; | ||||
| 	} | ||||
| 	else{ | ||||
| @@ -529,7 +528,7 @@ function sortAsc(x, y){ | ||||
| } | ||||
|  | ||||
| function sortDes(x, y){ | ||||
| 	if(x['value'] > y['value']){ | ||||
| 	if (x['value'] > y['value']){ | ||||
| 		return -1; | ||||
| 	} | ||||
| 	else{ | ||||
| @@ -538,7 +537,7 @@ function sortDes(x, y){ | ||||
| } | ||||
|  | ||||
| function sortName(x, y){ | ||||
| 	if(x['name'] > y['name']){ | ||||
| 	if (x['name'] > y['name']){ | ||||
| 		return 1; | ||||
| 	} | ||||
| 	else{ | ||||
| @@ -560,7 +559,7 @@ function showConfigureDia(){ | ||||
| 	for (var i in wholeAttrArray){ | ||||
| 		var name = wholeAttrArray[i]; | ||||
| 		var tempString = '<tr>'; | ||||
| 		if(selectedAttrHash[name]){ | ||||
| 		if (selectedAttrHash[name]){ | ||||
| 			tempString += '<td><input type="checkbox" name="' + name + '" checked="checked"></td>'; | ||||
| 		} | ||||
| 		else{ | ||||
| @@ -599,7 +598,7 @@ function showConfigureDia(){ | ||||
| 		 			//collect all attibutes' name | ||||
| 		 			var str = ''; | ||||
| 		 			$('#rmcAttrTable input:checked').each(function(){ | ||||
| 		 				if('' == str){ | ||||
| 		 				if ('' == str){ | ||||
| 		 					str += $(this).attr('name'); | ||||
| 		 				} | ||||
| 		 				else{ | ||||
| @@ -631,7 +630,7 @@ function showConfigureDia(){ | ||||
|  * load the rmc event tab. | ||||
|  *  | ||||
|  * @param  | ||||
|  | ||||
|  *  | ||||
|  * @return | ||||
|  *         | ||||
|  */ | ||||
| @@ -661,7 +660,6 @@ function loadRmcEvent(){ | ||||
| /** | ||||
|  * get all conditions   | ||||
|  *  | ||||
|  *  | ||||
|  * @return | ||||
|  *         | ||||
|  */ | ||||
| @@ -678,7 +676,7 @@ function getConditions(){ | ||||
| 				msg : '' | ||||
| 			}, | ||||
| 			 | ||||
| 			success : function(data){ | ||||
| 			success : function (data){ | ||||
| 				$('#rmcEventStatus').empty(); | ||||
| 				$('#rmcEventButtons').show(); | ||||
| 				globalCondition = data.rsp[0]; | ||||
| @@ -693,7 +691,6 @@ function getConditions(){ | ||||
| /** | ||||
|  * get all response   | ||||
|  *  | ||||
|  *  | ||||
|  * @return | ||||
|  *         | ||||
|  */ | ||||
| @@ -704,6 +701,7 @@ function getResponse(){ | ||||
| 		tempFlag = true;  | ||||
| 		break; | ||||
| 	} | ||||
| 	 | ||||
| 	if (!tempFlag){ | ||||
| 		$.ajax({ | ||||
| 			url : 'lib/cmd.php', | ||||
| @@ -717,7 +715,7 @@ function getResponse(){ | ||||
| 			 | ||||
| 			success : function(data){ | ||||
| 				var resps = data.rsp[0].split(';'); | ||||
| 				for(var i in resps){ | ||||
| 				for (var i in resps){ | ||||
| 					var name = resps[i]; | ||||
| 					name = name.substr(1, (name.length - 2)); | ||||
| 					globalResponse[name] = 1; | ||||
| @@ -755,7 +753,7 @@ function showEventLog(data){ | ||||
| 	var eventTable = new DataTable('lsEventTable'); | ||||
| 	eventTable.init(['Time', 'Type', 'Content']); | ||||
| 	 | ||||
| 	for(var i in data.rsp){ | ||||
| 	for (var i in data.rsp){ | ||||
| 		var row = data.rsp[i].split(';'); | ||||
| 		eventTable.add(row); | ||||
| 	} | ||||
| @@ -840,7 +838,7 @@ function mkCondRespDia(){ | ||||
| 				msg : '' | ||||
| 			}, | ||||
| 			 | ||||
| 			success : function(data){ | ||||
| 			success : function (data){ | ||||
| 				var tempHash = new Object(); | ||||
| 				var oldSelectedResp = ''; | ||||
| 				var showStr = ''; | ||||
| @@ -853,8 +851,8 @@ function mkCondRespDia(){ | ||||
| 					} | ||||
| 				} | ||||
| 				 | ||||
| 				for(var name in globalResponse){ | ||||
| 					if(tempHash[name]){ | ||||
| 				for (var name in globalResponse){ | ||||
| 					if (tempHash[name]){ | ||||
| 						showStr += '<input type="checkbox" checked="checked" value="' + name + '">' + name + '<br/>'; | ||||
| 						oldSelectedResp += ';' + name; | ||||
| 					} | ||||
| @@ -905,7 +903,7 @@ function mkCondRespDia(){ | ||||
| 				}); | ||||
| 				 | ||||
| 				for (var i in newResp){ | ||||
| 					if(oldResp[i]){ | ||||
| 					if (oldResp[i]){ | ||||
| 						delete oldResp[i]; | ||||
| 						delete newResp[i]; | ||||
| 					} | ||||
| @@ -915,7 +913,7 @@ function mkCondRespDia(){ | ||||
| 				for (var i in oldResp){ | ||||
| 					oldString += ',"' + i + '"'; | ||||
| 				} | ||||
| 				if('' != oldString){ | ||||
| 				if ('' != oldString){ | ||||
| 					oldString = oldString.substr(1); | ||||
| 				} | ||||
| 				 | ||||
| @@ -927,7 +925,7 @@ function mkCondRespDia(){ | ||||
| 					newString = newString.substr(1); | ||||
| 				} | ||||
| 				 | ||||
| 				if(('' != oldString) || ('' != newString)){ | ||||
| 				if (('' != oldString) || ('' != newString)){ | ||||
| 					$('#rmcEventStatus').empty().append('Create/Remove associations').append(createLoader()); | ||||
| 					$.ajax({ | ||||
| 						url : 'lib/cmd.php', | ||||
| @@ -1298,7 +1296,7 @@ function createAssociationTable(cond){ | ||||
| 	var showStr = '<center><table><thead><tr><th>Condition Name</th><th>Status</th><th>Start/Stop</th></tr></thead>'; | ||||
| 	showStr += '<tbody>'; | ||||
| 	 | ||||
| 	for(var i in conditions){ | ||||
| 	for (var i in conditions){ | ||||
| 		name = conditions[i]; | ||||
| 		tempLength = name.length; | ||||
| 		tempStatus = name.substr(tempLength - 3); | ||||
|   | ||||
| @@ -1,36 +1,32 @@ | ||||
| /* | ||||
| *   Globle variable | ||||
| * | ||||
| */ | ||||
| /** | ||||
|  * global variable | ||||
|  */ | ||||
| var XcatmonTableId="XcatMonsettingTable"; | ||||
| var dataTables=new Object(); | ||||
|  | ||||
| /* | ||||
| *	set datatable | ||||
| * | ||||
| */ | ||||
| /** | ||||
|  * set datatable | ||||
|  */ | ||||
| function setDatatable(id,obj){ | ||||
| 	dataTables[id]=obj; | ||||
| } | ||||
| /* | ||||
| * get datatable from the given id | ||||
| * | ||||
| * | ||||
| */ | ||||
|  | ||||
| /** | ||||
|  * get datatable from the given id | ||||
|  */ | ||||
| function getDatatable(id){ | ||||
| 	return dataTables[id]; | ||||
| } | ||||
| /* | ||||
| *	 | ||||
| * | ||||
| */ | ||||
|  | ||||
| /** | ||||
|  * load xCAT monitor | ||||
|  */ | ||||
| function loadXcatMon(){ | ||||
| 	//find the xcat mon tab | ||||
| 	var xcatMonTab = $('#xcatmon'); | ||||
| 	 | ||||
| 	xcatMonTab.append("<div id= xcatmonTable></div>"); | ||||
| 	// show the content of the table monsetting | ||||
| 	//show the content of the table monsetting | ||||
| 	$.ajax({ | ||||
| 		url:'lib/cmd.php', | ||||
| 		dataType: 'json', | ||||
| @@ -43,17 +39,16 @@ function loadXcatMon(){ | ||||
| 		success: loadXcatMonSetting | ||||
| 	});	 | ||||
| } | ||||
| function loadXcatMonSetting(data){ | ||||
| 	 | ||||
| 	var apps;// contain the xcatmon apps config | ||||
|  | ||||
| function loadXcatMonSetting(data){	 | ||||
| 	var apps; //contain the xcatmon apps config | ||||
| 	var rsp=data.rsp;	 | ||||
| 	var apps_flag=0;// Is the apps is stored? | ||||
| 	var ping; // contain the xcatmon ping-interval setting | ||||
| 	var apps_flag=0; //is the apps is stored? | ||||
| 	var ping; //contain the xcatmon ping-interval setting | ||||
| 	var ping_flag=0; | ||||
|  | ||||
|  | ||||
| 	//create a infoBar	 | ||||
| 	var infoBar=createInfoBar('Click on a cell to edit,Click outside the table to write to the cell.<br>Once you finish the xCATmon config.click on Apply.'); | ||||
| 	var infoBar=createInfoBar('Click on a cell to edit. Click outside the table to write to the cell.<br>Once you are finished configuring the xCAT monitor, click on Apply.'); | ||||
| 	$('#xcatmonTable').append(infoBar); | ||||
| 	 | ||||
| 	//create xcatmonTable | ||||
| @@ -62,7 +57,7 @@ function loadXcatMonSetting(data){ | ||||
| 	//create Datatable | ||||
| 	var dTable; | ||||
| 	 | ||||
| 	// create the xcatmonTable header	 | ||||
| 	//create the xcatmonTable header	 | ||||
| 	var header=rsp[0].split(",");	 | ||||
| 	header.splice(3,2); | ||||
| 	header.splice(0,1); | ||||
| @@ -71,47 +66,44 @@ function loadXcatMonSetting(data){ | ||||
| 	header.push('<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">'); | ||||
|  | ||||
| 	header.unshift(''); | ||||
| 	XcatmonTable.init(header);//create the table header | ||||
| 	XcatmonTable.init(header); //create the table header | ||||
|  | ||||
|  | ||||
| 	// create container of original table contents | ||||
| 	//create container of original table contents | ||||
| 	var origCont= new Array(); | ||||
| 	origCont[0]=header;// table header | ||||
| 	origCont[0]=header; //table header | ||||
|  | ||||
| 	//create contariner for new contents use for update the monsetting table | ||||
| 	var newCont =new Object(); | ||||
| 	newCont[0]=rsp[0].split(",");// table header	 | ||||
| 	newCont[0]=rsp[0].split(","); // table header	 | ||||
| 	// create container for other monsetting lines not xcatmon | ||||
| 	var otherCont =new Array(); | ||||
| 	 | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 	$('#xcatmonTable').append(XcatmonTable.object());// add table object | ||||
| 	var m=1;// the count for origCont | ||||
| 	$('#xcatmonTable').append(XcatmonTable.object()); //add table object | ||||
| 	var m=1; //the count for origCont | ||||
| 	var n=0; | ||||
| 	for( var i=1;i<rsp.length;i++){ // get the apps and the ping-interval configure | ||||
| 		var pos=rsp[i].indexOf("xcatmon");// only check the xcatmon setting | ||||
| 		if(pos ==1){ | ||||
| 			// get the useful info and add it to the page. | ||||
| 			 | ||||
| 			if((rsp[i].indexOf("apps")== -1 )&&(rsp[i].indexOf("ping")== -1)){ | ||||
| 	for (var i=1;i<rsp.length;i++){ //get the apps and the ping-interval configure | ||||
| 		var pos=rsp[i].indexOf("xcatmon"); //only check the xcatmon setting | ||||
| 		if (pos ==1){ | ||||
| 			//get the useful info and add it to the page. | ||||
| 			if ((rsp[i].indexOf("apps")== -1 )&&(rsp[i].indexOf("ping")== -1)){ | ||||
| 				var cols=rsp[i].split(','); | ||||
|  | ||||
| 				// pair the semicolon of the content | ||||
| 				for(var j=0;j<cols.length;j++){ | ||||
| 					if(cols[j].count('"')%2==1){ | ||||
| 						while(cols[j].count('"')%2==1){ | ||||
| 				//pair the semicolon of the content | ||||
| 				for (var j=0;j<cols.length;j++){ | ||||
| 					if (cols[j].count('"')%2==1){ | ||||
| 						while (cols[j].count('"')%2==1){ | ||||
| 						cols[j]=cols[j]+","+cols[j+1]; | ||||
| 						cols.splice(j+1,1); | ||||
| 						} | ||||
| 					} | ||||
| 				cols[j]=cols[j].replace(new RegExp('"','g'),'');	 | ||||
| 					cols[j]=cols[j].replace(new RegExp('"','g'),'');	 | ||||
| 				} | ||||
| 				// remove the commend disable | ||||
| 				//remove the commend disable | ||||
| 				cols.splice(3,2); | ||||
| 				// remove the xcatmon | ||||
| 				//remove the xcatmon | ||||
| 				cols.splice(0,1); | ||||
| 				 | ||||
| 				cols.push('<input type="checkbox" name="'+cols[0]+'" title="Click this checkbox will add/remove the app from the configure apps value." />'); | ||||
| @@ -120,56 +112,49 @@ function loadXcatMonSetting(data){ | ||||
| 				XcatmonTable.add(cols); | ||||
| 				 | ||||
| 				origCont[m++]=cols; | ||||
| 			}else{ | ||||
|  | ||||
| 				if(!apps_flag){//check the apps setting | ||||
| 					if(rsp[i].indexOf("apps") > -1){// check for  is  apps or not | ||||
| 						apps=rsp[i].split(',');//  | ||||
| 			} else{ | ||||
| 				if (!apps_flag){ //check the apps setting | ||||
| 					if (rsp[i].indexOf("apps") > -1){ //check for  is  apps or not | ||||
| 						apps=rsp[i].split(','); | ||||
| 					 | ||||
| 						for(var j=0;j<apps.length;j++){// pair the semicolon | ||||
| 							if(apps[j].count('"')%2==1){ | ||||
| 								while(apps[j].count('"')%2==1){ | ||||
| 								apps[j]=apps[j]+","+apps[j+1]; | ||||
| 								apps.splice(j+1,1); | ||||
| 						for (var j=0;j<apps.length;j++){ //pair the semicolon | ||||
| 							if (apps[j].count('"')%2==1){ | ||||
| 								while (apps[j].count('"')%2==1){ | ||||
| 									apps[j]=apps[j]+","+apps[j+1]; | ||||
| 									apps.splice(j+1,1); | ||||
| 								} | ||||
| 							} | ||||
| 							apps[j]=apps[j].replace(new RegExp('"','g'),''); | ||||
| 						} | ||||
| 					 | ||||
| 						apps_flag=1;// set the flag to 1 to avoid this subroute | ||||
| 						apps_flag=1; //set the flag to 1 to avoid this subroute | ||||
| 					} | ||||
| 				} | ||||
| 				// get into the ping setting subroute | ||||
| 				if(!ping_flag){ | ||||
| 				//get into the ping setting subroute | ||||
| 				if (!ping_flag){ | ||||
| 					//check the ping-interval config | ||||
| 					if(rsp[i].indexOf("ping-interval")> -1){ | ||||
| 					if (rsp[i].indexOf("ping-interval")> -1){ | ||||
| 						ping=rsp[i].split(','); | ||||
| 						// pair the semicolon | ||||
| 						for(var j=0;j<ping.length;j++){ | ||||
|  | ||||
| 							if(ping[j].count('"')%2 == 1){ | ||||
| 								while(ping[j].count('"')%2 == 1){ | ||||
| 						//pair the semicolon | ||||
| 						for (var j=0;j<ping.length;j++){ | ||||
| 							if (ping[j].count('"')%2 == 1){ | ||||
| 								while (ping[j].count('"')%2 == 1){ | ||||
| 									ping[j]=ping[j]+","+ping[j+1]; | ||||
| 									ping.splice(j+1,1); | ||||
| 								} | ||||
|  | ||||
| 							} | ||||
| 							ping[j]=ping[j].replace((new RegExp('"','g')),''); | ||||
| 						} | ||||
| 						ping_flag=1; | ||||
| 					} | ||||
| 	 | ||||
|  | ||||
| 				} | ||||
|  | ||||
| 			}			 | ||||
|  | ||||
| 		}else if(pos !=1 ){ | ||||
| 			// the other monitor in the monsetting table | ||||
| 		} else if(pos !=1 ){ | ||||
| 			//the other monitor in the monsetting table | ||||
| 			var otherCols=rsp[i].split(','); | ||||
| 			for(var k=0;k<otherCols.length;k++){ | ||||
| 				if(otherCols[k].count('"')%2==1){ | ||||
| 					while(otherCols[k].count('"')%2==1){ | ||||
| 			for (var k=0;k<otherCols.length;k++){ | ||||
| 				if (otherCols[k].count('"')%2==1){ | ||||
| 					while (otherCols[k].count('"')%2==1){ | ||||
| 						otherCols[k]=otherCols[k]+","+otherCols[k+1]; | ||||
| 						otherCols.splice(k+1,1); | ||||
| 					} | ||||
| @@ -181,8 +166,8 @@ function loadXcatMonSetting(data){ | ||||
|  | ||||
| 		} | ||||
| 	} | ||||
| 	// if the apps is not in the monsetting table.Then create the default apps row. | ||||
| 	// When saving the changes,add the row to the table. | ||||
| 	//if the apps is not in the monsetting table.Then create the default apps row. | ||||
| 	//when saving the changes,add the row to the table. | ||||
| 	if(!apps_flag){ | ||||
| 		apps=rsp[0].split(','); | ||||
| 		apps[0]="xcatmon"; | ||||
| @@ -190,31 +175,29 @@ function loadXcatMonSetting(data){ | ||||
| 		apps[2]=""; | ||||
| 		apps[3]=""; | ||||
| 		apps[4]=""; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// If the ping-interval is not in the monsetting table.Then create the default ping-interval row. | ||||
| 	//When saving the changes,add the row to the table. | ||||
| 	//if the ping-interval is not in the monsetting table.Then create the default ping-interval row. | ||||
| 	//when saving the changes,add the row to the table. | ||||
| 	if(!ping_flag){ | ||||
| 		ping=rsp[0].split(','); | ||||
| 		ping[0]="xcatmon"; | ||||
| 		ping[1]="ping-interval"; | ||||
| 		// the default ping-interval setting is 5 | ||||
| 		//the default ping-interval setting is 5 | ||||
| 		ping[2]="5"; | ||||
| 		ping[3]=""; | ||||
| 		ping[4]=""; | ||||
| 	} | ||||
|  | ||||
| 	// set the checkbox to be true according to the apps | ||||
|  | ||||
| 	//set the checkbox to be true according to the apps | ||||
| 	var checked=apps[2].split(','); | ||||
| 	for(var i=0;i<checked.length;i++){ | ||||
| 		// set the selcet checkbox to  true | ||||
| 	for (var i=0;i<checked.length;i++){ | ||||
| 		//set the selcet checkbox to  true | ||||
| 		$("input:checkbox[name="+checked[i]+"]").attr('checked',true); | ||||
| 		for(var j =0;j<origCont.length;j++){ | ||||
| 			// set the origCont's checkbox to true | ||||
| 			if(origCont[j][1]==checked[i]){ | ||||
| 		for (var j =0;j<origCont.length;j++){ | ||||
| 			//set the origCont's checkbox to true | ||||
| 			if (origCont[j][1]==checked[i]){ | ||||
| 				origCont[j].splice(3,1); | ||||
| 	 | ||||
| 				origCont[j].push('<input type="checkbox" name="'+origCont[j][1]+'" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>'); | ||||
| 			} | ||||
| 		} | ||||
| @@ -230,185 +213,170 @@ function loadXcatMonSetting(data){ | ||||
| 			$(this).find("span:last").remove(); | ||||
| 		} | ||||
| 	); | ||||
|  | ||||
| */ | ||||
|  | ||||
| 	//make the table editable | ||||
|  | ||||
| 	$('#'+XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable( | ||||
|  | ||||
| 		function(value,settings){ | ||||
|  | ||||
| 		var colPos=this.cellIndex; | ||||
| 		var rowPos=dTable.fnGetPosition(this.parentNode); | ||||
| 		 | ||||
| 		dTable.fnUpdate(value,rowPos,colPos); | ||||
| 		 | ||||
| 		return (value); | ||||
| 		},{ | ||||
| 		onblur : 'submit', | ||||
| 		type : 'textarea', | ||||
| 		placeholder: ' ', | ||||
| 		height : '30px' | ||||
| 		} | ||||
|  | ||||
| 	); | ||||
| 	//save the datatable  | ||||
| 	dTable=$('#'+XcatmonTableId).dataTable(); | ||||
| 	// set the datatable to the global variables datatables | ||||
| 	setDatatable(XcatmonTableId,dTable); | ||||
| 	 | ||||
|  | ||||
| 	//create button bar | ||||
| 	var addBar = $('<div align="center"></div>'); | ||||
| 	$('#xcatmon').append(addBar); | ||||
| 	// create the button add row | ||||
| 	var addRowBtn=createButton('Add row'); | ||||
| 	// add the button to the page | ||||
| 	addBar.append(addRowBtn); | ||||
| 	// create the button apply | ||||
| 	var ApplyBtn=createButton('Apply'); | ||||
| 	// add the apply button to the page | ||||
| 	addBar.append(ApplyBtn); | ||||
| 	// create the button Cancel | ||||
| 	var CancelBtn=createButton('Cancel'); | ||||
| 	// add the cancel to the page | ||||
| 	addBar.append(CancelBtn); | ||||
| 	 | ||||
| 	// button click function | ||||
|  | ||||
| 	//create a empty row | ||||
| 	addRowBtn.bind('click',function(event){ | ||||
| 		// create the container of the new row | ||||
| 		var row = new Array(); | ||||
| 	 | ||||
| 		// add the delete button to the row | ||||
| 		row.push('<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>'); | ||||
| 		// add the xcatmon | ||||
| 		// add the contain of the setting | ||||
| 		for(var i =0;i<header.length-2;i++){ | ||||
| 			row.push(''); | ||||
| 		} | ||||
| 		// add the checkbox | ||||
| 		row.push('<input type="checkbox" name="'+row[2]+'" title="Click this checkbox will add/remove the app from the configure apps value."/>'); | ||||
| 		// get the datatable of the table | ||||
| 		var dTable=getDatatable(XcatmonTableId); | ||||
| 		// add  the new row to the datatable | ||||
| 		dTable.fnAddData(row); | ||||
| 	 | ||||
| 		// make the datatable editable | ||||
| 		$(":checkbox[title]").tooltip(); | ||||
| 		$('#'+XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable( | ||||
| 			function(value,settings){ | ||||
| 		function (value,settings){ | ||||
| 			var colPos=this.cellIndex; | ||||
| 			var rowPos=dTable.fnGetPosition(this.parentNode); | ||||
| 		 | ||||
| 			dTable.fnUpdate(value,rowPos,colPos); | ||||
| 		 | ||||
| 			return (value); | ||||
| 			},{ | ||||
| 		},{ | ||||
| 			onblur : 'submit', | ||||
| 			type : 'textarea', | ||||
| 			placeholder: ' ', | ||||
| 			height : '30px' | ||||
| 		} | ||||
| 	); | ||||
| 	 | ||||
| 	//save the datatable  | ||||
| 	dTable=$('#'+XcatmonTableId).dataTable(); | ||||
| 	//set the datatable to the global variables datatables | ||||
| 	setDatatable(XcatmonTableId,dTable); | ||||
|  | ||||
| 	//create button bar | ||||
| 	var addBar = $('<div align="center"></div>'); | ||||
| 	$('#xcatmon').append(addBar); | ||||
| 	//create the button add row | ||||
| 	var addRowBtn=createButton('Add row'); | ||||
| 	//add the button to the page | ||||
| 	addBar.append(addRowBtn); | ||||
| 	//create the button apply | ||||
| 	var ApplyBtn=createButton('Apply'); | ||||
| 	//add the apply button to the page | ||||
| 	addBar.append(ApplyBtn); | ||||
| 	//create the button Cancel | ||||
| 	var CancelBtn=createButton('Cancel'); | ||||
| 	//add the cancel to the page | ||||
| 	addBar.append(CancelBtn); | ||||
| 	 | ||||
| 	//button click function | ||||
| 	//create a empty row | ||||
| 	addRowBtn.bind('click', function(event){ | ||||
| 		//create the container of the new row | ||||
| 		var row = new Array(); | ||||
| 	 | ||||
| 		//add the delete button to the row | ||||
| 		row.push('<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>'); | ||||
| 		//add the xcatmon | ||||
| 		//add the contain of the setting | ||||
| 		for (var i =0;i<header.length-2;i++){ | ||||
| 			row.push(''); | ||||
| 		} | ||||
| 		 | ||||
| 		//add the checkbox | ||||
| 		row.push('<input type="checkbox" name="'+row[2]+'" title="Click this checkbox will add/remove the app from the configure apps value."/>'); | ||||
| 		//get the datatable of the table | ||||
| 		var dTable=getDatatable(XcatmonTableId); | ||||
| 		//add  the new row to the datatable | ||||
| 		dTable.fnAddData(row); | ||||
| 	 | ||||
| 		//make the datatable editable | ||||
| 		$(":checkbox[title]").tooltip(); | ||||
| 		$('#'+XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable( | ||||
| 			function(value,settings){ | ||||
| 				var colPos=this.cellIndex; | ||||
| 				var rowPos=dTable.fnGetPosition(this.parentNode); | ||||
| 				dTable.fnUpdate(value,rowPos,colPos); | ||||
| 				return (value); | ||||
| 			},{ | ||||
| 				onblur : 'submit', | ||||
| 				type : 'textarea', | ||||
| 				placeholder: ' ', | ||||
| 				height : '30px' | ||||
| 			} | ||||
|  | ||||
| 		); | ||||
|  | ||||
| 	}); | ||||
|  | ||||
|  | ||||
| /* | ||||
| *		apply button | ||||
| * | ||||
| * | ||||
| * | ||||
| *	The Apply button is used to store the contain of the table in the page to the monsetting table  | ||||
| *	on the MN. | ||||
| * | ||||
| */ | ||||
| 	ApplyBtn.bind('click',function(event){ | ||||
| 		// get the datatable of the page | ||||
| 	/** | ||||
| 	 * apply button | ||||
| 	 *  | ||||
| 	 * the Apply button is used to store the contain of the table in the page to | ||||
| 	 * the monsetting table on the MN. | ||||
| 	 */ | ||||
| 	ApplyBtn.bind('click', function(event){ | ||||
| 		//get the datatable of the page | ||||
| 		var dTable=getDatatable(XcatmonTableId); | ||||
| 		// get the rows of the datatable | ||||
| 		//get the rows of the datatable | ||||
| 		var dRows=dTable.fnGetNodes();	 | ||||
| 		var count=0; | ||||
| 		// create the new container of the apps' value. | ||||
| 		//create the new container of the apps' value. | ||||
| 		var appValue=""; | ||||
| 		var tableName="monsetting"; | ||||
| 		var tmp; | ||||
| 		var tmp1; | ||||
| 	var closeBtn=createButton("close"); | ||||
| 		// get the contain of the rows  | ||||
| 		var closeBtn=createButton("close"); | ||||
| 		//get the contain of the rows  | ||||
| 		for (var i =0; i< dRows.length;i++){ | ||||
| 			 | ||||
| 			if(dRows[i]){ | ||||
| 				// get the columns fo the row | ||||
| 			if (dRows[i]){ | ||||
| 				//get the columns fo the row | ||||
| 				var cols=dRows[i].childNodes; | ||||
| 				// create the container of the new column  | ||||
| 				//create the container of the new column  | ||||
| 				var vals = new Array(); | ||||
|  | ||||
| 				for(var j=1;j<cols.length-1;j++){ | ||||
| 					// get the value of every column(except the first and the last.why ? .ni dong de) | ||||
| 				for (var j=1;j<cols.length-1;j++){ | ||||
| 					//get the value of every column(except the first and the last.why ? .ni dong de) | ||||
| 					var val=cols.item(j).firstChild.nodeValue; | ||||
|  | ||||
| 					if(val == ' ' ){ | ||||
| 					if (val == ' ' ){ | ||||
| 						vals[j-1]='';	 | ||||
| 					}else{ | ||||
| 					} else{ | ||||
| 						vals[j-1]=val; | ||||
| 					} | ||||
| 				} | ||||
| 				// prepare another space for the array/ | ||||
| 				 | ||||
| 				//prepare another space for the array/ | ||||
| 				var vals_orig=new Array(); | ||||
| 				// copy the data from vals to vals_orig | ||||
| 				for(var p=0 ;p<2;p++){ | ||||
| 						var val=vals[p]; | ||||
| 						vals_orig[p]=val;	 | ||||
| 					} | ||||
| 				//copy the data from vals to vals_orig | ||||
| 				for (var p=0 ;p<2;p++){ | ||||
| 					var val=vals[p]; | ||||
| 					vals_orig[p]=val;	 | ||||
| 				} | ||||
|  | ||||
| 				vals.push(""); | ||||
| 				vals.push(""); | ||||
| 				vals.unshift("xcatmon"); | ||||
| 				// stored the new column to the newCont | ||||
| 				//stored the new column to the newCont | ||||
| 				newCont[i+1]=vals; | ||||
|  | ||||
|  | ||||
| 				// check the checkbox of the row and add different checkbox to the orignCont | ||||
| 				// for the cancle button | ||||
| 				if(cols.item(cols.length-1).firstChild.checked){ | ||||
| 		vals_orig.push('<input type="checkbox" name="'+vals_orig[0]+'" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>'); | ||||
| 				}else{ | ||||
| 		vals_orig.push('<input type="checkbox" name="'+vals_orig[0]+'" title="Click this checkbox will add/remove the app from the configure apps value."/>'); | ||||
| 				}	 | ||||
| 				// push the delete button to the row | ||||
| 				//check the checkbox of the row and add different checkbox to the orignCont | ||||
| 				//for the cancle button | ||||
| 				if (cols.item(cols.length-1).firstChild.checked){ | ||||
| 					vals_orig.push('<input type="checkbox" name="'+vals_orig[0]+'" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>'); | ||||
| 				} else{ | ||||
| 					vals_orig.push('<input type="checkbox" name="'+vals_orig[0]+'" title="Click this checkbox will add/remove the app from the configure apps value."/>'); | ||||
| 				} | ||||
| 				 | ||||
| 				//push the delete button to the row | ||||
| 				vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>'); | ||||
| 				// add the row to the orignCont | ||||
| 				//add the row to the orignCont | ||||
|  | ||||
| 				origCont[i+1]=vals_orig; | ||||
| 				//tmp1=origCont; | ||||
| 				//tmp=newCont; | ||||
| 				count=i+1; | ||||
| 				 | ||||
| 				// check the checkbox fo everyrow for merging the appName to  the apps values | ||||
| 				if(cols.item(cols.length-1).firstChild.checked){ | ||||
| 					// the new value for the apps.get the name fo every app. | ||||
| 				//check the checkbox fo everyrow for merging the appName to  the apps values | ||||
| 				if (cols.item(cols.length-1).firstChild.checked){ | ||||
| 					//the new value for the apps.get the name fo every app. | ||||
| 					appValue=appValue.concat(cols.item(2).firstChild.nodeValue+","); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		count++; | ||||
| 		// delete the last "," of the apps value | ||||
| 		//delete the last "," of the apps value | ||||
| 		appValue=appValue.substring(0,(appValue.length-1)); | ||||
| 		apps[2]=appValue; | ||||
|  | ||||
| //		tmp =apps; | ||||
| 		 | ||||
| 		// newCont add the apps row | ||||
| 		//newCont add the apps row | ||||
| 		newCont[count++]=apps; | ||||
| 		// newCont add the ping-interval row | ||||
| 		//newCont add the ping-interval row | ||||
| 		newCont[count++]=ping; | ||||
| 		//tmp=otherCont; | ||||
| 		// add the other monitor setting of the mosetting | ||||
| 		//add the other monitor setting of the mosetting | ||||
| 		for(var j=0;j<otherCont.length;j++){ | ||||
| 			newCont[count++]=otherCont[j]; | ||||
| 		} | ||||
| @@ -416,16 +384,16 @@ function loadXcatMonSetting(data){ | ||||
| 		//tmp1=newCont;	 | ||||
| 		setDatatable(XcatmonTableId,dTable); | ||||
| 		 | ||||
| 		// create the save dialog | ||||
| 		//create the save dialog | ||||
| 		var dialogSave=$('<div id="saveDialog" align="center">saving the configuration </div>'); | ||||
| 		dialogSave.append(createLoader()); | ||||
| 		addBar.append(dialogSave); | ||||
| 		// open the dialog..modal is true | ||||
| 		//open the dialog..modal is true | ||||
| 		$("#saveDialog").dialog({modal: true}); | ||||
| 		// hide the cross... | ||||
| 		//hide the cross... | ||||
| 		$('.ui-dialog-titlebar-close').hide(); | ||||
|  | ||||
| 		// pot the table name and the contain to the tabRestore.php | ||||
| 		//put the table name and the contain to the tabRestore.php | ||||
| 		$.ajax({ | ||||
| 			type : 'POST', | ||||
| 			url : 'lib/tabRestore.php', | ||||
| @@ -434,91 +402,71 @@ function loadXcatMonSetting(data){ | ||||
| 				table : tableName, | ||||
| 				cont : newCont | ||||
| 			}, | ||||
| 			success : function (data){ | ||||
| 				// empty the dialog.add the close button | ||||
| 			success : function(data){ | ||||
| 				//empty the dialog.add the close button | ||||
| 				$("#saveDialog").empty().append('<p>The Configure has saved!</p>'); | ||||
| 				$("#saveDialog").append(closeBtn); | ||||
| 			} | ||||
|  | ||||
| 		}); | ||||
| 	// close button function | ||||
| 	closeBtn.bind('click',function(event){ | ||||
| 		$("#saveDialog").dialog("distroy"); | ||||
| 		$("#saveDialog").remove(); | ||||
| 		 | ||||
| 		//close button function | ||||
| 		closeBtn.bind('click', function(event){ | ||||
| 			$("#saveDialog").dialog("distroy"); | ||||
| 			$("#saveDialog").remove(); | ||||
| 	 | ||||
| 		}); | ||||
|  | ||||
| 		//clear the newCont | ||||
| 		newCont=null; | ||||
| 		newCont=new Object(); | ||||
| 		//just for tmp=newCont; | ||||
| 		newCont[0]=rsp[0].split(","); | ||||
| 	}); | ||||
|  | ||||
| 		// clear the newCont | ||||
| 		newCont=null; | ||||
| 		newCont= new Object(); | ||||
| 		//just for tet			tmp=newCont; | ||||
| 		newCont[0]=rsp[0].split(","); | ||||
| 		 | ||||
|  | ||||
|  | ||||
| 	} | ||||
| 	); | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
| *		undo button | ||||
| * | ||||
| */ | ||||
| 	CancelBtn.bind('click',function(event){ | ||||
| 		 | ||||
| 		// get the datatable of the page | ||||
| 	/** | ||||
| 	 * undo button | ||||
| 	 */ | ||||
| 	CancelBtn.bind('click', function(event){ | ||||
| 		//get the datatable of the page | ||||
| 		var dTable=getDatatable(XcatmonTableId); | ||||
| 		 | ||||
| 		// clear the datatable | ||||
| 		//clear the datatable | ||||
| 		dTable.fnClearTable(); | ||||
|  | ||||
| 		// add the contain of the origCont to the datatable | ||||
| 		for(var i=1;i<origCont.length;i++){ | ||||
| 		//add the contain of the origCont to the datatable | ||||
| 		for (var i=1;i<origCont.length;i++){ | ||||
| 			dTable.fnAddData(origCont[i],true); | ||||
| 		}	 | ||||
|  | ||||
| 		$(":checkbox[title]").tooltip(); | ||||
| 	$('#'+XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable( | ||||
| 		function(value,settings){ | ||||
| 		var colPos=this.cellIndex; | ||||
| 		var rowPos=dTable.fnGetPosition(this.parentNode); | ||||
| 		 | ||||
| 		dTable.fnUpdate(value,rowPos,colPos); | ||||
| 		 | ||||
| 		return (value); | ||||
| 		$('#'+XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable( | ||||
| 		function (value,settings){ | ||||
| 			var colPos=this.cellIndex; | ||||
| 			var rowPos=dTable.fnGetPosition(this.parentNode); | ||||
| 			dTable.fnUpdate(value,rowPos,colPos); | ||||
| 			return (value); | ||||
| 		},{ | ||||
| 		onblur : 'submit', | ||||
| 		type : 'textarea', | ||||
| 		placeholder: ' ', | ||||
| 		height : '30px' | ||||
| 		} | ||||
| 		 | ||||
| 	);	 | ||||
|  | ||||
| 	} | ||||
| 	); | ||||
|  | ||||
|  | ||||
|  | ||||
| 			onblur : 'submit', | ||||
| 			type : 'textarea', | ||||
| 			placeholder: ' ', | ||||
| 			height : '30px' | ||||
| 		});	 | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| // delete a row from the table | ||||
| /** | ||||
|  * delete a row from the table | ||||
|  */ | ||||
| function deleteRow1(obj){ | ||||
| 	//var tableid=$(obj).parent().parent().parent().parent().attr('id'); | ||||
| 	var dTable=getDatatable(XcatmonTableId); | ||||
| 	var rows=dTable.fnGetNodes(); | ||||
| 	var tgtRow=$(obj).parent().parent().get(0); | ||||
| 	for (var i in rows){ | ||||
| 		if(rows[i] == tgtRow){ | ||||
| 		if (rows[i] == tgtRow){ | ||||
| 			dTable.fnDeleteRow(i, null,true); | ||||
| 			break; | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -13,7 +13,7 @@ var hardwareInfo = { | ||||
| 	'9119-590' : [ 'P5-590', '42' ], | ||||
| 	'9119-595' : [ 'P5-595', '42' ], | ||||
|  | ||||
| 	// P6 | ||||
| 	//P6 | ||||
| 	'8203-E4A' : [ 'P6-520', '4' ], | ||||
| 	'9407-M15' : [ 'P6-520', '4' ], | ||||
| 	'9408-M25' : [ 'P6-520', '4' ], | ||||
| @@ -24,7 +24,7 @@ var hardwareInfo = { | ||||
| 	'9125-F2A' : [ 'P6-575', '42' ], | ||||
| 	'9119-FHA' : [ 'P6-595', '42' ], | ||||
|  | ||||
| 	// P7 | ||||
| 	//P7 | ||||
| 	'8202-E4B' : [ 'P7-720', '4' ], | ||||
| 	'8205-E6B' : [ 'P7-740', '4' ], | ||||
| 	'8231-E2B' : [ 'P7-710/730', '2' ], | ||||
| @@ -33,5 +33,5 @@ var hardwareInfo = { | ||||
| 	'9117-MMB' : [ 'P7-770', '4' ], | ||||
| 	'9119-FHB' : [ 'P7-795', '42' ], | ||||
| 	'9179-MHB' : [ 'P7-780', '42' ], | ||||
| 	'9125-F2C' : [ 'P7-IH', '2']      //fsp | ||||
| 	'9125-F2C' : [ 'P7-IH', '2'] //fsp | ||||
| }; | ||||
| @@ -77,7 +77,6 @@ function initGraphicalData(dataTypeIndex, attrNullNode){ | ||||
|  * extract all nodes userful data into a hash, which is used for creating graphical | ||||
|  *  | ||||
|  * @param data: the response from xcat command "nodels all nodetype.nodetype ppc.parent ..."  | ||||
|  * | ||||
|  * @return nodes list for next time query | ||||
|  */ | ||||
| function extractGraphicalData(data){ | ||||
| @@ -90,7 +89,7 @@ function extractGraphicalData(data){ | ||||
| 			graphicalNodeList[nodeName] = new Object(); | ||||
| 		} | ||||
| 		 | ||||
| 		switch(data.msg.substr(5, 1)){ | ||||
| 		switch (data.msg.substr(5, 1)){ | ||||
| 			case '0':  | ||||
| 			case '1':{ | ||||
| 				if (!nodes[i][1]){ | ||||
| @@ -135,7 +134,7 @@ function createPhysicalLayout(nodeList){ | ||||
| 	} | ||||
| 	 | ||||
| 	//it is getting data,so we had to wait now. | ||||
| 	if(gettingDataFlag){ | ||||
| 	if (gettingDataFlag){ | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| @@ -145,7 +144,7 @@ function createPhysicalLayout(nodeList){ | ||||
| 	} | ||||
| 	 | ||||
| 	//save the new selected nodes. | ||||
| 	if(graphicalNodeList){ | ||||
| 	if (graphicalNodeList){ | ||||
| 		for(var i in graphicalNodeList){ | ||||
| 			flag = true; | ||||
| 			break; | ||||
| @@ -179,7 +178,7 @@ function fillList(nodeName){ | ||||
| 		status = 'unknown'; | ||||
| 	} | ||||
| 	 | ||||
| 	switch(graphicalNodeList[nodeName]['type']){ | ||||
| 	switch (graphicalNodeList[nodeName]['type']){ | ||||
| 		case 'frame': { | ||||
| 			if (undefined == bpaList[nodeName]){ | ||||
| 				bpaList[nodeName] = new Array(); | ||||
| @@ -275,8 +274,7 @@ function createGraphical(bpa, fsp, area){ | ||||
| 	//find the single fsp and sort descend by units  | ||||
| 	var singleFsp = new Array(); | ||||
| 	for (var fspName in fsp){ | ||||
| 		if (usedFsp[fspName]) | ||||
| 		{ | ||||
| 		if (usedFsp[fspName]){ | ||||
| 			continue; | ||||
| 		} | ||||
| 		 | ||||
| @@ -408,7 +406,6 @@ function createGraphical(bpa, fsp, area){ | ||||
|  *  | ||||
|  * @param  | ||||
|  * @return | ||||
|  * | ||||
|  **/ | ||||
| function updateSelectNodeDiv(){ | ||||
| 	var temp = 0; | ||||
| @@ -432,11 +429,10 @@ function updateSelectNodeDiv(){ | ||||
|  *  | ||||
|  * @param getNodesFunction | ||||
|  *            the function that can find selected nodes name | ||||
|  * @return  | ||||
|  *        action menu object | ||||
|  * @return action menu object | ||||
|  */ | ||||
| function createActionMenu(){ | ||||
| 	// Create action bar | ||||
| 	//create action bar | ||||
| 	var actionBar = $('<div class="actionBar"></div>'); | ||||
|  | ||||
| 	/** | ||||
| @@ -444,11 +440,11 @@ function createActionMenu(){ | ||||
| 	 * power, clone, delete, unlock, and advanced | ||||
| 	 */ | ||||
| 	var powerLnk = $('<a>Power</a>'); | ||||
| 	//Power on | ||||
| 	//power on | ||||
| 	var powerOnLnk = $('<a>Power on</a>'); | ||||
| 	powerOnLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| 		$.ajax( { | ||||
| 		$.ajax({ | ||||
| 			url : 'lib/cmd.php', | ||||
| 			dataType : 'json', | ||||
| 			data : { | ||||
| @@ -460,11 +456,11 @@ function createActionMenu(){ | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	//Power off | ||||
| 	//power off | ||||
| 	var powerOffLnk = $('<a>Power off</a>'); | ||||
| 	powerOffLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| 		$.ajax( { | ||||
| 		$.ajax({ | ||||
| 			url : 'lib/cmd.php', | ||||
| 			dataType : 'json', | ||||
| 			data : { | ||||
| @@ -476,14 +472,14 @@ function createActionMenu(){ | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	//Clone | ||||
| 	//clone | ||||
| 	var cloneLnk = $('<a>Clone</a>'); | ||||
| 	cloneLnk.bind('click', function(event) { | ||||
| 		/* | ||||
| 		for (var name in selectNode) { | ||||
| 			var mgt = graphicalNodeList[name]['mgt']; | ||||
| 			 | ||||
| 			// Create an instance of the plugin | ||||
| 			//create an instance of the plugin | ||||
| 			var plugin; | ||||
| 			switch(mgt) { | ||||
| 				case "blade": | ||||
| @@ -511,7 +507,7 @@ function createActionMenu(){ | ||||
| 		*/ | ||||
| 	}); | ||||
|  | ||||
| 	//Delete | ||||
| 	//delete | ||||
| 	var deleteLnk = $('<a>Delete</a>'); | ||||
| 	deleteLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -520,7 +516,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	//Unlock | ||||
| 	//unlock | ||||
| 	var unlockLnk = $('<a>Unlock</a>'); | ||||
| 	unlockLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -529,7 +525,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	//Run script | ||||
| 	//run script | ||||
| 	var scriptLnk = $('<a>Run script</a>'); | ||||
| 	scriptLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -538,7 +534,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	//Update node | ||||
| 	//update node | ||||
| 	var updateLnk = $('<a>Update</a>'); | ||||
| 	updateLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -547,7 +543,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	//Set boot state | ||||
| 	//set boot state | ||||
| 	var setBootStateLnk = $('<a>Set boot state</a>'); | ||||
| 	setBootStateLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -556,7 +552,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	//Boot to network | ||||
| 	//boot to network | ||||
| 	var boot2NetworkLnk = $('<a>Boot to network</a>'); | ||||
| 	boot2NetworkLnk.bind('click', function(event) { | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -565,7 +561,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| 	//Remote console | ||||
| 	//remote console | ||||
| 	var rcons = $('<a>Open console</a>'); | ||||
| 	rcons.bind('click', function(event){ | ||||
| 		var tgtNodes = getSelectNodes(); | ||||
| @@ -574,7 +570,7 @@ function createActionMenu(){ | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
| 	//Edit properties | ||||
| 	//edit properties | ||||
| 	var editProps = $('<a>Edit properties</a>'); | ||||
| 	editProps.bind('click', function(event){ | ||||
| 		for (var node in selectNode) { | ||||
| @@ -584,17 +580,17 @@ function createActionMenu(){ | ||||
|  | ||||
| 	var advancedLnk = $('<a>Advanced</a>'); | ||||
|  | ||||
| 	// Power actions | ||||
| 	//power actions | ||||
| 	var powerActions = [ powerOnLnk, powerOffLnk ]; | ||||
| 	var powerActionMenu = createMenu(powerActions); | ||||
|  | ||||
| 	// Advanced actions | ||||
| 	//advanced actions | ||||
| 	var advancedActions; | ||||
| 	advancedActions = [ boot2NetworkLnk, scriptLnk, setBootStateLnk, updateLnk, rcons, editProps ]; | ||||
| 	var advancedActionMenu = createMenu(advancedActions); | ||||
|  | ||||
| 	/** | ||||
| 	 * Create an action menu | ||||
| 	 * create an action menu | ||||
| 	 */ | ||||
| 	var actionsDIV = $('<div></div>'); | ||||
| 	var actions = [ [ powerLnk, powerActionMenu ], cloneLnk, deleteLnk, unlockLnk, [ advancedLnk, advancedActionMenu ] ]; | ||||
| @@ -612,8 +608,7 @@ function createActionMenu(){ | ||||
|  * @param bpaName : fsp's key | ||||
|  *        fsp : all fsp and there related lpars | ||||
|  *        fspinfo : all fsps' hardwareinfo | ||||
|  * @return | ||||
|  *        | ||||
|  * @return      | ||||
|  */ | ||||
| function createFspDiv(fspName, mtm, fsp){ | ||||
| 	//create fsp title | ||||
| @@ -658,8 +653,7 @@ function createFspDiv(fspName, mtm, fsp){ | ||||
|  * @param bpaName : fsp's key | ||||
|  *        fsp : all fsp and there related lpars | ||||
|  *        fspinfo : all fsps' hardwareinfo | ||||
|  * @return | ||||
|  *         | ||||
|  * @return      | ||||
|  */ | ||||
| function createFspTip(fspName, mtm, fsp){ | ||||
| 	var tip = $('<div class="tooltip"></div>'); | ||||
| @@ -694,9 +688,7 @@ function createFspTip(fspName, mtm, fsp){ | ||||
|  * map the lpar's status into a color  | ||||
|  *  | ||||
|  * @param status : lpar's status in nodelist table | ||||
|  | ||||
|  * @return | ||||
|  *        corresponding color name | ||||
|  * @return corresponding color name | ||||
|  */ | ||||
| function statusMap(status){ | ||||
| 	var color = 'gainsboro'; | ||||
| @@ -728,9 +720,7 @@ function statusMap(status){ | ||||
|  * select all lpars checkbox in the dialog  | ||||
|  *  | ||||
|  * @param  | ||||
|  | ||||
|  * @return | ||||
|  *         | ||||
|  * @return    | ||||
|  */ | ||||
| function selectAllLpars(checkbox){ | ||||
| 	var temp = checkbox.attr('checked'); | ||||
| @@ -741,9 +731,7 @@ function selectAllLpars(checkbox){ | ||||
|  * export all lpars' name from selectNode  | ||||
|  *  | ||||
|  * @param  | ||||
|  | ||||
|  * @return lpars' string | ||||
|  *         | ||||
|  * @return lpars' string    | ||||
|  */ | ||||
| function getSelectNodes() { | ||||
|     var ret = ''; | ||||
| @@ -759,7 +747,6 @@ function getSelectNodes() { | ||||
|  * list and update the tooltip table  | ||||
|  *  | ||||
|  * @param  | ||||
|  | ||||
|  * @return  | ||||
|  */ | ||||
| function changeNode(lparName, status){ | ||||
| @@ -783,7 +770,6 @@ function changeNode(lparName, status){ | ||||
|  * The P7-IH's cecs are insert from down to up, so we had to coculate the blank height.  | ||||
|  *  | ||||
|  * @param  | ||||
|  | ||||
|  * @return the height for the cec | ||||
|  */ | ||||
| function coculateBlank(mtm){ | ||||
|   | ||||
| @@ -426,329 +426,324 @@ function setImageDefAttrs(data) { | ||||
| } | ||||
|  | ||||
| /** | ||||
|  *Load create image page | ||||
|  * | ||||
|  *@param Nothing | ||||
|  *		Create a new image for provision | ||||
|  *@return Nothing | ||||
|  * Load create image page | ||||
|  *  | ||||
|  * @param Nothing | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function loadCreateImage(){ | ||||
| 	// get nodes tab | ||||
| 	var tab=getProvisionTab(); | ||||
| function loadCreateImage() { | ||||
| 	// Get nodes tab | ||||
| 	var tab = getProvisionTab(); | ||||
| 	var tabId = 'createImageTab'; | ||||
| 	//Generate new tab ID | ||||
| 	if($('#' + tabId).size()){ | ||||
| 	// Generate new tab ID | ||||
| 	if ($('#' + tabId).size()) { | ||||
| 		tab.select(tabId); | ||||
| 		return ; | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	var showStr = ''; | ||||
| 	var imageOsvers = $.cookie("osvers").split(","); | ||||
| 	var imageArch = $.cookie("osarchs").split(","); | ||||
| 	 | ||||
| 	// Create set properties form  | ||||
|  | ||||
| 	// Create set properties form | ||||
| 	var setPropsForm = $('<div class="form" ></div>'); | ||||
|  | ||||
| 	//show the infomation | ||||
| 	var infoBar= createInfoBar('Input the image info ,you want to generate. Click generate.'); | ||||
| 	// Show the infomation | ||||
| 	var infoBar = createInfoBar('Specify the parameters for the image you want to generate, then click Create Image.'); | ||||
| 	setPropsForm.append(infoBar); | ||||
| 	 | ||||
| 	//os version selector | ||||
|  | ||||
| 	// OS version selector | ||||
| 	showStr += '<p><label>OS Version:</label><select id="osvers" onchange="hpcShow()">'; | ||||
| 	for(var i = 0 ;i<imageOsvers.length;i++){ | ||||
| 		showStr+='<option value="'+imageOsvers[i]+'">'+imageOsvers[i]+'</option>'; | ||||
| 	for ( var i = 0; i < imageOsvers.length; i++) { | ||||
| 		showStr += '<option value="' + imageOsvers[i] + '">' + imageOsvers[i] + '</option>'; | ||||
| 	} | ||||
| 	showStr+='</select></p>'; | ||||
| 	showStr += '</select></p>'; | ||||
|  | ||||
| 	//os arch selector | ||||
| 	// OS arch selector | ||||
| 	showStr += '<p><label>OS Architecture:</label><select id="osarch" onchange="hpcShow()">'; | ||||
| 	for(var i =0;i<imageArch.length;i++){ | ||||
| 		showStr+='<option value="'+imageArch[i]+'">'+imageArch[i]+'</option>'; | ||||
| 	for ( var i = 0; i < imageArch.length; i++) { | ||||
| 		showStr += '<option value="' + imageArch[i] + '">' + imageArch[i] + '</option>'; | ||||
| 	} | ||||
| 	showStr+='</select></p>'; | ||||
| 	showStr += '</select></p>'; | ||||
|  | ||||
| 	//net boot interface input | ||||
| 	// Netboot interface input | ||||
| 	showStr += '<p><label>Net Boot Interface:</label><input type="text" id="netbootif"></p>'; | ||||
| 	//profile selector | ||||
| 	showStr += '<p><label>Profile:</label><select id="profile" onchange="hpcShow()">' + | ||||
| 			   '<option value="compute">compute</option>' +  | ||||
| 			   '<option value="service">service</option></select></p>'; | ||||
| 	//boot method selector | ||||
| 	showStr += '<p><label>Boot Method:</label><select id="bootmethod">' + | ||||
| 			   '<option value="stateless">stateless</option>' +  | ||||
| 	   		   '<option value="statelite">statelite</option></select></p>'; | ||||
|  | ||||
| 	// Profile selector | ||||
| 	showStr += '<p><label>Profile:</label><select id="profile" onchange="hpcShow()">' + '<option value="compute">compute</option>' + '<option value="service">service</option></select></p>'; | ||||
| 	// Boot method selector | ||||
| 	showStr += '<p><label>Boot Method:</label><select id="bootmethod">' + '<option value="stateless">stateless</option>' + '<option value="statelite">statelite</option></select></p>'; | ||||
| 	setPropsForm.append(showStr); | ||||
| 	createHpcSelect(setPropsForm); | ||||
| 	 | ||||
| 	//add and show the tab | ||||
|  | ||||
| 	// Add and show the tab | ||||
| 	tab.add(tabId, 'Create Image', setPropsForm, true); | ||||
| 	tab.select(tabId); | ||||
| 	 | ||||
| 	//check the selected osver and osarch for hcp stack select, if they are validated, | ||||
| 	//then show the hpc stack select area. | ||||
|  | ||||
| 	// Check the selected osver and osarch for hcp stack select | ||||
| 	// If they are valid, show the hpc stack select area. | ||||
| 	hpcShow(); | ||||
| 	 | ||||
| 	$.ajax({ | ||||
|  | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/systemcmd.php', | ||||
| 		dataType : 'json', | ||||
| 		data : { | ||||
| 			cmd : 'lsb_release -d;uname -p' | ||||
| 		}, | ||||
| 		success : function(data){ | ||||
| 		success : function(data) { | ||||
| 			var tempArray = data.rsp.split("\n"); | ||||
| 			var mnOs = tempArray[0]; | ||||
| 			var mnArch = tempArray[1];  | ||||
| 			var mnArch = tempArray[1]; | ||||
| 			tempArray = mnOs.split(" "); | ||||
| 			// get the the version of mn | ||||
| 			if(mnOs.indexOf("Red Hat")!= -1 ){ | ||||
| 				mnOs="rhels" + tempArray[6]; | ||||
| 			} | ||||
| 			 | ||||
| 			// Get the the version of MN | ||||
| 			if (mnOs.indexOf("Red Hat") != -1) { | ||||
| 				mnOs = "rhels" + tempArray[6]; | ||||
| 			} | ||||
|  | ||||
| 			$('#createImageTab option[value=' + mnOs + ']').attr('selected', 'selected'); | ||||
| 			$('#createImageTab option[value=' + mnArch + ']').attr('selected', 'selected'); | ||||
| 			// The button used to create images is created here. | ||||
| 			var createImageBtn=createButton("CreateImage"); | ||||
| 			createImageBtn.bind('click',function(event){ | ||||
| 			 | ||||
| 			// The button used to create images is created here | ||||
| 			var createImageBtn = createButton("Create Image"); | ||||
| 			createImageBtn.bind('click', function(event) { | ||||
| 				createImage(); | ||||
| 			}); | ||||
| 			 | ||||
|  | ||||
| 			$('#createImageTab').append(createImageBtn); | ||||
| 			 | ||||
| 			// check the option ,Decide to show the hpcsoft or not | ||||
|  | ||||
| 			// Check the option and decide to show the hpcsoft or not | ||||
| 			hpcShow(); | ||||
| 		} | ||||
| 	}); | ||||
| 	 | ||||
|  | ||||
| } | ||||
|  | ||||
| function createHpcSelect(container){ | ||||
| /** | ||||
|  * Create HPC select | ||||
|  *  | ||||
|  * @param container | ||||
|  *            The container to hold the HPC select | ||||
|  * @return HPC select appended to the container | ||||
|  */ | ||||
| function createHpcSelect(container) { | ||||
| 	var hpcFieldset = $('<fieldset id="hpcsoft"></fieldset>'); | ||||
| 	hpcFieldset.append('<legend>HPC Software Stack</legend>'); | ||||
| 	var str = 'Before selecting the software, you should have the following already completed for your xCAT cluster:<br/><br/>' + | ||||
| 		      '1. If you are using xCAT hierarchy, your service nodes are installed and running.<br/>' + | ||||
| 		      '2. Your compute nodes are defined to xCAT, and you have verified your hardware control capabilities, ' + | ||||
| 		      'gathered MAC addresses, and done all the other necessary preparations for a diskless install.<br/>' + | ||||
| 			  '3. You should have a diskless image created with the base OS installed and verified on at least one test node.<br/>' + | ||||
| 			  '4. You should install the softwares on the management node, and copy all correponding packages into the location ' +  | ||||
| 			  '"/install/custom/otherpkgs/" based on ' +  | ||||
| 			  '<a href="http://sourceforge.net/apps/mediawiki/xcat/index.php?title=IBM_HPC_Stack_in_an_xCAT_Cluster" target="_blank">these documentations</a>.<br/>'; | ||||
| 			   | ||||
| 	var str = 'Before selecting the software, you should have the following already completed for your xCAT cluster:<br/><br/>' | ||||
| 			+ '1. If you are using xCAT hierarchy, your service nodes are installed and running.<br/>' | ||||
| 			+ '2. Your compute nodes are defined to xCAT, and you have verified your hardware control capabilities, ' | ||||
| 			+ 'gathered MAC addresses, and done all the other necessary preparations for a diskless install.<br/>' | ||||
| 			+ '3. You should have a diskless image created with the base OS installed and verified on at least one test node.<br/>' | ||||
| 			+ '4. You should install the softwares on the management node, and copy all correponding packages into the location ' + '"/install/custom/otherpkgs/" based on ' | ||||
| 			+ '<a href="http://sourceforge.net/apps/mediawiki/xcat/index.php?title=IBM_HPC_Stack_in_an_xCAT_Cluster" target="_blank">these documentations</a>.<br/>'; | ||||
|  | ||||
| 	hpcFieldset.append(createInfoBar(str)); | ||||
| 	// advanced software when select the compute profile | ||||
| 	str = '<ul><li id="gpfsli"><input type="checkbox" onclick="softwareCheck(this)" name="gpfs">GPFS</li>' +  | ||||
| 		  '<li id="rsctli"><input type="checkbox" onclick="softwareCheck(this)" name="rsct">RSCT</li>' + | ||||
| 		  '<li id="peli"><input type="checkbox" onclick="softwareCheck(this)" name="pe">PE</li>' + | ||||
| 		  '<li id="esslli"><input type="checkbox" onclick="esslCheck(this)" name="essl">ESSl&PESSL</li>' + | ||||
| 		  '</ul>'; | ||||
| 	hpcFieldset.append(str); | ||||
| 	 | ||||
| 	// Advanced software when select the compute profile | ||||
| 	str = '<ul><li id="gpfsli"><input type="checkbox" onclick="softwareCheck(this)" name="gpfs">GPFS</li>' | ||||
| 			+ '<li id="rsctli"><input type="checkbox" onclick="softwareCheck(this)" name="rsct">RSCT</li>' + '<li id="peli"><input type="checkbox" onclick="softwareCheck(this)" name="pe">PE</li>' | ||||
| 			+ '<li id="esslli"><input type="checkbox" onclick="esslCheck(this)" name="essl">ESSl&PESSL</li>' + '</ul>'; | ||||
| 	hpcFieldset.append(str); | ||||
|  | ||||
| 	container.append(hpcFieldset); | ||||
| } | ||||
| var softwareList = { | ||||
|     "rsct" : [ "rsct.core.utils", "rsct.core", "src" ], | ||||
|     "pe" : [ "IBMJava2-142-ppc64-JRE", "ibm_lapi_ip_rh6p", "ibm_lapi_us_rh6p", "IBM_pe_license", | ||||
|             "ibm_pe_rh6p", "ppe_pdb_ppc64_rh600", "sci_ppc_32bit_rh600", "sci_ppc_64bit_rh600", | ||||
|             "vac.cmp", "vac.lib", "vac.lic", "vacpp.cmp", "vacpp.help.pdf", "vacpp.lib", | ||||
|             "vacpp.man", "vacpp.rte", "vacpp.rte.lnk", "vacpp.samples", "xlf.cmp", "xlf.help.pdf", | ||||
|             "xlf.lib", "xlf.lic", "xlf.man", "xlf.msg.rte", "xlf.rte", "xlf.rte.lnk", | ||||
|             "xlf.samples", "xlmass.lib", "xlsmp.lib", "xlsmp.msg.rte", "xlsmp.rte" ], | ||||
|     "gpfs" : [ "gpfs.base", "gpfs.gpl", "gpfs.gplbin", "gpfs.msg.en_US" ], | ||||
|     "essl" : [ "essl.3232.rte", "essl.3264.rte", "essl.6464.rte", "essl.common", "essl.license", | ||||
|             "essl.man", "essl.msg", "essl.rte", "ibm-java2", "pessl.common", "pessl.license", | ||||
|             "pessl.man", "pessl.msg", "pessl.rte.ppe" ], | ||||
|     "loadl" : [ "IBMJava2", "LoadL-full-license-RH6", "LoadL-resmgr-full-RH6", | ||||
|             "LoadL-scheduler-full-RH6" ], | ||||
|     "base" : [ "createrepo" ] | ||||
| 	"rsct" : [ "rsct.core.utils", "rsct.core", "src" ], | ||||
| 	"pe" : [ "IBMJava2-142-ppc64-JRE", "ibm_lapi_ip_rh6p", "ibm_lapi_us_rh6p", "IBM_pe_license", "ibm_pe_rh6p", "ppe_pdb_ppc64_rh600", "sci_ppc_32bit_rh600", "sci_ppc_64bit_rh600", "vac.cmp", | ||||
| 			"vac.lib", "vac.lic", "vacpp.cmp", "vacpp.help.pdf", "vacpp.lib", "vacpp.man", "vacpp.rte", "vacpp.rte.lnk", "vacpp.samples", "xlf.cmp", "xlf.help.pdf", "xlf.lib", "xlf.lic", "xlf.man", | ||||
| 			"xlf.msg.rte", "xlf.rte", "xlf.rte.lnk", "xlf.samples", "xlmass.lib", "xlsmp.lib", "xlsmp.msg.rte", "xlsmp.rte" ], | ||||
| 	"gpfs" : [ "gpfs.base", "gpfs.gpl", "gpfs.gplbin", "gpfs.msg.en_US" ], | ||||
| 	"essl" : [ "essl.3232.rte", "essl.3264.rte", "essl.6464.rte", "essl.common", "essl.license", "essl.man", "essl.msg", "essl.rte", "ibm-java2", "pessl.common", "pessl.license", "pessl.man", | ||||
| 			"pessl.msg", "pessl.rte.ppe" ], | ||||
| 	"loadl" : [ "IBMJava2", "LoadL-full-license-RH6", "LoadL-resmgr-full-RH6", "LoadL-scheduler-full-RH6" ], | ||||
| 	"base" : [ "createrepo" ] | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * esslCheck check the dependance of essl and start the softwareCheck for essl | ||||
|  *  | ||||
|  * @param softwareObject : | ||||
|  *            the checkbox object of essl | ||||
|  * Check the dependance of essl and start the software check for essl | ||||
|  *  | ||||
|  * @param softwareObject | ||||
|  *            The checkbox object of essl | ||||
|  * @return nothing | ||||
|  */ | ||||
|  | ||||
| function esslCheck(softwareObject) { | ||||
|     var softwareName = softwareObject.name; | ||||
|     if (false == $('#createImageTab input[name=pe]').attr('checked')) { | ||||
|         var errorStr = '<div style="margin:0px" class="ui-state-error">You must select the pe fi     rst.</div>'; | ||||
|         $('#createImageTab #esslli').append(errorStr); | ||||
|         $(':checkbox[name=essl]').attr("checked", false); | ||||
|         return; | ||||
|     } | ||||
|     else { | ||||
|         softwareCheck(softwareObject); | ||||
|     } | ||||
| 	var softwareName = softwareObject.name; | ||||
| 	if (false == $('#createImageTab input[name=pe]').attr('checked')) { | ||||
| 		var warnBar = createWarnBar('You must select the pe first.'); | ||||
| 		$('#createImageTab #esslli').append(warnBar); | ||||
| 		$(':checkbox[name=essl]').attr("checked", false); | ||||
| 		return; | ||||
| 	} else { | ||||
| 		softwareCheck(softwareObject); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /** | ||||
| *   softwarCheck check the preparation for hpc software | ||||
| * | ||||
| *   @param   softwareObject : the checkbox object of the hpc software | ||||
| * | ||||
| *   @return true: the checkbox checked | ||||
| *	    false: the error message on the page | ||||
| */ | ||||
|  | ||||
|  * Check the parameters for HPC software | ||||
|  *  | ||||
|  * @param softwareObject | ||||
|  *            The checkbox object of the hpc software | ||||
|  * @return True: 	The checkbox is checked  | ||||
|  * 		   False: 	Error message shown on page | ||||
|  */ | ||||
| function softwareCheck(softwareObject) { | ||||
|     var softwareName = softwareObject.name; | ||||
|     $('#createImageTab #' + softwareName + 'li .ui-state-error').remove(); | ||||
|     $('#createImageTab #' + softwareName + 'li').append(createLoader()); | ||||
|     var cmdString = genRpmCmd(softwareName); | ||||
|     $.ajax( { | ||||
|         url : 'lib/systemcmd.php', | ||||
|         dataType : 'json', | ||||
|         data : { | ||||
|             cmd : cmdString, | ||||
|             msg : softwareName | ||||
|         }, | ||||
|         success : function(data) { | ||||
|             if (rpmCheck(data.rsp, data.msg)) { | ||||
|                 genLsCmd(data.msg); | ||||
|                 $.ajax( { | ||||
|                     url : 'lib/systemcmd.php', | ||||
|                     dataType : 'json', | ||||
|                     data : { | ||||
|                         cmd : genLsCmd(data.msg), | ||||
|                         msg : data.msg | ||||
|                     }, | ||||
|                     success : rpmCopyCheck | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function rpmCopyCheck(data){ | ||||
|     // remove the loading image. | ||||
|     var errorStr = ''; | ||||
|     var softwareName = data.msg; | ||||
|     // check the return information | ||||
|     var reg = /.+:(.+): No such.*/; | ||||
|     var resultArray = data.rsp.split("\n"); | ||||
|     for ( var i in resultArray) { | ||||
|         var temp = reg.exec(resultArray[i]); | ||||
|         if (temp) { | ||||
|             // find out the path and rpm name | ||||
|             var pos = temp[1].lastIndexOf('/'); | ||||
|             var path = temp[1].substring(0, pos); | ||||
|             var rpmName = temp[1].substring(pos + 1).replace('*', ''); | ||||
|             errorStr += 'Copy ' + rpmName + ' to ' + path + '<br/>'; | ||||
|         } | ||||
|     } | ||||
|     $('#createImageTab #' + softwareName + 'li').find('img').remove(); | ||||
|     // no error, show the check image | ||||
|     if ('' == errorStr) { | ||||
|         var infoPart = '<div style="display:inline-block;margin:0px"><span class="ui-icon ui-icon-circle-check"></span></div>'; | ||||
|         $('#createImageTab #' + softwareName + 'li').append(infoPart); | ||||
|     } | ||||
|     else { | ||||
|         // show the error message | ||||
|         errorStr = '<div style="margin:0px" class="ui-state-error">' | ||||
|                 + 'To install the rsct on your compute node. You should:<br/>' | ||||
|                 + errorStr + '</div>'; | ||||
|         $('#createImageTab #' + softwareName + 'li').append(errorStr); | ||||
|         $(':checkbox[name=' + softwareName + ']').attr("checked", false); | ||||
|     } | ||||
| } | ||||
| /** | ||||
| *   genRpmCmd generate the rpm command for the rpmcheck  | ||||
| * | ||||
| *   @param   softwareName: the name of the software | ||||
| * | ||||
| *   @return the rpm command :"rpm -q ***" | ||||
| */ | ||||
|  | ||||
| function genRpmCmd(softwareName){ | ||||
|     var cmdString;	 | ||||
|     var packageLength; | ||||
|     cmdString = "rpm -q "; | ||||
|     for(var i in softwareList[softwareName]){ | ||||
|     	cmdString += softwareList[softwareName][i]+" "; | ||||
|     } | ||||
|  | ||||
|     for(var i in softwareList["base"]){ | ||||
|     	cmdString += softwareList["base"][i]+" "; | ||||
|     } | ||||
|     return cmdString; | ||||
| } | ||||
| /** | ||||
| *   genLsCmd check whether the rpms for the hpc software are copied to the special location | ||||
| *    | ||||
| *   @param   softwareName: the name of the software  | ||||
| * | ||||
| *   @return true: OK | ||||
| *           false: add the error message to the page | ||||
| */ | ||||
|  | ||||
| function genLsCmd(softwareName){ | ||||
|     var osvers = $("#createImageTab #osvers").val(); | ||||
|     var osarch = $("#createImageTab #osarch").val(); | ||||
|     var path = '/install/post/otherpkgs/' + osvers + '/' + osarch + '/' + softwareName; | ||||
|     var checkCmd = 'ls '; | ||||
|  | ||||
|     for ( var i in softwareList[softwareName]) { | ||||
|         checkCmd += path + '/' + softwareList[softwareName][i] + '*.rpm '; | ||||
|     } | ||||
|     checkCmd += '2>&1'; | ||||
|      | ||||
|     return checkCmd; | ||||
| } | ||||
| /** | ||||
| *   When the rpm check info return, check if all rpms are installed. | ||||
| * | ||||
| *   @param   checkInfo: "rpm -q ***"'s return  | ||||
| *	     name: software name | ||||
| * | ||||
| *   @return true: the rpms are all installed | ||||
| *           false: some of the rpms are not installed, detail add into the page. | ||||
| */ | ||||
| function rpmCheck(checkInfo, name){ | ||||
|     var errorStr = ''; | ||||
|  | ||||
|     var checkArray = checkInfo.split("\n"); | ||||
|     for ( var i in checkArray) { | ||||
|         if (-1 != checkArray[i].indexOf("not install")) { | ||||
|             errorStr += checkArray[i] + "<br/>"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if ('' == errorStr) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     errorStr = errorStr.substr(0, errorStr.length - 1); | ||||
|     $(':checkbox[name=' + name + ']').attr("checked", false); | ||||
|     // add the error | ||||
|     var errorPart = '<div style="margin:0px" class="ui-state-error">' | ||||
|             + errorStr + '</div>'; | ||||
|     $('#createImageTab #' + name + 'li').find('img').remove(); | ||||
|     $('#createImageTab #' + name + 'li').append(errorPart); | ||||
|     return; | ||||
| 	var softwareName = softwareObject.name; | ||||
| 	$('#createImageTab #' + softwareName + 'li .ui-state-error').remove(); | ||||
| 	$('#createImageTab #' + softwareName + 'li').append(createLoader()); | ||||
| 	var cmdString = genRpmCmd(softwareName); | ||||
| 	$.ajax( { | ||||
| 		url : 'lib/systemcmd.php', | ||||
| 		dataType : 'json', | ||||
| 		data : { | ||||
| 			cmd : cmdString, | ||||
| 			msg : softwareName | ||||
| 		}, | ||||
| 		success : function(data) { | ||||
| 			if (rpmCheck(data.rsp, data.msg)) { | ||||
| 				genLsCmd(data.msg); | ||||
| 				$.ajax( { | ||||
| 					url : 'lib/systemcmd.php', | ||||
| 					dataType : 'json', | ||||
| 					data : { | ||||
| 						cmd : genLsCmd(data.msg), | ||||
| 						msg : data.msg | ||||
| 					}, | ||||
| 					success : rpmCopyCheck | ||||
| 				}); | ||||
| 			} | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  *	check the Option , Decide to show the hpcsoft or not | ||||
|  * 	 | ||||
|  * | ||||
|  *	@param | ||||
|  * | ||||
|  *	@return Nothing | ||||
|  * Check whether the RPMs are copied to the special location | ||||
|  *  | ||||
|  * @param data | ||||
|  *            Data returned from HTTP request | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function rpmCopyCheck(data) { | ||||
| 	// Remove the loading image | ||||
| 	var errorStr = ''; | ||||
| 	var softwareName = data.msg; | ||||
| 	 | ||||
| 	// Check the return information | ||||
| 	var reg = /.+:(.+): No such.*/; | ||||
| 	var resultArray = data.rsp.split("\n"); | ||||
| 	for ( var i in resultArray) { | ||||
| 		var temp = reg.exec(resultArray[i]); | ||||
| 		if (temp) { | ||||
| 			// Find out the path and RPM name | ||||
| 			var pos = temp[1].lastIndexOf('/'); | ||||
| 			var path = temp[1].substring(0, pos); | ||||
| 			var rpmName = temp[1].substring(pos + 1).replace('*', ''); | ||||
| 			errorStr += 'copy ' + rpmName + ' to ' + path + '<br/>'; | ||||
| 		} | ||||
| 	} | ||||
| 	$('#createImageTab #' + softwareName + 'li').find('img').remove(); | ||||
| 	// No error, show the check image | ||||
| 	if ('' == errorStr) { | ||||
| 		var infoPart = '<div style="display:inline-block;margin:0px"><span class="ui-icon ui-icon-circle-check"></span></div>'; | ||||
| 		$('#createImageTab #' + softwareName + 'li').append(infoPart); | ||||
| 	} else { | ||||
| 		// Show the error message | ||||
| 		errorStr = 'To install the rsct on your compute node. You should:<br/>' + errorStr + '</div>'; | ||||
| 		var warnBar = createWarnBar(errorStr); | ||||
| 		$('#createImageTab #' + softwareName + 'li').append(warnBar); | ||||
| 		$(':checkbox[name=' + softwareName + ']').attr("checked", false); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Generate the RPM command for rpmcheck | ||||
|  *  | ||||
|  * @param softwareName | ||||
|  *            The name of the software | ||||
|  * @return The RPM command, e.g. 'rpm -q ***' | ||||
|  */ | ||||
| function genRpmCmd(softwareName) { | ||||
| 	var cmdString; | ||||
| 	var packageLength; | ||||
| 	cmdString = "rpm -q "; | ||||
| 	for (var i in softwareList[softwareName]) { | ||||
| 		cmdString += softwareList[softwareName][i] + " "; | ||||
| 	} | ||||
|  | ||||
| 	for (var i in softwareList["base"]) { | ||||
| 		cmdString += softwareList["base"][i] + " "; | ||||
| 	} | ||||
| 	 | ||||
| 	return cmdString; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Check whether the rpms for the hpc software are copied to the special | ||||
|  * location | ||||
|  *  | ||||
|  * @param softwareName | ||||
|  *            The name of the software | ||||
|  * @return True: 	OK  | ||||
|  * 		   False: 	Add the error message to the page | ||||
|  */ | ||||
| function genLsCmd(softwareName) { | ||||
| 	var osvers = $("#createImageTab #osvers").val(); | ||||
| 	var osarch = $("#createImageTab #osarch").val(); | ||||
| 	var path = '/install/post/otherpkgs/' + osvers + '/' + osarch + '/' + softwareName; | ||||
| 	var checkCmd = 'ls '; | ||||
|  | ||||
| 	for (var i in softwareList[softwareName]) { | ||||
| 		checkCmd += path + '/' + softwareList[softwareName][i] + '*.rpm '; | ||||
| 	} | ||||
| 	checkCmd += '2>&1'; | ||||
|  | ||||
| 	return checkCmd; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * When the RPM check info return, check if all RPMs are installed. | ||||
|  *  | ||||
|  * @param checkInfo | ||||
|  *            "rpm -q ***"'s return name: software name | ||||
|  * @return True: 	The RPMs are all installed  | ||||
|  * 		   False: 	Some of the rpms are not installed | ||||
|  */ | ||||
| function rpmCheck(checkInfo, name) { | ||||
| 	var errorStr = ''; | ||||
|  | ||||
| 	var checkArray = checkInfo.split("\n"); | ||||
| 	for ( var i in checkArray) { | ||||
| 		if (-1 != checkArray[i].indexOf("not install")) { | ||||
| 			errorStr += checkArray[i] + "<br/>"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if ('' == errorStr) { | ||||
| 		return true; | ||||
| 	} | ||||
|  | ||||
| 	errorStr = errorStr.substr(0, errorStr.length - 1); | ||||
| 	$(':checkbox[name=' + name + ']').attr("checked", false); | ||||
| 	 | ||||
| 	// Add the error | ||||
| 	var warnBar = createWarnBar(errorSstr); | ||||
| 	$('#createImageTab #' + name + 'li').find('img').remove(); | ||||
| 	$('#createImageTab #' + name + 'li').append(warnBar); | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Check the option and decide whether to show the hpcsoft or not | ||||
|  *  | ||||
|  * @param Nothing | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function hpcShow() { | ||||
|     // The current ui only support rhels 6 | ||||
|     // if you want support all delete the subcheck | ||||
|     if ($('#createImageTab #osvers').attr('value') != "rhels6" | ||||
|             || $('#createImageTab #osarch').attr('value') != "ppc64" | ||||
|             || $('#createImageTab #profile').attr('value') != "compute") { | ||||
|         $('#createImageTab #hpcsoft').hide(); | ||||
|     } | ||||
|     else { | ||||
|         $('#createImageTab #hpcsoft').show(); | ||||
|     } | ||||
| 	// The current UI only supports RHELS 6 | ||||
| 	// If you want to support all, delete the subcheck | ||||
| 	if ($('#createImageTab #osvers').attr('value') != "rhels6" || $('#createImageTab #osarch').attr('value') != "ppc64" || $('#createImageTab #profile').attr('value') != "compute") { | ||||
| 		$('#createImageTab #hpcsoft').hide(); | ||||
| 	} else { | ||||
| 		$('#createImageTab #hpcsoft').show(); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -1197,40 +1192,39 @@ function loadCopyCdPage() { | ||||
|  *   | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function createImage(){ | ||||
| function createImage() { | ||||
| 	var osvers = $("#createImageTab #osvers").val(); | ||||
| 	var osarch = $("#createImageTab #osarch").val(); | ||||
| 	var profile = $("#createImageTab #profile").val(); | ||||
| 	var bootInterface = $("#createImageTab #netbootif").val(); | ||||
| 	var bootMethod = $("#createImageTab #bootmethod").val(); | ||||
| 	 | ||||
|  | ||||
| 	$('#createImageTab .ui-state-error').remove(); | ||||
| 	// If there no input for the bootInterface | ||||
| 	if (!bootInterface){ | ||||
| 		$("#createImageTab").prepend('<div class="ui-state-error ui-corner-all">' +  | ||||
| 					                 '<p>Input the netboot interface please.</p></div>'); | ||||
| 	if (!bootInterface) { | ||||
| 		var warnBar = createWarnBar('Please specify the net boot interface'); | ||||
| 		$("#createImageTab").prepend(warnBar); | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| 	var createImageArgs = "createimage;" + osvers + ";" + osarch + ";" + profile + ";" + bootInterface + ";" + | ||||
| 						  bootMethod + ";"; | ||||
| 	 | ||||
| 	$("#createImageTab :checkbox:checked").each(function (){ | ||||
| 		createImageArgs+=$(this).attr("name")+","; | ||||
| 	}); | ||||
| 	 | ||||
| 	createImageArgs=createImageArgs.substring(0,(createImageArgs.length-1)); | ||||
| 	$.ajax({ | ||||
| 		 url : 'lib/cmd.php', | ||||
|          dataType : 'json', | ||||
|          data : { | ||||
|    		         cmd : 'webrun', | ||||
|                  tgt : '', | ||||
|                  args : createImageArgs, | ||||
|                  msg : '' | ||||
| 		}, | ||||
| 		success : function(data){ | ||||
|  | ||||
| 	var createImageArgs = "createimage;" + osvers + ";" + osarch + ";" + profile + ";" + bootInterface + ";" + bootMethod + ";"; | ||||
|  | ||||
| 	$("#createImageTab :checkbox:checked").each(function() { | ||||
| 		createImageArgs += $(this).attr("name") + ","; | ||||
| 	}); | ||||
|  | ||||
| 	createImageArgs = createImageArgs.substring(0, (createImageArgs.length - 1)); | ||||
| 	$.ajax({ | ||||
| 		url : 'lib/cmd.php', | ||||
| 		dataType : 'json', | ||||
| 		data : { | ||||
| 			cmd : 'webrun', | ||||
| 			tgt : '', | ||||
| 			args : createImageArgs, | ||||
| 			msg : '' | ||||
| 		}, | ||||
| 		success : function(data) { | ||||
| 			 | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
| } | ||||
| @@ -175,8 +175,7 @@ rconsTerm = function(nodeName, height, width){ | ||||
| 		if (firstFlag){ | ||||
| 			requireString = queryStable + keyPressList + '&f=1'; | ||||
| 			firstFlag = false; | ||||
| 		} | ||||
| 		else{ | ||||
| 		} else{ | ||||
| 			requireString = queryStable + keyPressList; | ||||
| 		} | ||||
| 		 | ||||
| @@ -201,8 +200,7 @@ rconsTerm = function(nodeName, height, width){ | ||||
| 		if (data.term){ | ||||
| 			termArea.empty().append(data.term); | ||||
| 			maxDelay = 200; | ||||
| 		} | ||||
| 		else{ | ||||
| 		} else{ | ||||
| 			maxDelay = 2000; | ||||
| 		} | ||||
| 		 | ||||
|   | ||||
| @@ -296,15 +296,6 @@ DataTable.prototype.add = function(rowCont) { | ||||
| 	this.dataTable.find('tbody').append(tableRow); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Remove a row from the datatable | ||||
|  *  | ||||
|  * @return Nothing | ||||
|  */ | ||||
| NodesTable.prototype.remove = function(id) { | ||||
| 	// To be continued | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Create status bar | ||||
|  *  | ||||
| @@ -332,7 +323,7 @@ function createInfoBar(msg) { | ||||
| 	}); | ||||
| 	var msg = $('<p>' + msg + '</p>').css({ | ||||
| 		'display': 'inline-block', | ||||
| 		'width': '95%' | ||||
| 		'width': '90%' | ||||
| 	}); | ||||
| 	 | ||||
| 	infoBar.append(icon); | ||||
| @@ -349,7 +340,16 @@ function createInfoBar(msg) { | ||||
|  */ | ||||
| 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>'); | ||||
| 	var icon = $('<span class="ui-icon ui-icon-alert"></span>').css({ | ||||
| 		'display': 'inline-block', | ||||
| 		'margin': '10px 5px' | ||||
| 	}); | ||||
| 	var msg = $('<p>' + msg + '</p>').css({ | ||||
| 		'display': 'inline-block', | ||||
| 		'width': '90%' | ||||
| 	}); | ||||
| 	 | ||||
| 	warnBar.append(icon); | ||||
| 	warnBar.append(msg); | ||||
| 	return warnBar; | ||||
| } | ||||
| @@ -374,7 +374,7 @@ function createLoader(loaderId) { | ||||
|  * @return Nothing | ||||
|  */ | ||||
| function createButton(name) { | ||||
| 	var button = $('<button aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="button"><span class="ui-button-text">' + name + '</span></button>'); | ||||
| 	var button = $('<button>' + name + '</button>').button(); | ||||
| 	return button; | ||||
| } | ||||
|  | ||||
| @@ -443,7 +443,6 @@ function initPage() { | ||||
| 	 | ||||
| 	// Custom plugins | ||||
| 	includeJs("js/custom/blade.js"); | ||||
| 	//includeJs("js/custom/hmc.js"); | ||||
| 	includeJs("js/custom/ipmi.js"); | ||||
| 	includeJs("js/custom/zvm.js"); | ||||
| 	includeJs("js/custom/customUtils.js"); | ||||
|   | ||||
| @@ -14,7 +14,7 @@ $(document).ready(function() { | ||||
| 		}, | ||||
| 		open : function(type, dialog) { | ||||
| 			if (document.location.protocol == "http:") { | ||||
| 				$("#logstatus").html("You are using an unencrypted session !"); | ||||
| 				$("#logstatus").html("You are using an unencrypted session!"); | ||||
| 				$("#logstatus").css("color", "#ff0000"); | ||||
| 			} | ||||
| 			if ($("#username").val() == "") { | ||||
| @@ -53,7 +53,7 @@ function onlogin(data, txtStatus) { | ||||
| 	// Clear password field regardless of what happens | ||||
| 	$("#password").val(""); | ||||
| 	if (data.authenticated == "yes") { | ||||
| 		$("#logstatus").text("Logged in successfully"); | ||||
| 		$("#logstatus").text("Login successful"); | ||||
| 		$("#logdialog").dialog("close"); | ||||
|  | ||||
| 		// Remembered what page they were trying to go to | ||||
|   | ||||
		Reference in New Issue
	
	Block a user