From 442bbe91565063057ebd7e085352f627bb60b4ab Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 14 Mar 2012 19:20:37 +0000 Subject: [PATCH] Fixed rcons to reference jquery.min.js. Added IP address and hostname range to z/VM clone and provision page. Updated update page with new links to xCAT repository. Cleaned up code. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11850 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/css/style.css | 85 ++--- xCAT-UI/js/configure/discover.js | 126 ++++---- xCAT-UI/js/configure/update.js | 7 +- xCAT-UI/js/custom/blade.js | 2 +- xCAT-UI/js/custom/customUtils.js | 4 +- xCAT-UI/js/custom/esx.js | 2 +- xCAT-UI/js/custom/hmc.js | 4 +- xCAT-UI/js/custom/ipmi.js | 2 +- xCAT-UI/js/custom/kvm.js | 2 +- xCAT-UI/js/custom/zvm.js | 224 ++++++++++--- xCAT-UI/js/custom/zvmUtils.js | 60 +++- xCAT-UI/js/monitor/monitor.js | 4 +- xCAT-UI/js/monitor/rmcmon.js | 2 +- xCAT-UI/js/monitor/xcatmon.js | 529 ++++++++++++++----------------- xCAT-UI/js/nodes/nodes.js | 14 +- xCAT-UI/js/nodes/physical.js | 42 +-- xCAT-UI/js/provision/images.js | 99 +++--- xCAT-UI/js/rcons/rcons.js | 320 +++++++++++-------- xCAT-UI/js/ui.js | 2 +- 19 files changed, 863 insertions(+), 667 deletions(-) diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css index 909cfea7c..066636d80 100644 --- a/xCAT-UI/css/style.css +++ b/xCAT-UI/css/style.css @@ -4,7 +4,8 @@ font: 12px sans-serif; } -.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td { +.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td + { font: 12px sans-serif; } @@ -12,7 +13,8 @@ font: 12px sans-serif; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { +.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button + { font: 12px sans-serif; } @@ -119,7 +121,7 @@ body { } pre { - font-size: 10px; + font-size: 10px; } /*--------------- Groups ---------------*/ @@ -151,11 +153,11 @@ pre { font-size: 15px; } -#groups .groupdiv{ +#groups .groupdiv { padding-left: 10px; } -#groups .groupdiv div{ +#groups .groupdiv div { color: blue; padding: 5px 0px 5px 20px; } @@ -166,11 +168,11 @@ pre { } #groups .selectgroup { - background: #E5E5E5; - font-weight: bold; + background: #E5E5E5; + font-weight: bold; } -#groups .actionDiv{ +#groups .actionDiv { text-align: right; padding-right: 5px; border-top: thin solid #E7EBFF; @@ -190,15 +192,18 @@ pre { width: 260px; height: 220px; } -.summarypie td{ - min-width:0px; + +.summarypie td { + min-width: 0px; } -#summaryTab td{ + +#summaryTab td { border: 0px; padding: 0px; text-align: left; line-height: 1; } + /*--------------- Info/warning bar ---------------*/ span.ui-icon-info { float: left; @@ -328,14 +333,14 @@ legend { } .sf-menu { - border-radius :0.3em 0.3em 0.3em 0.3em; + border-radius: 0.3em 0.3em 0.3em 0.3em; margin-bottom: 0; background: none; border: 0px solid; } .sf-menu ul li { - width: 99%; + width: 99%; } .sf-menu .sf-menu { @@ -346,8 +351,8 @@ legend { background: none; } -.sf-sub-indicator{ - right:0; +.sf-sub-indicator { + right: 0; } .actionBar { @@ -490,13 +495,13 @@ legend { } .sorting_asc,.sorting_desc,.sorting { - background: none; + background: none; } /*--------------- jQuery context menu ---------------*/ .context-menu-theme-vista { - background: #FAFAFA url(../images/contextmenu/context-menu-bg.gif) repeat-y left top - ; + background: #FAFAFA url(../images/contextmenu/context-menu-bg.gif) + repeat-y left top; border: 1px solid #868686; } @@ -516,8 +521,9 @@ legend { } .context-menu-theme-vista .context-menu-item-hover { - background: transparent url(../images/contextmenu/context-menu-item-hover.gif) - repeat-x left center; + background: transparent + url(../images/contextmenu/context-menu-item-hover.gif) repeat-x left + center; border: 1px solid #D7D0B3; } @@ -647,16 +653,16 @@ table a:hover { } .mornitorwarning { - background: #FFD700; + background: #FFD700; cursor: pointer; } .monitorerror { - background: #FF3030; + background: #FF3030; } .monitorunknown { - background: #8B8B7A; + background: #8B8B7A; } .monitornodeli { @@ -673,20 +679,21 @@ table a:hover { margin: 0px 0px 10px 10px; } -.monitorsumdiv td{ +.monitorsumdiv td { padding: 0; border-style: none; font-size: 10px; } + .monitornodediv { width: 240px; height: 120px; margin: 0px 0px 15px 0px; } -.monitorzoomlink{ +.monitorzoomlink { cursor: pointer; - color : blue; + color: blue; } .provision div,.monitor div { @@ -761,12 +768,12 @@ table a:hover { height: 11px; } -.fspcheckbox{ +.fspcheckbox { padding: 0px; margin: 3px 3px 1px 3px; } -.chasisDiv{ +.chasisDiv { width: 172px; height: 108px; font-size: 10px; @@ -777,19 +784,19 @@ table a:hover { padding: 11px 0px 0px 11px; } -.bladeDiv{ - float:left; +.bladeDiv { + float: left; width: 11px; height: 89px; text-align: left; white-space: normal; } -.bladeInsertDiv{ +.bladeInsertDiv { background: url(../images/nodes/blade.jpg); } -.xnodeDiv{ +.xnodeDiv { font-size: 12px; height: 21px; line-height: 21px; @@ -801,6 +808,7 @@ table a:hover { cursor: pointer; display: inline-block; } + /*--------------- Discovery section ---------------*/ .discoverstep { width: 960px; @@ -812,9 +820,9 @@ table a:hover { border-radius: .3em; } -.discovercurrentstep{ +.discovercurrentstep { background-color: yellow; - font: normal bold 12px/ 35px sans-serif; + font: normal bold 12px/35px sans-serif; padding: 5px; } @@ -824,12 +832,13 @@ table a:hover { padding: 0; } -.discovercontent table{ - border : none; +.discovercontent table { + border: none; } .discovercontent td { - border : none; + border: none; + text-align: left; } .discovercontent th { @@ -843,6 +852,6 @@ td.jqplot-table-legend { border-width: 0px; } -td.jqplot-table-legend > div { +td.jqplot-table-legend>div { border-width: 0px; } \ No newline at end of file diff --git a/xCAT-UI/js/configure/discover.js b/xCAT-UI/js/configure/discover.js index 8c546d7da..82e212be5 100644 --- a/xCAT-UI/js/configure/discover.js +++ b/xCAT-UI/js/configure/discover.js @@ -40,36 +40,30 @@ function createDiscoverButtons(){ var nextButton = createNextButton(); var cancelButton = createCancelButton(); - if (backButton){ + if (backButton) buttonDiv.append(backButton); - } - if (nextButton){ + if (nextButton) buttonDiv.append(nextButton); - } - if (cancelButton){ + if (cancelButton) buttonDiv.append(cancelButton); - } $('#discoverContentDiv').append(buttonDiv); } function createCancelButton(){ - if (0 == currentStep){ + if (0 == currentStep) return undefined; - } - if ((steps.length - 1) == currentStep){ + if ((steps.length - 1) == currentStep) return undefined; - } var cancelbutton = createButton('Cancel'); cancelbutton.bind('click', function(){ $('#discoverTab').empty(); - for (var name in discoverEnv){ + for (var name in discoverEnv) removeDiscoverEnv(name); - } loadDiscoverPage(); }); @@ -83,19 +77,16 @@ function createCancelButton(){ */ function createNextButton(){ var tempFlag = true; - if ((steps.length - 1) == currentStep){ + if ((steps.length - 1) == currentStep) return undefined; - } var nextButton = createButton('Next'); nextButton.bind('click', function(){ - if (nextFunctions[currentStep]){ + if (nextFunctions[currentStep]) tempFlag = nextFunctions[currentStep]('next'); - } - if (!tempFlag){ + if (!tempFlag) return; - } currentStep ++; initFunctions[currentStep]('next'); }); @@ -110,19 +101,16 @@ function createNextButton(){ */ function createBackButton(){ var tempFlag = true; - if (0 == currentStep){ + if (0 == currentStep) return undefined; - } var backButton = createButton('Back'); backButton.bind('click', function(){ - if (nextFunctions[currentStep]){ + if (nextFunctions[currentStep]) tempFlag = nextFunctions[currentStep]('back'); - } - if (!tempFlag){ + if (!tempFlag) return; - } currentStep--; @@ -142,12 +130,10 @@ function createBackButton(){ * else return null. */ function getDiscoverEnv(envName){ - if (discoverEnv[envName]){ + if (discoverEnv[envName]) return discoverEnv[envName]; - } - else{ + else return ''; - } } /** @@ -160,9 +146,8 @@ function getDiscoverEnv(envName){ * @return nothing */ function setDiscoverEnv(envName, envValue){ - if (envName){ + if (envName) discoverEnv[envName] = envValue; - } } /** @@ -173,9 +158,8 @@ function setDiscoverEnv(envName, envValue){ * @return nothing */ function removeDiscoverEnv(envName){ - if (discoverEnv[envName]){ + if (discoverEnv[envName]) delete discoverEnv[envName]; - } } /** @@ -187,25 +171,23 @@ function removeDiscoverEnv(envName){ function expandNR(nodeRange){ var retArray = new Array(); var tempResult; - if ('' == nodeRange){ + if ('' == nodeRange) return retArray; - } tempResult = nodeRange.match(/(.*?)\[(.*?)\](.*)/); if (null != tempResult){ var parts = tempResult[2].split('-'); - if (2 > parts.length){ + if (2 > parts.length) return retArray; - } var start = Number(parts[0]); var end = Number(parts[1]); var len = parts[0].length; for (var i = parts[0]; i <= parts[1]; i++){ var ts = i.toString(); - if (ts.length < len){ + if (ts.length < len) ts = "000000".substring(0, (len - ts.length)) + ts; - } + retArray = retArray.concat(expandNR(tempResult[1] + ts + tempResult[3])); } return retArray; @@ -238,9 +220,8 @@ function expandNR(nodeRange){ var len = begin[2].length; for (var i = begin[2]; i <= end[2]; i++){ var ts = i.toString(); - if (ts.length < len){ + if (ts.length < len) ts = "000000".substring(0, (len - ts.length)) + ts; - } retArray.push(prefix + ts); } @@ -257,12 +238,10 @@ 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{ + else removeDiscoverEnv(name); - } }); return true; @@ -289,9 +268,8 @@ function verifyIp(ip){ * @return decimal type ip address */ function ip2Decimal(ip){ - if (!verifyIp(ip)){ + if (!verifyIp(ip)) return 0; - } var retIp = 0; var tempArray = ip.split('.'); @@ -303,6 +281,7 @@ function ip2Decimal(ip){ retIp = retIp >>> 0; return retIp; } + /** * calculate the end IP address by start IP and the number of IP range. * @@ -343,6 +322,7 @@ function calcEndIp(ipStart, num){ ipArray[0] = ipArray[0] + parseInt(sum / 255); return (ipArray.join('.')); } + /** * Step 1: show the wizard's function * platform selector(system P or system X) @@ -350,27 +330,34 @@ function calcEndIp(ipStart, num){ * @return nothing */ function initSelectPlatform(){ - var temp = ''; var type = ''; + $('#discoverContentDiv').empty(); $('.tooltip').remove(); - temp += '

' + steps[currentStep] + '

'; - temp += '

This wizard will guide you through the process of defining the naming conventions within' + - 'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT' + - 'database.
Choose which type of hardware you want to discover, and then click Next.

'; - temp += '
'; - temp += ' Blade Center
'; - temp += ' System p hardware (P7 IH)
'; - temp += ' System p hardware (Non P7 IH)
'; - temp += '
'; - $('#discoverContentDiv').append(temp); - if (getDiscoverEnv('machineType')){ + var selectPlatform = $('

' + steps[currentStep] + '

'); + + var infoMsg = 'This wizard will guide you through the process of defining the naming conventions within' + + 'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT' + + 'database. Choose which type of hardware you want to discover, and then click Next.'; + var info = createInfoBar(infoMsg); + selectPlatform.append(info); + + var hwList = $('
    Platforms available:
'); + hwList.append('
  • '); + hwList.append('
  • BladeCenter
  • '); + hwList.append('
  • System p hardware (P7 IH)
  • '); + hwList.append('
  • System p hardware (Non P7 IH)
  • '); + + hwList.find('li').css('padding', '2px 10px'); + selectPlatform.append(hwList); + + $('#discoverContentDiv').append(selectPlatform); + + if (getDiscoverEnv('machineType')) type = getDiscoverEnv('machineType'); - } - else{ + else type = 'ih'; - } $('#discoverContentDiv #' + type).attr('checked', 'checked'); createDiscoverButtons(); @@ -386,19 +373,16 @@ function getPlatform(){ var platformObj; switch(radioValue){ case 'ih': - case 'nonih':{ + case 'nonih': platformObj = new hmcPlugin(); - } - break; - case 'idataplex':{ + break; + case 'idataplex': platformObj = new ipmiPlugin(); - } - break; - case 'blade':{ - - } - break; + break; + case 'blade': + break; } + steps = ['Platform'].concat(platformObj.getStep(), 'compelte'); initFunctions = [initSelectPlatform].concat(platformObj.getInitFunction(), complete); nextFunctions = [getPlatform].concat(platformObj.getNextFunction(), undefined); diff --git a/xCAT-UI/js/configure/update.js b/xCAT-UI/js/configure/update.js index 2f1eb7849..0478576f5 100644 --- a/xCAT-UI/js/configure/update.js +++ b/xCAT-UI/js/configure/update.js @@ -53,12 +53,13 @@ function showRepository(data) { var show = ""; // Get the corresponding repository by OS Type - if ("aix" == data.rsp) { + if (data.rsp == "aix") { + // No repository exists for AIX on sourceforge! develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/"; stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/"; } else { - develRepository = "http://xcat.sourceforge.net/yum/devel/xcat-core/"; - stableRepository = "http://xcat.sourceforge.net/yum/xcat-core/"; + develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/"; + stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/"; } var repoList = $('
      '); diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index 0980c1888..96ba4afca 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -187,7 +187,7 @@ bladePlugin.prototype.loadResources = function() { $('#' + tabId).find('img').remove(); // Create info bar - var infoBar = createInfoBar('Under construction'); + var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js index 76ac78bee..1c92d79bb 100644 --- a/xCAT-UI/js/custom/customUtils.js +++ b/xCAT-UI/js/custom/customUtils.js @@ -255,7 +255,7 @@ function createProvisionExisting(plugin, inst) { var provisionBtn = createButton('Provision'); provisionBtn.bind('click', function(event) { // TODO Insert provision code here - openDialog('info', 'Under construction'); + openDialog('info', 'Not yet supported'); }); provExisting.append(provisionBtn); @@ -377,7 +377,7 @@ function createProvisionNew(plugin, inst) { var provisionBtn = createButton('Provision'); provisionBtn.bind('click', function(event) { // TODO Insert provision code here - openDialog('info', 'Under construction'); + openDialog('info', 'Not yet supported'); }); provNew.append(provisionBtn); diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 6d4dc4065..76a230022 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -466,7 +466,7 @@ esxPlugin.prototype.loadResources = function() { $('#' + tabId).find('img').remove(); // Create info bar - var infoBar = createInfoBar('Under construction'); + var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index 0feb19263..38aae66e8 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -167,7 +167,7 @@ hmcPlugin.prototype.loadClonePage = function(node) { var statBar = $('
      ').hide(); // Create info bar - var infoBar = createInfoBar('Under construction'); + var infoBar = createInfoBar('Not yet supported'); // Create clone form var cloneForm = $('
      '); @@ -218,7 +218,7 @@ hmcPlugin.prototype.loadResources = function() { $('#' + tabId).find('img').remove(); // Create info bar - var infoBar = createInfoBar('Under construction'); + var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index da99f1d0b..426751db4 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -208,7 +208,7 @@ ipmiPlugin.prototype.loadResources = function() { $('#' + tabId).find('img').remove(); // Create info bar - var infoBar = createInfoBar('Under construction'); + var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js index 1388bde83..7a461c44b 100644 --- a/xCAT-UI/js/custom/kvm.js +++ b/xCAT-UI/js/custom/kvm.js @@ -465,7 +465,7 @@ kvmPlugin.prototype.loadResources = function() { $('#' + tabId).find('img').remove(); // Create info bar - var infoBar = createInfoBar('Under construction'); + var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index d3ac8e98f..c8e810b7f 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -545,6 +545,24 @@ zvmPlugin.prototype.loadClonePage = function(node) { group.append(groupLabel); group.append(groupInput); vmAttr.append(group); + + // Create an advanced link to set IP address and hostname + var advancedLnk = $('
      '); + vmAttr.append(advancedLnk); + var advanced = $('
      ').hide(); + vmAttr.append(advanced); + + var ip = $('
      '); + advanced.append(ip); + var hostname = $('
      '); + advanced.append(hostname); + + // Show IP address and hostname inputs on-click + advancedLnk.click(function() { + advanced.toggle(); + }); // Get list of disk pools var temp = hcp.split('.'); @@ -610,9 +628,13 @@ zvmPlugin.prototype.loadClonePage = function(node) { var nodeRange = $('#' + newTabId + ' input[name=tgtNode]').val(); // Get target user ID var userIdRange = $('#' + newTabId + ' input[name=tgtUserId]').val(); + // Get IP address range + var ipRange = $('#' + newTabId + ' input[name=ip]').val(); + // Get hostname range + var hostnameRange = $('#' + newTabId + ' input[name=hostname]').val(); // Check node range and user ID range - if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) { + if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1 || ipRange.indexOf('-') > -1 || hostnameRange.indexOf('-') > -1) { if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) { errMsg = errMsg + 'A user ID range and node range needs to be given.
      '; ready = false; @@ -634,13 +656,45 @@ zvmPlugin.prototype.loadClonePage = function(node) { var userIdStart = parseInt(tmp[0].match(/\d+/)); // Get ending index var userIdEnd = parseInt(tmp[1].match(/\d+/)); - + + var ipStart = "", ipEnd = ""; + if (ipRange) { + tmp = ipRange.split('-'); + + // Get starting IP address + ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1); + // Get ending IP address + ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1); + } + + var hostnameStart = "", hostnameEnd = ""; + if (hostnameRange) { + tmp = hostnameRange.split('-'); + + // Get starting hostname + hostnameStart = parseInt(tmp[0].substring(0, tmp[0].indexOf(".")).match(/\d+/)); + // Get ending hostname + hostnameEnd = parseInt(tmp[1].substring(0, tmp[1].indexOf(".")).match(/\d+/)); + } + // If starting and ending index do not match if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) { // Not ready to provision errMsg = errMsg + 'The node range and user ID range does not match.
      '; ready = false; } + + // If an IP address range is given and the starting and ending index do not match + if (ipRange && !(nodeStart == ipStart) || !(nodeEnd == ipEnd)) { + errMsg = errMsg + 'The node range and IP address range does not match. '; + ready = false; + } + + // If a hostname range is given and the starting and ending index do not match + if (hostnameRange && !(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd)) { + errMsg = errMsg + 'The node range and hostname range does not match. '; + ready = false; + } } } @@ -672,17 +726,45 @@ zvmPlugin.prototype.loadClonePage = function(node) { // Get user ID base name var userIdBase = tmp[0].match(/[a-zA-Z]+/); - // Get starting index - var userIdStart = parseInt(tmp[0].match(/\d+/)); - // Get ending index - var userIdEnd = parseInt(tmp[1].match(/\d+/)); - + + var ipBase = ""; + if (ipRange) { + tmp = ipRange.split('-'); + + // Get network base + ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1); + } + + var domain = ""; + if (hostnameRange) { + tmp = hostnameRange.split('-'); + + // Get domain name + domain = tmp[0].substring(tmp[0].indexOf(".")); + } + // Loop through each node in the node range for ( var i = nodeStart; i <= nodeEnd; i++) { var node = nodeBase + i.toString(); var userId = userIdBase + i.toString(); var inst = i + '/' + nodeEnd; - + + var args = node + + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userId + + ';nodehm.mgt=zvm' + + ';groups=' + group; + + if (ipRange) { + var ip = ipBase + i.toString(); + args += ';hosts.ip=' + ip; + } + + if (hostnameRange) { + var hostname = node + domain; + args += ';hosts.hostnames=' + hostname; + } + /** * (1) Define node */ @@ -692,10 +774,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { data : { cmd : 'nodeadd', tgt : '', - args : node + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userId - + ';nodehm.mgt=zvm' - + ';groups=' + group, + args : args, msg : 'cmd=nodeadd;inst=' + inst + ';out=' + statBarId + ';node=' + node @@ -704,7 +783,19 @@ zvmPlugin.prototype.loadClonePage = function(node) { success : updateZCloneStatus }); } - } else { + } else { + var args = nodeRange + + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userIdRange + + ';nodehm.mgt=zvm' + + ';groups=' + group; + + if (ipRange) + args += ';hosts.ip=' + ipRange; + + if (hostnameRange) + args += ';hosts.hostnames=' + hostnameRange; + /** * (1) Define node */ @@ -714,10 +805,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { data : { cmd : 'nodeadd', tgt : '', - args : nodeRange + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userIdRange - + ';nodehm.mgt=zvm' - + ';groups=' + group, + args : args, msg : 'cmd=nodeadd;inst=1/1;out=' + statBarId + ';node=' + nodeRange }, @@ -727,8 +815,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { } // Create loader - var loader = createLoader(''); - $('#' + statBarId).find('div').append(loader); + $('#' + statBarId).find('div').append(createLoader()); $('#' + statBarId).show(); // Disable clone button @@ -1388,8 +1475,9 @@ zvmPlugin.prototype.addNode = function() { var info = createInfoBar('Add a z/VM node range'); addNodeForm.append(info); addNodeForm.append('
      '); - addNodeForm.append('
      '); addNodeForm.append('
      '); + addNodeForm.append('
      '); + addNodeForm.append('
      '); addNodeForm.append('
      '); addNodeForm.append('
      '); @@ -1406,6 +1494,7 @@ zvmPlugin.prototype.addNode = function() { // Get inputs var nodeRange = $(this).find('input[name=node]').val(); var ipRange = $(this).find('input[name=ip]').val(); + var hostnameRange = $(this).find('input[name=hostname]').val(); var userIdRange = $(this).find('input[name=userId]').val(); var group = $(this).find('input[name=groups]').val(); var hcp = $(this).find('input[name=hcp]').val(); @@ -1420,7 +1509,7 @@ zvmPlugin.prototype.addNode = function() { var errMsg = ''; var ready = true; if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) { - if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0 || ipRange.indexOf('-') < 0) { + if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) { errMsg = errMsg + 'A user ID range and node range needs to be given. '; ready = false; } else { @@ -1438,12 +1527,25 @@ zvmPlugin.prototype.addNode = function() { // Get ending index var userIdEnd = parseInt(tmp[1].match(/\d+/)); - tmp = ipRange.split('-'); - - // Get starting IP address - var ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1); - // Get ending IP address - var ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1); + var ipStart = "", ipEnd = ""; + if (ipRange) { + tmp = ipRange.split('-'); + + // Get starting IP address + ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1); + // Get ending IP address + ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1); + } + + var hostnameStart = "", hostnameEnd = ""; + if (hostnameRange) { + tmp = hostnameRange.split('-'); + + // Get starting hostname + hostnameStart = parseInt(tmp[0].substring(0, tmp[0].indexOf(".")).match(/\d+/)); + // Get ending hostname + hostnameEnd = parseInt(tmp[1].substring(0, tmp[1].indexOf(".")).match(/\d+/)); + } // If starting and ending index do not match if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) { @@ -1456,6 +1558,12 @@ zvmPlugin.prototype.addNode = function() { errMsg = errMsg + 'The node range and IP address range does not match. '; ready = false; } + + // If a hostname range is given and the starting and ending index do not match + if (hostnameRange && !(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd)) { + errMsg = errMsg + 'The node range and hostname range does not match. '; + ready = false; + } } } @@ -1485,27 +1593,43 @@ zvmPlugin.prototype.addNode = function() { // Get user ID base name var userIdBase = tmp[0].match(/[a-zA-Z]+/); - // Get starting index - var userIdStart = parseInt(tmp[0].match(/\d+/)); - // Get ending index - var userIdEnd = parseInt(tmp[1].match(/\d+/)); - tmp = ipRange.split('-'); - - // Get network base - var ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1); - // Get starting IP address - var ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1); - // Get ending IP address - var ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1); + var ipBase = ""; + if (ipRange) { + tmp = ipRange.split('-'); + + // Get network base + ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1); + } + + var domain = ""; + if (hostnameRange) { + tmp = hostnameRange.split('-'); + + // Get domain name + domain = tmp[0].substring(tmp[0].indexOf(".")); + } // Loop through each node in the node range for ( var i = nodeStart; i <= nodeEnd; i++) { var node = nodeBase + i.toString(); var userId = userIdBase + i.toString(); - var ip = ipBase + i.toString(); var inst = i + '/' + nodeEnd; + var args = node + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userId + + ';nodehm.mgt=zvm' + ';groups=' + group; + + if (ipRange) { + var ip = ipBase + i.toString(); + args += ';hosts.ip=' + ip; + } + + if (hostnameRange) { + var hostname = node + domain; + args += ';hosts.hostnames=' + hostname; + } + /** * (1) Define node */ @@ -1515,10 +1639,7 @@ zvmPlugin.prototype.addNode = function() { data : { cmd : 'nodeadd', tgt : '', - args : node + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userId - + ';nodehm.mgt=zvm' + ';groups=' + group - + ';hosts.ip=' + ip, + args : args, msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange }, @@ -1567,6 +1688,16 @@ zvmPlugin.prototype.addNode = function() { }); } } else { + var args = nodeRange + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userIdRange + + ';nodehm.mgt=zvm' + ';groups=' + group; + + if (ipRange) + args += ';hosts.ip=' + ipRange; + + if (hostnameRange) + args += ';hosts.hostnames=' + hostnameRange; + // Only one node to add $.ajax( { url : 'lib/cmd.php', @@ -1574,10 +1705,7 @@ zvmPlugin.prototype.addNode = function() { data : { cmd : 'nodeadd', tgt : '', - args : nodeRange + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userIdRange - + ';nodehm.mgt=zvm' + ';groups=' + group - + ';hosts.ip=' + ipRange, + args : args, msg : 'cmd=addnewnode;node=' + nodeRange }, diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 34e09320d..ca55c3ea1 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -101,8 +101,8 @@ function loadHcpInfo(data) { } // End of if (hcp) } else { // Create warning dialog - var msg = createWarnBar('z/VM SMAPI is not responding to ' + hcp + '. It needs to be reset.'); - var warnDialog = $('
      ').append(msg); + var warning = createWarnBar('z/VM SMAPI is not responding to ' + hcp + '. It needs to be reset.'); + var warnDialog = $('
      ').append(warning); // Open dialog warnDialog.dialog({ @@ -2279,6 +2279,24 @@ function createZProvisionNew(inst) { hcpDiv.append(hcpInput); vmAttr.append(hcpDiv); + // Create an advanced link to set IP address and hostname + var advancedLnk = $('
      '); + vmAttr.append(advancedLnk); + var advanced = $('
      ').hide(); + vmAttr.append(advanced); + + var ip = $('
      '); + advanced.append(ip); + var hostname = $('
      '); + advanced.append(hostname); + + // Show IP address and hostname inputs on-click + advancedLnk.click(function() { + advanced.toggle(); + }); + // Create operating system image input var os = $('
      '); var osLabel = $(''); @@ -2568,7 +2586,7 @@ function createZProvisionNew(inst) { diskArgs.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + // If inputs are valid, ready to provision if (ready) { if (!os.val()) { @@ -2627,6 +2645,20 @@ function createZProvisionNew(inst) { var hcp = $('#' + thisTabId + ' input[name=hcp]').val(); // Get group var group = $('#' + thisTabId + ' input[name=group]').val(); + // Get IP address and hostname + var ip = $('#' + thisTabId + ' input[name=ip]').val(); + var hostname = $('#' + thisTabId + ' input[name=hostname]').val(); + + // Generate arguments to sent + var args = node + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userId + + ';nodehm.mgt=zvm' + + ';groups=' + group; + if (ip) + args += ';hosts.ip=' + ip; + + if (hostname) + args += ';hosts.hostnames=' + hostname; /** * (1) Define node @@ -2637,9 +2669,7 @@ function createZProvisionNew(inst) { data : { cmd : 'nodeadd', tgt : '', - args : node + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userId - + ';nodehm.mgt=zvm' + ';groups=' + group, + args : args, msg : 'cmd=nodeadd;out=' + inst }, @@ -2702,6 +2732,20 @@ function createZProvisionNew(inst) { var hcp = $('#' + thisTabId + ' input[name=hcp]').val(); // Get group var group = $('#' + thisTabId + ' input[name=group]').val(); + // Get IP address and hostname + var ip = $('#' + thisTabId + ' input[name=ip]').val(); + var hostname = $('#' + thisTabId + ' input[name=hostname]').val(); + + // Generate arguments to sent + var args = node + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userId + + ';nodehm.mgt=zvm' + + ';groups=' + group; + if (ip) + args += ';hosts.ip=' + ip; + + if (hostname) + args += ';hosts.hostnames=' + hostname; /** * (1) Define node @@ -2712,9 +2756,7 @@ function createZProvisionNew(inst) { data : { cmd : 'nodeadd', tgt : '', - args : node + ';zvm.hcp=' + hcp + ';zvm.userid=' - + userId + ';nodehm.mgt=zvm' + ';groups=' - + group, + args : args, msg : 'cmd=nodeadd;out=' + inst }, diff --git a/xCAT-UI/js/monitor/monitor.js b/xCAT-UI/js/monitor/monitor.js index 0e0bfd7db..81f6bff13 100644 --- a/xCAT-UI/js/monitor/monitor.js +++ b/xCAT-UI/js/monitor/monitor.js @@ -152,7 +152,7 @@ function loadMonitorPage() { var pcpMon = $(''); pcpMon.append($('PCP')); pcpMon.append($('').append(statusButtonHash['pcpmon'])); - pcpMon.append($('Under construction.')); + pcpMon.append($('Not yet supported')); monTableBody.append(pcpMon); // Do not word wrap @@ -303,7 +303,7 @@ function loadMonitorTab(name) { */ function loadUnfinish(monitorName, tab) { var unfinishPage = $('
      '); - unfinishPage.append(createInfoBar('Under construction')); + unfinishPage.append(createInfoBar('Not yet supported')); tab.add(monitorName, 'Unfinished', unfinishPage, true); } diff --git a/xCAT-UI/js/monitor/rmcmon.js b/xCAT-UI/js/monitor/rmcmon.js index bb396fa21..c2215a251 100644 --- a/xCAT-UI/js/monitor/rmcmon.js +++ b/xCAT-UI/js/monitor/rmcmon.js @@ -898,7 +898,7 @@ function chCondScopeDia() { */ function mkResponseDia() { var diaDiv = $('
      '); - diaDiv.append('under construction.'); + diaDiv.append('Not yet supported.'); diaDiv.dialog({ modal: true, diff --git a/xCAT-UI/js/monitor/xcatmon.js b/xCAT-UI/js/monitor/xcatmon.js index aa57a18e9..aefc78938 100644 --- a/xCAT-UI/js/monitor/xcatmon.js +++ b/xCAT-UI/js/monitor/xcatmon.js @@ -1,161 +1,151 @@ /** - * global variable + * Global variables */ -var XcatmonTableId="XcatMonsettingTable"; +var xcatMonTableId = "xcatMonSettingTable"; /** - * load xCAT monitor + * Load xCAT monitoring */ -function loadXcatMon(){ - //find the xcat mon tab +function loadXcatMon() { + // Find xCAT monitoring tab var xcatMonTab = $('#xcatmon'); - xcatMonTab.append("
      "); - - //show the content of the table monsetting + + // Show content of monsetting table $.ajax({ - url:'lib/cmd.php', - dataType: 'json', - data:{ + url : 'lib/cmd.php', + dataType : 'json', + data : { cmd : 'tabdump', - tgt :'', + tgt : '', args : 'monsetting', msg : '' }, - success: loadXcatMonSetting - }); + success : loadXcatMonSetting + }); } -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 +function loadXcatMonSetting(data) { + var apps = ""; // Contains the xcatmon config + var rsp = data.rsp; + var apps_flag = 0; + var ping; // xcatmon ping interval 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 are finished configuring the xCAT monitor, click on Apply.'); + // Create an info bar + 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 - var XcatmonTable= new DataTable(XcatmonTableId); - - //create Datatable + + // Create xcatmon table + var xcatmonTable = new DataTable(xcatMonTableId); + + // Create datatable var dTable; - - //create the xcatmonTable header - var header=rsp[0].split(","); - header.splice(3,2); - header.splice(0,1); - header[0]="apps name"; - header[1]="configure"; + + // Create table header + var header = rsp[0].split(","); + header.splice(3, 2); + header.splice(0, 1); + header[0] = "App Name"; + header[1] = "Configure"; header.push(''); - header.unshift(''); - XcatmonTable.init(header); //create the table header + xcatmonTable.init(header); - //create container of original table contents - var origCont= new Array(); - origCont[0]=header; //table header + // Create container for original table contents + var origCont = new Array(); + origCont[0] = header; // Table headers - //create contariner for new contents use for update the monsetting table - var newCont =new Object(); - newCont[0]=rsp[0].split(","); //table header - - //create container for other monsetting lines not xcatmon - var otherCont =new Array(); + // Create container for new contents to use later updating monsetting table + var newCont = new Object(); + newCont[0] = rsp[0].split(","); // Table headers - $('#xcatmonTable').append(XcatmonTable.object()); //add table object - var m = 1; //the count for origCont + // Create container for other monsetting lines + var otherCont = new Array(); + + $('#xcatmonTable').append(xcatmonTable.object()); + var m = 1; // Count for origCont var n = 0; - for (var i=1; i'); - cols.unshift(''); - - //add the column tho the table - XcatmonTable.add(cols); - + + cols.splice(3, 2); + cols.splice(0, 1); + cols.push(''); + cols.unshift(''); + + // Add column to table + 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(','); - - for (var j=0; j -1) { + apps = rsp[i].split(','); + + for ( var j = 0; j < apps.length; j++) { + 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[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 + + // Get into the ping settings if (!ping_flag) { - //check the ping-interval config + // Check the ping interval if (rsp[i].indexOf("ping-interval") > -1) { - ping=rsp[i].split(','); - //pair the semicolon - for (var j=0; j'); + origCont[j].splice(3, 1); + origCont[j].push(''); } } } $(":checkbox").tooltip(); - //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({ - 'iDisplayLength': 50, - 'bLengthChange': false, - "sScrollX": "100%", - "bAutoWidth": true + // 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' }); - //create action bar + // Save datatable + dTable = $('#' + xcatMonTableId).dataTable({ + 'iDisplayLength' : 50, + 'bLengthChange' : false, + "sScrollX" : "100%", + "bAutoWidth" : true + }); + + // Create action bar var actionBar = $('
      '); var addRowLnk = $('Add row'); addRowLnk.bind('click', function(event) { - //create the container of the new row + // Create container for 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'); + for ( var i = 0; i < header.length - 2; i++) row.push(''); - } - - //add the checkbox - row.push(''); - //get the datatable of the table - var dTable = $('#' + XcatmonTableId).dataTable(); - //add the new row to the datatable + + // Add checkbox + row.push(''); + // Get the datatable of the table + var dTable = $('#' + xcatMonTableId).dataTable(); + // Add the new row to the datatable dTable.fnAddData(row); - - //make the datatable editable + + // 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' - } - ); + $('#' + 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. - */ + + // Create apply button to store the contents of the table to the monsetting table var applyLnk = $('Apply'); - applyLnk.bind('click', function(event){ - //get the datatable of the page - var dTable = $('#' + XcatmonTableId).dataTable(); - //get the rows of the datatable - var dRows = dTable.fnGetNodes(); + applyLnk.bind('click', function(event) { + // Get the datatable + var dTable = $('#' + xcatMonTableId).dataTable(); + // Get datatable rows + var dRows = dTable.fnGetNodes(); var count = 0; - //create the new container of the apps' value. + + // Create a new container for the apps value var appValue = ''; var tableName = 'monsetting'; - var tmp; - var tmp1; var closeBtn = createButton('close'); - - //get the contain of the rows - for (var i=0; i'); + 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 - origCont[i+1] = vals_orig; - 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. - appValue = appValue.concat(cols.item(2).firstChild.nodeValue+","); + vals_orig.push(''); } + + // Add delete button to row + vals_orig.unshift(''); + // Add row to origCont + origCont[i + 1] = vals_orig; + count = i + 1; + + // Check checkbox for every row when merging the app name with the apps values + if (cols.item(cols.length - 1).firstChild.checked) + appValue = appValue.concat(cols.item(2).firstChild.nodeValue + ","); } } - + count++; - //delete the last "," of the apps value - appValue = appValue.substring(0,(appValue.length-1)); - apps[2] = appValue; - //newCont add the apps row + // Delete the last comma of the apps value + appValue = appValue.substring(0, (appValue.length - 1)); + apps[2] = appValue; + newCont[count++] = apps; - //newCont add the ping-interval row newCont[count++] = ping; - //add the other monitor setting of the mosetting - for (var j=0; jsaving the configuration
      '); - dialogSave.append(createLoader()); - $('#xcatmon').append(dialogSave); - //open the dialog..modal is true - $("#saveDialog").dialog({modal: true}); - //hide the cross... - $('.ui-dialog-titlebar-close').hide(); - //put the table name and the contain to the tabRestore.php + // Create save dialog + var dialogSave = $('
      Saving configuration
      '); + dialogSave.append(createLoader()); + + $('#xcatmon').append(dialogSave); + $("#saveDialog").dialog({ + modal : true + }); + + $('.ui-dialog-titlebar-close').hide(); $.ajax({ type : 'POST', url : 'lib/tabRestore.php', @@ -362,83 +332,76 @@ function loadXcatMonSetting(data){ table : tableName, cont : newCont }, - success : function(data){ - //empty the dialog.add the close button - $("#saveDialog").empty().append('

      The Configure has saved!

      '); + success : function(data) { + // empty the dialog.add the close button + $("#saveDialog").empty().append('

      Configuration saved!

      '); $("#saveDialog").append(closeBtn); } - }); - - //close button function - closeBtn.bind('click', function(event){ - $("#saveDialog").dialog("distroy"); + + // Close button + closeBtn.bind('click', function(event) { + $("#saveDialog").dialog("destroy"); $("#saveDialog").remove(); - }); - //clear the newCont + // Clear the newCont newCont = null; newCont = new Object(); - //just for tmp=newCont; newCont[0] = rsp[0].split(","); }); - + var cancelLnk = $('Cancel'); - cancelLnk.bind('click', function(event){ - //get the datatable of the page - var dTable = $('#' + XcatmonTableId).dataTable(); - - //clear the datatable + cancelLnk.bind('click', function(event) { + // Get the datatable for the page + var dTable = $('#' + xcatMonTableId).dataTable(); + + // Clear the datatable dTable.fnClearTable(); - //add the contain of the origCont to the datatable - for (var i=1; i
      '); - $('#' + XcatmonTableId + '_wrapper').prepend(menuDiv); - menuDiv.append(actionBar); - $('#' + XcatmonTableId + '_filter').appendTo(menuDiv); + + // Create a division to hold actions menu + var menuDiv = $(''); + $('#' + xcatMonTableId + '_wrapper').prepend(menuDiv); + menuDiv.append(actionBar); + $('#' + xcatMonTableId + '_filter').appendTo(menuDiv); } /** - * delete a row from the table + * Delete a row from the table */ -function deleteRow1(obj){ - var dTable = $('#' + XcatmonTableId).dataTable(); +function deleteXcatMonRow(obj) { + var dTable = $('#' + xcatMonTableId).dataTable(); var rows = dTable.fnGetNodes(); var tgtRow = $(obj).parent().parent().get(0); - for (var i in rows) { + for ( var i in rows) { if (rows[i] == tgtRow) { - dTable.fnDeleteRow(i, null,true); + dTable.fnDeleteRow(i, null, true); break; } } diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 26b648802..42f9a7cf3 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -2402,10 +2402,10 @@ function loadRconsPage(tgtNodes){ redirectUrl += hostName; pos = urlPath.lastIndexOf('/'); redirectUrl += urlPath.substring(0, pos + 1); - redirectUrl += 'rconsShow.php'; + redirectUrl += 'rcons.php'; // Open the rcons page - window.open(redirectUrl + "?rconsnd=" + tgtNodes, '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=670,height=436"); + window.open(redirectUrl + "?rconsnd=" + tgtNodes, '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=590,height=436"); } /** @@ -3266,7 +3266,7 @@ function advancedLoad(group){ } /** - * Jump to provision page onclick + * Jump to provision page on-click * * @param tgtNodes * Target nodes @@ -3281,7 +3281,7 @@ function jump2Provision(tgtNodes){ var master = ''; var tftpserver = ''; var nfsserver = ''; - var diaDiv = $('
      '); + var diaDiv = $('
      '); // Check the first node's arch type for (index in nodeArray){ @@ -3293,7 +3293,7 @@ function jump2Provision(tgtNodes){ break; } - if (0 == index) { + if (index == 0) { archType = origAttrs[nodeName]['arch']; } @@ -3313,11 +3313,11 @@ function jump2Provision(tgtNodes){ } if (archType.indexOf('390') != -1) { - errorMsg += 'Please use the provision page.'; + errorMsg += 'Please use the provision page'; } // Open dialog to show error message - if ('' != errorMsg){ + if (errorMsg){ diaDiv.append(createWarnBar(errorMsg)); diaDiv.dialog({ modal: true, diff --git a/xCAT-UI/js/nodes/physical.js b/xCAT-UI/js/nodes/physical.js index 13fc1293a..83b2a34ee 100644 --- a/xCAT-UI/js/nodes/physical.js +++ b/xCAT-UI/js/nodes/physical.js @@ -254,7 +254,7 @@ function fillList(nodeName, defaultnodetype){ function createGraphical(){ var tabarea = $('#graphTab'); - var selectNodeDiv = $('
      Nodes:
      '); + var selectNodeDiv = $('
      '); var temp = 0; for (var i in selectNode){ temp ++; @@ -262,7 +262,7 @@ function createGraphical(){ } //there is not selected lpars, show the info bar - if (0 == temp){ + if (temp == 0){ tabarea.append(createInfoBar('Hover over a CEC and select the LPARs to do operations against.')); } //show selected lpars @@ -578,19 +578,23 @@ function createSystemxGraphical(xnodes, area){ } } -function addUnknownGraphical(unknownnode, area){ - var graphTab = $('#graphTab'); - var index = 0; - - if (unknownnode.length < 1){ +function addUnknownGraphical(unknownNodes, tab){ + // Do not continue if no nodes were found + if (unknownNodes.length < 1) return; + + var list = ""; + tab.append('
      '); + for (var index in unknownNodes){ + list += unknownNodes[index] + ', '; + } - graphTab.append('Unknown Type Nodes:
      '); - for (index in unknownnode){ - graphTab.append(unknownnode[index] + '; '); - } + // Delete last comma + list = list.substr(0, list.length - 2); + tab.append(list); } + /** * update the lpars' background in cec, lpars area and selectNode * @@ -602,13 +606,15 @@ function updateSelectNodeDiv(){ $('#selectNodeDiv').empty(); //add buttons - $('#selectNodeDiv').append('Nodes: '); - for(var lparName in selectNode){ - $('#selectNodeDiv').append(lparName + ' '); - temp ++; - if (6 < temp){ - $('#selectNodeDiv').append('...'); - break; + if (selectNode.length) { + $('#selectNodeDiv').append('Nodes: '); + for (var lparName in selectNode){ + $('#selectNodeDiv').append(lparName + ' '); + temp ++; + if (temp > 6){ + $('#selectNodeDiv').append('...'); + break; + } } } } diff --git a/xCAT-UI/js/provision/images.js b/xCAT-UI/js/provision/images.js index 974ace848..e58edf1ec 100644 --- a/xCAT-UI/js/provision/images.js +++ b/xCAT-UI/js/provision/images.js @@ -1,8 +1,8 @@ /** * Global variables */ -var origAttrs = new Object(); // Original image attributes -var defAttrs; // Definable image attributes +var origAttrs = new Object(); // Original image attributes +var defAttrs; // Definable image attributes var imgTableId = 'imagesDatatable'; // Images datatable ID var softwareList = { "rsct" : ["rsct.core.utils", "rsct.core", "src"], @@ -308,8 +308,6 @@ function setImageDefAttrs(data) { /** * Load create image page - * - * @return Nothing */ function loadCreateImage() { // Get nodes tab @@ -322,48 +320,48 @@ function loadCreateImage() { return; } - var imageOsvers = $.cookie("osvers").split(","); + var imageOsVers = $.cookie("osvers").split(","); var imageArch = $.cookie("osarchs").split(","); - var profileArray = $.cookie("profiles").split(","); + var profiles = $.cookie("profiles").split(","); - var parm = ''; - var i = 0; + var createImgForm = $('
      '); + var createImgFS = $('
      ').append('Create Image'); + createImgForm.append(createImgFS); - // Create set properties form - var createImgForm = $('
      '); - - // Show the infomation + // Show info bar var infoBar = createInfoBar('Specify the parameters for the image (stateless or statelite) you want to create, then click Create.'); - createImgForm.append(infoBar); + createImgFS.append(infoBar); - // OS version selector - parm += '
      '; + // Drop down for OS versions + var osVerSelect = $(''); + for (var i in imageOsVers) + osVerSelect.append(''); + createImgFS.append($('
      ').append(osVerSelect)); - // OS arch selector - parm += '
      '; + // Drop down for OS architectures + var imgSelect = $(''); + for (var i in imageArch) + imgSelect.append(''); + createImgFS.append($('
      ').append(imgSelect)); // Netboot interface input - parm += '
      '; + createImgFS.append($('
      ')); // Profile selector - parm += '
      '; + var profileSelect = $(''; - createImgForm.append(parm); - createHpcSelect(createImgForm); + // Boot method drop down + createImgFS.append($('
      ' + + '
      ')); + + // Create HPC software stack fieldset + createHpcFS(createImgForm); // The button used to create images is created here var createImageBtn = createButton("Create"); @@ -373,39 +371,40 @@ function loadCreateImage() { createImgForm.append(createImageBtn); - // Add and show the tab + // Add tab tab.add(tabId, 'Create', createImgForm, true); tab.select(tabId); - // Check the selected osver and osarch for hcp stack select - // If they are valid, show the hpc stack select area + // Check the selected OS version and OS arch for HPC stack + // If they are valid, show the HCP stack fieldset hpcShow(); } /** - * Create HPC select + * Create HPC fieldset * * @param container - * The container to hold the HPC select - * @return HPC select appended to the container + * The container to hold the HPC fieldset + * @return Nothing */ -function createHpcSelect(container) { +function createHpcFS(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, ' + + var str = 'Before selecting the software, you should have the following already completed on your xCAT cluster:

      ' + + '1. If you are using the xCAT hierarchy, your service nodes are installed and running.
      ' + + '2. Your compute nodes are defined in 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.
      '; + + '3. You should have a diskless image created with the base OS installed and verified it on at least one test node.
      ' + + '4. You should install the software on the management node and copy all correponding packages into the location "/install/custom/otherpkgs/" based on ' + + 'these documents.
      '; hpcFieldset.append(createInfoBar(str)); - // Advanced software when select the compute profile + // Advanced software str = '
      ' + '
      '; diff --git a/xCAT-UI/js/rcons/rcons.js b/xCAT-UI/js/rcons/rcons.js index bc190eb7d..9bb776d38 100644 --- a/xCAT-UI/js/rcons/rcons.js +++ b/xCAT-UI/js/rcons/rcons.js @@ -1,67 +1,67 @@ -rconsTerm = function(nodeName, height, width){ - var sid=nodeName; +rconsTerm = function(nodeName, height, width) { + var sid = nodeName; var keyBuf = []; var receivingFlag = false; - var sendTimeout; - var errorTimeout; + var sendTimeout = ""; + var errorTimeout = ""; var queryStable = 's=' + sid + '&w=' + height + '&h=' + width + '&c=1&k='; var maxDelay = 200; var firstFlag = true; - - var workingStatus; - var termArea; - var errorArea; - - var ie=0; - if(window.ActiveXObject){ - ie=1; + + var workingStatus = ""; + var termArea = ""; + var errorArea = ""; + + var ie = 0; + if (window.ActiveXObject) { + ie = 1; } - + rconsInit(); - //init - function rconsInit(){ - //create status, configure the css + // init + function rconsInit() { + // create status, configure the css workingStatus = $('.'); workingStatus.attr('class', 'off'); - - //create the disconnect button + + // create the disconnect button var disconnectButton = $('Disconnect'); - disconnectButton.bind('click', function(){ + disconnectButton.bind('click', function() { window.close(); }); - - //create the control panel, add to the rcons div + + // create the control panel, add to the rcons div var controlPanel = $('
      ');
       		$('#term').append(controlPanel);
      -		
      -		//create the error erea
      +
      +		// create the error erea
       		errorArea = $('');
      -		
      -		//add all item to controlPanel
      +
      +		// add all item to controlPanel
       		controlPanel.append(workingStatus);
       		controlPanel.append(disconnectButton);
       		controlPanel.append(errorArea);
      -		
      -		//create the termArea
      +
      +		// create the termArea
       		termArea = $('
      '); $('#term').append(termArea); - - //bind keypress event - document.onkeypress=rconsKeypress; - document.onkeydown=rconsKeydown; - window.onbeforeunload = function(){ + + // bind keypress event + document.onkeypress = rconsKeypress; + document.onkeydown = rconsKeydown; + window.onbeforeunload = function() { rconsDisconnect(); - alert("This rcons page is closed."); + alert("Closing remote console"); }; - + rconsSend(); } - - //close the connection - function rconsDisconnect(){ + + // close the connection + function rconsDisconnect() { window.clearTimeout(sendTimeout); window.clearTimeout(errorTimeout); - + $.ajax({ type : "POST", url : "lib/rcons.php", @@ -70,153 +70,217 @@ rconsTerm = function(nodeName, height, width){ }); } - //translate the key press - function rconsKeypress(event){ - if (!event) var event=window.event; - var kc; - var k=""; + // translate the key press + function rconsKeypress(event) { + if (!event) + var event = window.event; + var kc = ""; + var k = ""; if (event.keyCode) - kc=event.keyCode; + kc = event.keyCode; if (event.which) - kc=event.which; + kc = event.which; if (event.altKey) { - if (kc>=65 && kc<=90) - kc+=32; - if (kc>=97 && kc<=122) { - k=String.fromCharCode(27)+String.fromCharCode(kc); + if (kc >= 65 && kc <= 90) + kc += 32; + if (kc >= 97 && kc <= 122) { + k = String.fromCharCode(27) + String.fromCharCode(kc); } } else if (event.ctrlKey) { - if (kc>=65 && kc<=90) k=String.fromCharCode(kc-64); // Ctrl-A..Z - else if (kc>=97 && kc<=122) k=String.fromCharCode(kc-96); // Ctrl-A..Z - else if (kc==54) k=String.fromCharCode(30); // Ctrl-^ - else if (kc==109) k=String.fromCharCode(31); // Ctrl-_ - else if (kc==219) k=String.fromCharCode(27); // Ctrl-[ - else if (kc==220) k=String.fromCharCode(28); // Ctrl-\ - else if (kc==221) k=String.fromCharCode(29); // Ctrl-] - else if (kc==219) k=String.fromCharCode(29); // Ctrl-] - else if (kc==219) k=String.fromCharCode(0); // Ctrl-@ - } else if (event.which==0) { - if (kc==9) k=String.fromCharCode(9); // Tab - else if (kc==8) k=String.fromCharCode(127); // Backspace - else if (kc==27) k=String.fromCharCode(27); // Escape + if (kc >= 65 && kc <= 90) + k = String.fromCharCode(kc - 64); // Ctrl-A..Z + else if (kc >= 97 && kc <= 122) + k = String.fromCharCode(kc - 96); // Ctrl-A..Z + else if (kc == 54) + k = String.fromCharCode(30); // Ctrl-^ + else if (kc == 109) + k = String.fromCharCode(31); // Ctrl-_ + else if (kc == 219) + k = String.fromCharCode(27); // Ctrl-[ + else if (kc == 220) + k = String.fromCharCode(28); // Ctrl-\ + else if (kc == 221) + k = String.fromCharCode(29); // Ctrl-] + else if (kc == 219) + k = String.fromCharCode(29); // Ctrl-] + else if (kc == 219) + k = String.fromCharCode(0); // Ctrl-@ + } else if (event.which == 0) { + if (kc == 9) + k = String.fromCharCode(9); // Tab + else if (kc == 8) + k = String.fromCharCode(127); // Backspace + else if (kc == 27) + k = String.fromCharCode(27); // Escape else { - if (kc==33) k="[5~"; // PgUp - else if (kc==34) k="[6~"; // PgDn - else if (kc==35) k="[4~"; // End - else if (kc==36) k="[1~"; // Home - else if (kc==37) k="[D"; // Left - else if (kc==38) k="[A"; // Up - else if (kc==39) k="[C"; // Right - else if (kc==40) k="[B"; // Down - else if (kc==45) k="[2~"; // Ins - else if (kc==46) k="[3~"; // Del - else if (kc==112) k="[[A"; // F1 - else if (kc==113) k="[[B"; // F2 - else if (kc==114) k="[[C"; // F3 - else if (kc==115) k="[[D"; // F4 - else if (kc==116) k="[[E"; // F5 - else if (kc==117) k="[17~"; // F6 - else if (kc==118) k="[18~"; // F7 - else if (kc==119) k="[19~"; // F8 - else if (kc==120) k="[20~"; // F9 - else if (kc==121) k="[21~"; // F10 - else if (kc==122) k="[23~"; // F11 - else if (kc==123) k="[24~"; // F12 + if (kc == 33) + k = "[5~"; // PgUp + else if (kc == 34) + k = "[6~"; // PgDn + else if (kc == 35) + k = "[4~"; // End + else if (kc == 36) + k = "[1~"; // Home + else if (kc == 37) + k = "[D"; // Left + else if (kc == 38) + k = "[A"; // Up + else if (kc == 39) + k = "[C"; // Right + else if (kc == 40) + k = "[B"; // Down + else if (kc == 45) + k = "[2~"; // Ins + else if (kc == 46) + k = "[3~"; // Del + else if (kc == 112) + k = "[[A"; // F1 + else if (kc == 113) + k = "[[B"; // F2 + else if (kc == 114) + k = "[[C"; // F3 + else if (kc == 115) + k = "[[D"; // F4 + else if (kc == 116) + k = "[[E"; // F5 + else if (kc == 117) + k = "[17~"; // F6 + else if (kc == 118) + k = "[18~"; // F7 + else if (kc == 119) + k = "[19~"; // F8 + else if (kc == 120) + k = "[20~"; // F9 + else if (kc == 121) + k = "[21~"; // F10 + else if (kc == 122) + k = "[23~"; // F11 + else if (kc == 123) + k = "[24~"; // F12 if (k.length) { - k=String.fromCharCode(27)+k; + k = String.fromCharCode(27) + k; } } } else { - if (kc==8) - k=String.fromCharCode(127); // Backspace + if (kc == 8) + k = String.fromCharCode(127); // Backspace else - k=String.fromCharCode(kc); + k = String.fromCharCode(kc); } - if(k.length) { - if(k=="+") { + if (k.length) { + if (k == "+") { rconsQueue("%2B"); } else { rconsQueue(escape(k)); } } - event.cancelBubble=true; - if (event.stopPropagation) event.stopPropagation(); - if (event.preventDefault) event.preventDefault(); - return false; + event.cancelBubble = true; + if (event.stopPropagation) + event.stopPropagation(); + if (event.preventDefault) + event.preventDefault(); + return false; } - - //translate the key press, same with rconsKeypress - function rconsKeydown(event){ - if (!event) var event=window.event; + + // translate the key press, same with rconsKeypress + function rconsKeydown(event) { + if (!event) + var event = window.event; if (ie) { - o={9:1,8:1,27:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,45:1,46:1,112:1, 113:1,114:1,115:1,116:1,117:1,118:1,119:1,120:1,121:1,122:1,123:1}; + o = { + 9 : 1, + 8 : 1, + 27 : 1, + 33 : 1, + 34 : 1, + 35 : 1, + 36 : 1, + 37 : 1, + 38 : 1, + 39 : 1, + 40 : 1, + 45 : 1, + 46 : 1, + 112 : 1, + 113 : 1, + 114 : 1, + 115 : 1, + 116 : 1, + 117 : 1, + 118 : 1, + 119 : 1, + 120 : 1, + 121 : 1, + 122 : 1, + 123 : 1 + }; if (o[event.keyCode] || event.ctrlKey || event.altKey) { - event.which=0; + event.which = 0; return keypress(event); } } } - - //send the command and request to server - function rconsSend(){ + + // send the command and request to server + function rconsSend() { var keyPressList = ''; var requireString = ''; - if(receivingFlag){ + if (receivingFlag) { return; } - + receivingFlag = true; workingStatus.attr('class', 'on'); - - while(keyBuf.length > 0){ - keyPressList += keyBuf.pop(); + + while (keyBuf.length > 0) { + keyPressList += keyBuf.pop(); } - - if (firstFlag){ + + if (firstFlag) { requireString = queryStable + keyPressList + '&f=1'; firstFlag = false; - } else{ + } else { requireString = queryStable + keyPressList; } - + $.ajax({ type : "POST", url : "lib/rcons.php", data : requireString, dataType : 'json', - success : function(data){ - rconsUpdate(data); - } + success : function(data) { + rconsUpdate(data); + } }); - + errorTimeout = window.setTimeout(rconsSendError, 15000); - + } - - //when receive the response, update the term area - function rconsUpdate(data){ + + // when receive the response, update the term area + function rconsUpdate(data) { window.clearTimeout(errorTimeout); errorArea.empty(); - if (data.term){ + if (data.term) { termArea.empty().append(data.term); maxDelay = 200; - } else{ + } else { maxDelay = 2000; } - + receivingFlag = false; workingStatus.attr('class', 'off'); sendTimeout = window.setTimeout(rconsSend, maxDelay); } - - function rconsSendError(){ + + function rconsSendError() { workingStatus.attr('class', 'off'); errorArea.empty().append('Send require error.'); } - - function rconsQueue(kc){ + + function rconsQueue(kc) { keyBuf.unshift(kc); - if (false == receivingFlag){ + if (false == receivingFlag) { window.clearTimeout(sendTimeout); sendTimeout = window.setTimeout(rconsSend, 1); } diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 563bd11c6..74938adc2 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -800,7 +800,7 @@ function createIFrame(src) { function openSettings() { // Create form to add node range var dialog = $('
      '); - var info = createInfoBar('Select the settings you desire'); + var info = createInfoBar('Select from the following options'); dialog.append(info); var style = {