From 016330923b89281c4384d246b502c81a303aa27c Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 4 Aug 2010 15:47:41 +0000 Subject: [PATCH] Changed options for updatenode and rnetboot pages to be based on nodetype.os. Renamed "target node or group" to "target node range". git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6979 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/nodes/nodes.js | 4 +- xCAT-UI/js/nodes/nodeset.js | 2 +- xCAT-UI/js/nodes/rnetboot.js | 21 ++++- xCAT-UI/js/nodes/updatenode.js | 148 +++++++++++++++++++++++---------- xCAT-UI/js/ui.js | 10 ++- 5 files changed, 129 insertions(+), 56 deletions(-) diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index c26a46080..cd97e8554 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -655,7 +655,7 @@ function loadUnlockPage(tgtNodes) { var infoBar = createInfoBar('Give the root password for this node range to setup its SSH keys'); unlockForm.append(infoBar); - unlockForm.append('
'); + unlockForm.append('
'); unlockForm.append('
'); /** @@ -738,7 +738,7 @@ function loadScriptPage(tgtNodes) { scriptForm.append(infoBar); // Target node or group - var tgt = $('
'); + var tgt = $('
'); scriptForm.append(tgt); // Upload file diff --git a/xCAT-UI/js/nodes/nodeset.js b/xCAT-UI/js/nodes/nodeset.js index 6134376af..8360aeac6 100644 --- a/xCAT-UI/js/nodes/nodeset.js +++ b/xCAT-UI/js/nodes/nodeset.js @@ -51,7 +51,7 @@ function loadNodesetPage(tgtNodes) { nodesetForm.append(infoBar); // Create target node or group - var tgt = $('
'); + var tgt = $('
'); nodesetForm.append(tgt); // Create boot method drop down diff --git a/xCAT-UI/js/nodes/rnetboot.js b/xCAT-UI/js/nodes/rnetboot.js index b2caa3a4a..16733fa86 100644 --- a/xCAT-UI/js/nodes/rnetboot.js +++ b/xCAT-UI/js/nodes/rnetboot.js @@ -6,9 +6,20 @@ * @return Nothing */ function loadNetbootPage(tgtNodes) { + // Get node OS (AIX, rh*, centos*, fedora*, or sles*) + var osHash = new Object(); + var nodes = tgtNodes.split(','); + for (var i in nodes) { + var os = getNodeAttr(nodes[i], 'os'); + var osBase = os.match(/[a-zA-Z]+/); + if (osBase) { + nodes[osBase] = 1; + } + } + // Get nodes tab var tab = getNodesTab(); - + // Generate new tab ID var inst = 0; var newTabId = 'netbootTab' + inst; @@ -36,7 +47,7 @@ function loadNetbootPage(tgtNodes) { netbootForm.append(infoBar); // Create target node or group input - var target = $('
'); + var target = $('
'); netbootForm.append(target); // Create options @@ -62,8 +73,10 @@ function loadNetbootPage(tgtNodes) { optsList.append('
  • Force reboot
  • '); // Create force shutdown checkbox optsList.append('
  • Force immediate shutdown of the partition
  • '); - // Create iscsi dump checkbox - optsList.append('
  • Do a iscsi dump on AIX
  • '); + if (osHash['AIX']) { + // Create iscsi dump checkbox + optsList.append('
  • Do a iscsi dump on AIX
  • '); + } // Show boot order when checkbox is checked bootOrderChkBox.bind('click', function(event) { diff --git a/xCAT-UI/js/nodes/updatenode.js b/xCAT-UI/js/nodes/updatenode.js index 45e5e27fe..475579dd9 100644 --- a/xCAT-UI/js/nodes/updatenode.js +++ b/xCAT-UI/js/nodes/updatenode.js @@ -6,6 +6,31 @@ * @return Nothing */ function loadUpdatenodePage(tgtNodes) { + // Get OS images + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'osimage', + msg : '' + }, + + success : setOSImageCookies + }); + + // Get node OS (AIX, rh*, centos*, fedora*, or sles*) + var osHash = new Object(); + var nodes = tgtNodes.split(','); + for (var i in nodes) { + var os = getNodeAttr(nodes[i], 'os'); + var osBase = os.match(/[a-zA-Z]+/); + if (osBase) { + nodes[osBase] = 1; + } + } + // Get nodes tab var tab = getNodesTab(); @@ -17,9 +42,6 @@ function loadUpdatenodePage(tgtNodes) { inst = inst + 1; newTabId = 'updatenodeTab' + inst; } - - // Get node OS - // They could be AIX, rh*, centos*, fedora*, or sles* // Create updatenode form var updatenodeForm = $('
    '); @@ -39,7 +61,7 @@ function loadUpdatenodePage(tgtNodes) { updatenodeForm.append(infoBar); // Create target node or group input - var target = $('
    '); + var target = $('
    '); updatenodeForm.append(target); // Create options @@ -50,34 +72,36 @@ function loadUpdatenodePage(tgtNodes) { optsDIV.append(optsList); updatenodeForm.append(optsDIV); - // Create update all software checkbox - var updateAllChkBox = $(''); - var updateAllOpt = $('
  • '); - optsList.append(updateAllOpt); - updateAllOpt.append(updateAllChkBox); - updateAllOpt.append('Install or update all software contained in the source directory'); - var allSwScrDirectory = $('
  • '); - allSwScrDirectory.hide(); - optsList.append(allSwScrDirectory); - - // Show alternate source directory when checked - updateAllChkBox.bind('click', function(event) { - if ($(this).is(':checked')) { - allSwScrDirectory.show(); - } else { - allSwScrDirectory.hide(); - } - }); + // Create update all software checkbox (AIX) + if (osHash['AIX']) { + var updateAllChkBox = $(''); + var updateAllOpt = $('
  • '); + optsList.append(updateAllOpt); + updateAllOpt.append(updateAllChkBox); + updateAllOpt.append('Install or update all software contained in the source directory'); + var allSwScrDirectory = $('
  • '); + allSwScrDirectory.hide(); + optsList.append(allSwScrDirectory); + + // Show alternate source directory when checked + updateAllChkBox.bind('click', function(event) { + if ($(this).is(':checked')) { + allSwScrDirectory.show(); + } else { + allSwScrDirectory.hide(); + } + }); + } // Create update software checkbox var updateChkBox = $(''); var updateOpt = $('
  • '); optsList.append(updateOpt); updateOpt.append(updateChkBox); - updateOpt.append('Update software'); + updateOpt.append('Update existing software'); // Create source directory input - var scrDirectory = $('
  • '); + var scrDirectory = $('
  • '); scrDirectory.hide(); optsList.append(scrDirectory); @@ -96,18 +120,29 @@ function loadUpdatenodePage(tgtNodes) { installPFlags.hide(); optsList.append(installPFlags); + // Create emgr flags input + var emgrFlags = $('
  • '); + emgrFlags.hide(); + optsList.append(emgrFlags); + // Show alternate source directory when checked updateChkBox.bind('click', function(event) { if ($(this).is(':checked')) { scrDirectory.show(); otherPkgs.show(); - rpmFlags.show(); - installPFlags.show(); + if (osHash['AIX']) { + rpmFlags.show(); + installPFlags.show(); + emgrFlags.show(); + } } else { scrDirectory.hide(); otherPkgs.hide(); - rpmFlags.hide(); - installPFlags.hide(); + if (osHash['AIX']) { + rpmFlags.hide(); + installPFlags.hide(); + emgrFlags.hide(); + } } }); @@ -132,23 +167,36 @@ function loadUpdatenodePage(tgtNodes) { optsList.append('
  • Update the ssh keys and host keys for the service nodes and compute nodes
  • '); // Create update OS checkbox - var osChkBox = $(''); - var osOpt = $('
  • '); - optsList.append(osOpt); - osOpt.append(osChkBox); - osOpt.append('Update the operating system'); - var os = $('
  • '); - os.hide(); - optsList.append(os); - - // Show alternate source directory when checked - osChkBox.bind('click', function(event) { - if ($(this).is(':checked')) { - os.show(); - } else { - os.hide(); - } - }); + if (!osHash['AIX']) { + var osChkBox = $(''); + var osOpt = $('
  • '); + optsList.append(osOpt); + osOpt.append(osChkBox); + osOpt.append('Update the operating system'); + + var os = $('
  • ').hide(); + var osLabel = $(''); + var osInput = $(''); + osInput.one('focus', function(){ + var tmp = $.cookie('OSVers'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete(tmp.split(',')); + } + }); + os.append(osLabel); + os.append(osInput); + optsList.append(os); + + // Show alternate source directory when checked + osChkBox.bind('click', function(event) { + if ($(this).is(':checked')) { + os.show(); + } else { + os.hide(); + } + }); + } /** * Ok @@ -175,25 +223,35 @@ function loadUpdatenodePage(tgtNodes) { // If update software is checked if (opt == 'S') { + // Get source directory var srcDir = $('#' + newTabId + ' input[name=srcDirectory]').val(); if (srcDir) { optStr += ';-d;' + srcDir; } + // Get otherpkgs var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val(); if (otherpkgs) { optStr += ';otherpkgs=' + otherpkgs; } + // Get rpm_flags var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val(); if (rpm_flags) { optStr += ';rpm_flags=' + rpm_flags; } + // Get installp_flags var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val(); if (installp_flags) { optStr += ';installp_flags=' + installp_flags; } + + // Get emgr_flags + var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val(); + if (emgr_flags) { + optStr += ';emgr_flags=' + emgr_flags; + } } // If postscripts is checked diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index d9576e037..e1131b11a 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -405,10 +405,7 @@ function initPage() { includeJs("js/jquery/superfish.js"); includeJs("js/jquery/hoverIntent.js"); includeJs("js/jquery/jquery.tree.js"); - includeJs("js/configure/configure.js"); - includeJs("js/configure/update.js"); - includeJs("js/monitor/xcatmon.js"); - includeJs("js/monitor/rmcmon.js"); + includeJs("js/configure/configure.js"); includeJs("js/monitor/monitor.js"); includeJs("js/nodes/nodes.js"); includeJs("js/provision/provision.js"); @@ -438,12 +435,17 @@ function initPage() { headers.eq(0).css('background-color', '#A9D0F5'); loadNodesPage(); } else if (page == 'configure.php') { + includeJs("js/configure/update.js"); + headers.eq(1).css('background-color', '#A9D0F5'); loadConfigPage(); } else if (page == 'provision.php') { headers.eq(2).css('background-color', '#A9D0F5'); loadProvisionPage(); } else if (page == 'monitor.php') { + includeJs("js/monitor/xcatmon.js"); + includeJs("js/monitor/rmcmon.js"); + headers.eq(3).css('background-color', '#A9D0F5'); loadMonitorPage(); } else {