From 2c126bc49a8be253c902fc3e4dc7cb306f900f72 Mon Sep 17 00:00:00 2001 From: phamt Date: Sat, 16 Apr 2011 14:40:15 +0000 Subject: [PATCH] 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 --- xCAT-UI/css/style.css | 11 +- xCAT-UI/js/configure/discover.js | 84 ++--- xCAT-UI/js/configure/update.js | 69 ++-- xCAT-UI/js/custom/hmc.js | 194 +++++------ xCAT-UI/js/monitor/rmcmon.js | 50 ++- xCAT-UI/js/monitor/xcatmon.js | 492 ++++++++++++--------------- xCAT-UI/js/nodes/mtm.js | 6 +- xCAT-UI/js/nodes/physical.js | 72 ++-- xCAT-UI/js/provision/images.js | 560 +++++++++++++++---------------- xCAT-UI/js/rcons/rcons.js | 6 +- xCAT-UI/js/ui.js | 25 +- xCAT-UI/js/xcatauth.js | 4 +- 12 files changed, 749 insertions(+), 824 deletions(-) diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css index e0d3ca29a..6b06533ab 100644 --- a/xCAT-UI/css/style.css +++ b/xCAT-UI/css/style.css @@ -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 { diff --git a/xCAT-UI/js/configure/discover.js b/xCAT-UI/js/configure/discover.js index c208103c8..96f14b51d 100644 --- a/xCAT-UI/js/configure/discover.js +++ b/xCAT-UI/js/configure/discover.js @@ -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 += ' 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('

' + errMessage + '

'); + var warnBar = createWarnBar(errMessage); + $('#patternDiv').prepend(warnBar); return false; } @@ -532,7 +533,8 @@ function checkBasicPattern(operType){ } if ('' != errMessage){ - $('#patternDiv').prepend('

' + errMessage + '

'); + var warnBar = createWarnBar(errMessage); + $('#patternDiv').prepend(warnBar); return false; } @@ -614,8 +616,10 @@ function checkSupernode(operType){ } } + var warnBar; if (errString){ - $('#supernodeDiv').prepend('

' + errString + '

'); + 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('

' + errString + '

'); + warnBar = createWarnBar(errString); + $('#supernodeDiv').prepend(warnBar); return false; } @@ -838,7 +843,8 @@ function checkSiteTable(operType){ return true; } - $('#discoverContentDiv #siteDiv').prepend('

' + errMessage + '

'); + var warnBar = createWarnBar(errMessage); + $('#discoverContentDiv #siteDiv').prepend(warnBar); return false; } @@ -931,6 +937,7 @@ function initDiscoverFrames(){ frameArray[i] + '

'); } + for (var i in mtmsArray){ $('#mtmsTd').append('

' + mtmsArray[i] + '

'); @@ -1003,8 +1010,8 @@ function checkFrameMtms(operType){ var vpdFileCon = ''; $('#discoverShow .ui-state-error').remove(); if (0 < $('#discoverShow :radio').size()){ - $('#discoverContentDiv #discoverShow').prepend('

' + - 'Map all of the frame with mtms.

'); + 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('

' + - 'Error: Defined ' + hmcArray.length + ' hmcs, but discovered ' + mtmsArray.length + - ' hmcs. Check the configuration please.

'); + 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('
' + - '

Input the correct configuration rule.

'); + 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('
' + - '

The Lpar number per CEC is ' + getDiscoverEnv('lparNumPerCec') + ', but the configuration ' + - 'rule calculation is ' + lparCount + '.

'); + 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(); - } \ No newline at end of file diff --git a/xCAT-UI/js/configure/update.js b/xCAT-UI/js/configure/update.js index fa97b11a4..240de1fbe 100644 --- a/xCAT-UI/js/configure/update.js +++ b/xCAT-UI/js/configure/update.js @@ -10,7 +10,7 @@ function loadUpdatePage() { statusDiv.hide(); $('#updateTab').append(statusDiv); - $('#updateTab').append('
'); + $('#updateTab').append('
'); $('#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 = $('
    '); - // display the Devel Repository, remember user's last selection + // Display the Devel Repository, remember user's last selection show = show + "
  1. "; - show = show + develRepository + "(Devel)
  2. "; + show = show + "Development: " + develRepository + ""; repoList.append(show); - // display the Stable Repository, remember user's last selection + // Display the Stable Repository, remember user's last selection show = "
  3. "; - show = show + stableRepository + "(Stable)
  4. "; + show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>"; + show = show + "Stable: " + stableRepository + ""; 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 = "
  5. Other: "; - show += ""; + show += ""; } else { show = "
  6. Other: "; show += ""; @@ -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("xCAT RPMs"); show = ""; @@ -126,27 +129,28 @@ function showRpmInfo(data) { show += ""; show += ""; 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 += ""; show += ""; - show += ""; + show += ""; show += ""; } show += "
    Package NameVersion
    " + rpmNames[temp] + "" + rpms[temp].substr(rpmNames[temp].length + 1) + "" + rpmNames[temp] + "" + + rpms[temp].substr(rpmNames[temp].length + 1) + "
    "; show += ""; $('#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(""); $('#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('
    ' + resArray[resArray.length - 2] + '
    '); } else { - $('#update').append(resArray[resArray.length - 1]); + $('#update').append('
    ' + resArray[resArray.length - 1] + '
    '); } // Create link to show details $('#update').append('
    Show details'); - $('#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 = $('
    '); + var resDetail = $('
    ');
     		resDetail.hide();
     		$('#update').append(resDetail);
     		for (temp = 0; temp < resArray.length; temp++) {
    -			resDetail.append(resArray[temp] + "
    "); + resDetail.append(resArray[temp] + '
    '); } } - // update the rpm info + // Update the rpm info $.ajax( { url : 'lib/systemcmd.php', dataType : 'json', diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index 6af581fdf..370927d09 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -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('
    '); - /** - * 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.
    '; 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 = $('
    '); 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 = '
    '; var groupNames = $.cookie('groups'); - if (groupNames){ + if (groupNames) { strGroup += ''; - } - else{ + } else { strGroup += ''; } strGroup += '
    '; - - //create nodes area - var strNodes = '
    Select a group to view its nodes
    '; - - //create boot method - var strBoot = '
    '; - + + // Create nodes area + var strNodes = '
    Select a group to view its nodes
    '; + + // Create boot method + var strBoot = '
    '; + // Create operating system var strOs = '
    '; var osName = $.cookie('osvers'); - if (osName){ + if (osName) { strOs += ''; - } - else{ + } else { strOs += ''; } strOs += '
    '; - - //create architecture + + // Create architecture var strArch = '
    '; var archName = $.cookie('osarchs'); - if ('' != archName){ + if ('' != archName) { strArch += ''; - } - else{ + } else { strArch += ''; } strArch += '
    '; - - //create profile + + // Create profile var strPro = '
    '; var proName = $.cookie('profiles'); - if ('' != proName){ + if ('' != proName) { strPro += ''; - } - else{ + } else { strPro += ''; } strPro += '
    '; - + 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 = ''; showStr += ''; - for (index in nodes){ + for (index in nodes) { var node = nodes[index][0]; - if ('' == node){ + if ('' == node) { continue; } - showStr += ''; + showStr += ''; } showStr += '
    Node
    ' + node + '
    ' + + node + '
    '; 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); } diff --git a/xCAT-UI/js/monitor/rmcmon.js b/xCAT-UI/js/monitor/rmcmon.js index 983e21f98..f751f9216 100644 --- a/xCAT-UI/js/monitor/rmcmon.js +++ b/xCAT-UI/js/monitor/rmcmon.js @@ -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 xCAT-rmc first.
    '); } //check the rrdtool - if(-1 != softInstallStatus[1].indexOf("not")){ + if (-1 != softInstallStatus[1].indexOf("not")){ needHelp = true; $('#rmcMonStatus').append( 'Please install the RRD-tool first.
    '); @@ -357,8 +357,8 @@ function showDetail(){ $('#rmcmonDetail').append(detailFilter); 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(''); } 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 = ''; - if(selectedAttrHash[name]){ + if (selectedAttrHash[name]){ tempString += ''; } 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 += '' + name + '
    '; 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 = '
    '; showStr += ''; - for(var i in conditions){ + for (var i in conditions){ name = conditions[i]; tempLength = name.length; tempStatus = name.substr(tempLength - 3); diff --git a/xCAT-UI/js/monitor/xcatmon.js b/xCAT-UI/js/monitor/xcatmon.js index f12f0447d..025e384cc 100644 --- a/xCAT-UI/js/monitor/xcatmon.js +++ b/xCAT-UI/js/monitor/xcatmon.js @@ -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("
    "); - // 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.
    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.
    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(''); 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'); @@ -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 -1){ + if (rsp[i].indexOf("ping-interval")> -1){ ping=rsp[i].split(','); - // pair the semicolon - for(var j=0;j'); } } @@ -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 = $('
    '); - $('#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(''); - // add the xcatmon - // add the contain of the setting - for(var i =0;i'); - // 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 = $('
    '); + $('#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(''); + //add the xcatmon + //add the contain of the setting + for (var i =0;i'); + //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'); - }else{ - vals_orig.push(''); - } - // 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(''); + } else{ + vals_orig.push(''); + } + + //push the delete button to the row vals_orig.unshift(''); - // 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;jsaving the configuration '); 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('

    The Configure has saved!

    '); $("#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'); /** @@ -444,11 +440,11 @@ function createActionMenu(){ * power, clone, delete, unlock, and advanced */ var powerLnk = $('Power'); - //Power on + //power on var powerOnLnk = $('Power on'); 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 = $('Power off'); 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 = $('Clone'); 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 = $('Delete'); deleteLnk.bind('click', function(event) { var tgtNodes = getSelectNodes(); @@ -520,7 +516,7 @@ function createActionMenu(){ } }); - //Unlock + //unlock var unlockLnk = $('Unlock'); unlockLnk.bind('click', function(event) { var tgtNodes = getSelectNodes(); @@ -529,7 +525,7 @@ function createActionMenu(){ } }); - //Run script + //run script var scriptLnk = $('Run script'); scriptLnk.bind('click', function(event) { var tgtNodes = getSelectNodes(); @@ -538,7 +534,7 @@ function createActionMenu(){ } }); - //Update node + //update node var updateLnk = $('Update'); updateLnk.bind('click', function(event) { var tgtNodes = getSelectNodes(); @@ -547,7 +543,7 @@ function createActionMenu(){ } }); - //Set boot state + //set boot state var setBootStateLnk = $('Set boot state'); setBootStateLnk.bind('click', function(event) { var tgtNodes = getSelectNodes(); @@ -556,7 +552,7 @@ function createActionMenu(){ } }); - //Boot to network + //boot to network var boot2NetworkLnk = $('Boot to network'); boot2NetworkLnk.bind('click', function(event) { var tgtNodes = getSelectNodes(); @@ -565,7 +561,7 @@ function createActionMenu(){ } }); - //Remote console + //remote console var rcons = $('Open console'); rcons.bind('click', function(event){ var tgtNodes = getSelectNodes(); @@ -574,7 +570,7 @@ function createActionMenu(){ } }); - //Edit properties + //edit properties var editProps = $('Edit properties'); editProps.bind('click', function(event){ for (var node in selectNode) { @@ -584,17 +580,17 @@ function createActionMenu(){ var advancedLnk = $('Advanced'); - // 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 = $('
    '); 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 = $('
    '); @@ -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){ diff --git a/xCAT-UI/js/provision/images.js b/xCAT-UI/js/provision/images.js index b46225109..5a66e1797 100644 --- a/xCAT-UI/js/provision/images.js +++ b/xCAT-UI/js/provision/images.js @@ -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 = $('
    '); - //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 += '

    '; + showStr += '

    '; - //os arch selector + // OS arch selector showStr += '

    '; + showStr += '

    '; - //net boot interface input + // Netboot interface input showStr += '

    '; - //profile selector - showStr += '

    '; - //boot method selector - showStr += '

    '; - + // Profile selector + showStr += '

    '; + // Boot method selector + showStr += '

    '; 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 = $('
    '); hpcFieldset.append('HPC Software Stack'); - var str = 'Before selecting the software, you should have the following already completed for your xCAT cluster:

    ' + - '1. If you are using xCAT hierarchy, your service nodes are installed and running.
    ' + - '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.
    ' + - '3. You should have a diskless image created with the base OS installed and verified on at least one test node.
    ' + - '4. You should install the softwares on the management node, and copy all correponding packages into the location ' + - '"/install/custom/otherpkgs/" based on ' + - 'these documentations.
    '; - + var str = 'Before selecting the software, you should have the following already completed for your xCAT cluster:

    ' + + '1. If you are using xCAT hierarchy, your service nodes are installed and running.
    ' + + '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.
    ' + + '3. You should have a diskless image created with the base OS installed and verified on at least one test node.
    ' + + '4. You should install the softwares on the management node, and copy all correponding packages into the location ' + '"/install/custom/otherpkgs/" based on ' + + 'these documentations.
    '; + hpcFieldset.append(createInfoBar(str)); - // advanced software when select the compute profile - str = '
    • GPFS
    • ' + - '
    • RSCT
    • ' + - '
    • PE
    • ' + - '
    • ESSl&PESSL
    • ' + - '
    '; - hpcFieldset.append(str); + // Advanced software when select the compute profile + str = '
    • GPFS
    • ' + + '
    • RSCT
    • ' + '
    • PE
    • ' + + '
    • ESSl&PESSL
    • ' + '
    '; + 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 = '
    You must select the pe fi rst.
    '; - $('#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 + '
    '; - } - } - $('#createImageTab #' + softwareName + 'li').find('img').remove(); - // no error, show the check image - if ('' == errorStr) { - var infoPart = '
    '; - $('#createImageTab #' + softwareName + 'li').append(infoPart); - } - else { - // show the error message - errorStr = '
    ' - + 'To install the rsct on your compute node. You should:
    ' - + errorStr + '
    '; - $('#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] + "
    "; - } - } - - if ('' == errorStr) { - return true; - } - - errorStr = errorStr.substr(0, errorStr.length - 1); - $(':checkbox[name=' + name + ']').attr("checked", false); - // add the error - var errorPart = '
    ' - + errorStr + '
    '; - $('#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 + '
    '; + } + } + $('#createImageTab #' + softwareName + 'li').find('img').remove(); + // No error, show the check image + if ('' == errorStr) { + var infoPart = '
    '; + $('#createImageTab #' + softwareName + 'li').append(infoPart); + } else { + // Show the error message + errorStr = 'To install the rsct on your compute node. You should:
    ' + errorStr + ''; + 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] + "
    "; + } + } + + 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('
    ' + - '

    Input the netboot interface please.

    '); + 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) { + } }); -} +} \ No newline at end of file diff --git a/xCAT-UI/js/rcons/rcons.js b/xCAT-UI/js/rcons/rcons.js index f9501d91f..bc190eb7d 100644 --- a/xCAT-UI/js/rcons/rcons.js +++ b/xCAT-UI/js/rcons/rcons.js @@ -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; } diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 8578900f2..88358e5a2 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -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 = $('

    ' + msg + '

    ').css({ 'display': 'inline-block', - 'width': '95%' + 'width': '90%' }); infoBar.append(icon); @@ -349,7 +340,16 @@ function createInfoBar(msg) { */ function createWarnBar(msg) { var warnBar = $('
    '); - var msg = $('

    ' + msg + '

    '); + var icon = $('').css({ + 'display': 'inline-block', + 'margin': '10px 5px' + }); + var msg = $('

    ' + msg + '

    ').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 = $(''); + var 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"); diff --git a/xCAT-UI/js/xcatauth.js b/xCAT-UI/js/xcatauth.js index c1f72b803..68cb88dc7 100644 --- a/xCAT-UI/js/xcatauth.js +++ b/xCAT-UI/js/xcatauth.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
    Condition NameStatusStart/Stop