From f5a31b7f4f017a5de999ea2ddcbcad3956ed6c67 Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 19 Jun 2013 15:25:12 +0000 Subject: [PATCH] Fixed bugs in xCAT-UI: fixed spacing issues, set default commands for guest users, set default arch and hypervisor for add z/VM node, and fixed dialog for adding SCSI/FCP device directly using WWPN & LUN. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16690 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/configure/configure.js | 4 +- xCAT-UI/js/configure/users.js | 31 ++- xCAT-UI/js/custom/zvm.js | 8 +- xCAT-UI/js/custom/zvmUtils.js | 383 ++++++++++++++++-------------- xCAT-UI/js/nodes/nodes.js | 197 +++++++-------- xCAT-UI/js/service/service.js | 2 +- xCAT-UI/xcat/plugins/web.pm | 62 ++--- xCAT-UI/xcat/plugins/webportal.pm | 61 +++-- 8 files changed, 397 insertions(+), 351 deletions(-) diff --git a/xCAT-UI/js/configure/configure.js b/xCAT-UI/js/configure/configure.js index 22f20bc3a..01a67b3ed 100644 --- a/xCAT-UI/js/configure/configure.js +++ b/xCAT-UI/js/configure/configure.js @@ -75,7 +75,7 @@ function loadConfigPage() { tab.add('discoverTab', 'Discover', '', false); // Add the self-service tab - tab.add('serviceTab', 'Service', '', false); + tab.add('serviceTab', 'Service', '', false); // Get list of tables and their descriptions $.ajax({ @@ -98,7 +98,7 @@ function loadConfigPage() { return; } - if (ui.index == 1) { + if (ui.index == 1) { loadUpdatePage(); } else if (ui.index == 2) { loadUserPage(); diff --git a/xCAT-UI/js/configure/users.js b/xCAT-UI/js/configure/users.js index dba4dfa2c..d50152278 100644 --- a/xCAT-UI/js/configure/users.js +++ b/xCAT-UI/js/configure/users.js @@ -328,8 +328,6 @@ function openCreateUserDialog(data) { args += ' policy.name=' + usrName; } if (host) { args += " policy.host='" + host + "'"; - } if (commands) { - args += " policy.commands='" + commands + "'"; } if (parameters) { args += " policy.parameters='" + parameters + "'"; } if (nodeRange) { @@ -347,6 +345,13 @@ function openCreateUserDialog(data) { args += " policy.comments=''"; } + // Handle cases where there are commands and no commands + if (commands) { + args += " policy.commands='" + commands + "'"; + } else { + args += " policy.commands=''"; + } + // Trim any extra spaces args = jQuery.trim(args); @@ -396,21 +401,30 @@ function openCreateUserDialog(data) { // Change comments if access checkbox is checked typeSelect.change(function() { var comments = createUserForm.find('input[name=comments]').val(); - var tag = "privilege:root"; - comments = jQuery.trim(comments); + var cmds = createUserForm.find('input[name=commands]').val(); + comments = jQuery.trim(comments); + cmds = jQuery.trim(cmds); - // Append tag to comments + var tag = "privilege:root"; + + // The list of every command used by the self-service page + // Every command must be separated by a comma + var authorizedCmds = "authcheck,lsdef,nodestat,tabdump,rinv,rpower,rmvm,webportal,webrun"; + + // Append tag to commands and comments if (typeSelect.val().indexOf("admin") > -1) { if (comments && comments.charAt(comments.length - 1) != ";") { comments += ";"; } comments += tag; - createUserForm.find('input[name=comments]').val(comments); + createUserForm.find('input[name=comments]').val(comments); + createUserForm.find('input[name=commands]').val(""); } else { comments = comments.replace(tag, ""); comments = comments.replace(";;", ";"); - createUserForm.find('input[name=comments]').val(comments); + createUserForm.find('input[name=comments]').val(comments); + createUserForm.find('input[name=commands]').val(authorizedCmds); } // Strip off leading semi-colon @@ -453,6 +467,9 @@ function openCreateUserDialog(data) { if (comments.indexOf("privilege:root") > -1) { typeSelect.val("admin"); } + } else { + // Default user type to guest + typeSelect.val("guest").change(); } } /** diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 407209b1c..12f8b3c5c 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -2085,12 +2085,12 @@ zvmPlugin.prototype.addNode = function() { var args = ""; if (type == 'host') { args = node + ';zvm.hcp=' + hcp - + ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group + + ';nodehm.mgt=zvm;nodetype.arch=s390x;hypervisor.type=zvm;groups=' + group + ';nodetype.os=' + os; } else { args = node + ';zvm.hcp=' + hcp + ';zvm.userid=' + userId - + ';nodehm.mgt=zvm' + ';groups=' + group; + + ';nodehm.mgt=zvm' + ';nodetype.arch=s390x' + ';groups=' + group; } if (ipRange != "" && ipRange != null) { @@ -2164,12 +2164,12 @@ zvmPlugin.prototype.addNode = function() { var args = ""; if (type == 'host') { args = nodeRange + ';zvm.hcp=' + hcp - + ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group + + ';nodehm.mgt=zvm;nodetype.arch=s390x;hypervisor.type=zvm;groups=' + group + ';nodetype.os=' + os; } else { args = nodeRange + ';zvm.hcp=' + hcp + ';zvm.userid=' + userIdRange - + ';nodehm.mgt=zvm' + ';groups=' + group; + + ';nodehm.mgt=zvm' + ';nodetype.arch=s390x' + ';groups=' + group; } if (ipRange) diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 464fe0213..402f20265 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -80,7 +80,7 @@ function loadHcpInfo(data) { if (userEntry[0].indexOf('Failed') < 0) { if (hcp) { // If there is no cookie for the disk pool names - if (!$.cookie(hcp + 'diskpools')) { + if (!$.cookie(hcp + 'diskpools') || $.cookie(hcp + 'diskpools') === null) { // Get disk pools $.ajax( { url : 'lib/cmd.php', @@ -97,7 +97,7 @@ function loadHcpInfo(data) { } // If there is no cookie for the zFCP pool names - if (!$.cookie(hcp + 'zfcppools')) { + if (!$.cookie(hcp + 'zfcppools') || $.cookie(hcp + 'zfcppools') === null) { // Get disk pools $.ajax( { url : 'lib/cmd.php', @@ -114,7 +114,7 @@ function loadHcpInfo(data) { } // If there is no cookie for the network names - if (!$.cookie(hcp + 'networks')) { + if (!$.cookie(hcp + 'networks') || $.cookie(hcp + 'networks') === null) { // Get network names $.ajax( { url : 'lib/cmd.php', @@ -955,7 +955,8 @@ function getZResources(data) { for (var key in hcpHash) { // Get the short host name hcp = key.split('.')[0]; - hcps.push(hcp); + if (jQuery.inArray(hcp, hcps) == -1) + hcps.push(hcp); } // Set hardware control point cookie @@ -1159,7 +1160,7 @@ function openAddProcDialog(node) { procType.append(typeSelect); addProcForm.append(procType); - // Generate tooltips + // Generate tooltips addProcForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1248,7 +1249,7 @@ function openAddDiskDialog(node, hcp) { var cookie = $.cookie(hcp + 'diskpools'); var pools = new Array(); if (cookie) { - pools = cookie.split(','); + pools = cookie.split(','); } // Create form to add disk @@ -1288,7 +1289,7 @@ function openAddDiskDialog(node, hcp) { addDiskForm.append('
'); - // Generate tooltips + // Generate tooltips addDiskForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1411,7 +1412,7 @@ function openAddZfcpDialog(node, hcp, zvm) { var cookie = $.cookie(hcp + 'zfcppools'); var pools = new Array(); if (cookie) { - pools = cookie.split(','); + pools = cookie.split(','); } // Create form to add disk @@ -1452,7 +1453,7 @@ function openAddZfcpDialog(node, hcp, zvm) { advanced.toggle(); }); - // Generate tooltips + // Generate tooltips addZfcpForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1492,9 +1493,9 @@ function openAddZfcpDialog(node, hcp, zvm) { var loaddev = $(this).find('input[name=diskLoaddev]'); var size = $(this).find('input[name=diskSize]').val(); var pool = $(this).find('select[name=diskPool]').val(); - var tag = $(this).find('select[name=diskTag]').val(); - var portName = $(this).find('select[name=diskPortName]').val(); - var unitNo = $(this).find('select[name=diskUnitNo]').val(); + var tag = $(this).find('input[name=diskTag]').val(); + var portName = $(this).find('input[name=diskPortName]').val(); + var unitNo = $(this).find('input[name=diskUnitNo]').val(); // If inputs are not complete, show warning message if (!node || !address || !size || !pool) { @@ -1511,10 +1512,12 @@ function openAddZfcpDialog(node, hcp, zvm) { if (tag && tag != "null") { args += '||' + tag; - } if (portName && tag != "null") { - args += '||' + portName; - } if (unitNo && tag != "null") { - args += '||' + unitNo; + } else { + args += '|| ""'; + } + + if ((portName && portName != "null") && (unitNo && unitNo != "null")) { + args += '||' + portName + '||' + unitNo; } // Add zFCP device @@ -1572,7 +1575,7 @@ function openDedicateDeviceDialog(node, hcp) { '' + ''); - // Generate tooltips + // Generate tooltips dedicateForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1675,7 +1678,7 @@ function openAddEckd2SystemDialog(hcp) { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } // Create info bar @@ -1685,7 +1688,7 @@ function openAddEckd2SystemDialog(hcp) { addE2SForm.append(system); addE2SForm.append('
'); - // Generate tooltips + // Generate tooltips addE2SForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1727,10 +1730,10 @@ function openAddEckd2SystemDialog(hcp) { var args = new Array('select[name=system]', 'input[name=devNum]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -1787,7 +1790,7 @@ function openAddPageSpoolDialog(hcp) { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } // Create info bar @@ -1805,7 +1808,7 @@ function openAddPageSpoolDialog(hcp) { diskAttr.append('
'); diskAttr.append('
'); - // Generate tooltips + // Generate tooltips addPageSpoolForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1849,10 +1852,10 @@ function openAddPageSpoolDialog(hcp) { var args = new Array('select[name=system]', 'input[name=volAddr]', 'input[name=volLabel]', 'select[name=volUse]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -1905,7 +1908,7 @@ function openShareDiskDialog(disks2share) { var tgtVol = args[1]; if (!tgtVol || tgtVol == "undefined") - tgtVol = ""; + tgtVol = ""; // Create info bar var info = createInfoBar('Indicate a full-pack minidisk is to be shared by the users of many real and virtual systems.'); @@ -1917,7 +1920,7 @@ function openShareDiskDialog(disks2share) { var shareEnable = $('
'); shareDiskForm.append(node, volAddr, shareEnable); - // Generate tooltips + // Generate tooltips shareDiskForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -1961,10 +1964,10 @@ function openShareDiskDialog(disks2share) { var args = new Array('input[name=node]', 'input[name=volAddr]', 'select[name=shareEnable]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -2027,7 +2030,7 @@ function openAddScsi2SystemDialog(hcp) { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } var devNo = $('
'); @@ -2109,7 +2112,7 @@ function openAddScsi2SystemDialog(hcp) { devPathBody.append(devPathRow); - // Generate tooltips + // Generate tooltips addS2SForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -2138,17 +2141,17 @@ function openAddScsi2SystemDialog(hcp) { devPathDiv.append(devPathTable); var option = $('
'); + '' + + '' + + '' + + ''); var persist = $('
'); + '' + + '' + + ''); addS2SForm.append(system, devNo, devPathDiv, option, persist); - // Generate tooltips + // Generate tooltips addS2SForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -2212,10 +2215,10 @@ function openAddScsi2SystemDialog(hcp) { var args = new Array('select[name=system]', 'input[name=devNum]', 'select[name=option]', 'select[name=persist]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -2261,7 +2264,7 @@ function openRemoveScsiDialog(hcp) { // Create form to add disk var removeScsiForm = $('
'); - // Obtain mapping for zHCP to zVM system + // Obtain mapping for zHCP to zVM system var hcp2zvm = new Object(); hcp2zvm = getHcpZvmHash(); @@ -2272,7 +2275,7 @@ function openRemoveScsiDialog(hcp) { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } // Create info bar @@ -2280,11 +2283,11 @@ function openRemoveScsiDialog(hcp) { removeScsiForm.append(info, system); removeScsiForm.append('
'); removeScsiForm.append('
' + - '' + - '' + - '' + - '
'); + '' + + '' + + '' + + ''); networkTypeDiv.append(networkType) netAttr.append(networkTypeDiv); @@ -2683,7 +2686,7 @@ function openAddVswitchVlanDialog(hcp) { hcp2zvm = getHcpZvmHash(); systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } var typeAttr = $('
'); @@ -2708,38 +2711,38 @@ function openAddVswitchVlanDialog(hcp) { }); advanced.append($('
')); + '' + + '' + + '' + + '')); advanced.append($('
')); advanced.append($('
')); + '' + + '' + + '' + + '')); advanced.append($('
')); + '' + + '' + + '' + + '')); advanced.append($('
')); advanced.append($('
')); + '' + + '' + + '' + + '')); advanced.append($('
')); + '' + + '' + + '' + + '' + + '')); advanced.append($('
')); + '' + + '' + + '' + + '')); advanced.append($('
')); // Create VLAN parameters @@ -2763,24 +2766,24 @@ function openAddVswitchVlanDialog(hcp) { typeAttr.append(vswitchOptions, vlanOptions); networkType.change(function() { - typeFS.show(); + typeFS.show(); if ($(this).val() == "vswitch") { - typeFS.find("legend").text("vSwitch"); - vswitchOptions.show(); - vlanOptions.hide(); + typeFS.find("legend").text("vSwitch"); + vswitchOptions.show(); + vlanOptions.hide(); } else if ($(this).val() == "vlan") { - typeFS.find("legend").text("VLAN"); - vswitchOptions.hide(); - vlanOptions.show(); + typeFS.find("legend").text("VLAN"); + vswitchOptions.hide(); + vlanOptions.show(); } else { - typeFS.find("legend").text(""); - vswitchOptions.hide(); - vlanOptions.hide(); - typeFS.hide(); + typeFS.find("legend").text(""); + vswitchOptions.hide(); + vlanOptions.hide(); + typeFS.hide(); } }); - // Generate tooltips + // Generate tooltips addVswitchForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -2837,10 +2840,10 @@ function openAddVswitchVlanDialog(hcp) { var args = new Array('select[name=system]', 'input[name=switchName]', 'input[name=deviceAddress]', 'input[name=controllerName]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -2911,10 +2914,10 @@ function openAddVswitchVlanDialog(hcp) { var args = new Array('select[name=system]', 'input[name=vlanName]', 'input[name=vlanOwner]', 'select[name=vlanType]', 'select[name=vlanTransport]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -3014,7 +3017,7 @@ function openRemoveVswitchVlanDialog(networkList) { infoMsg = data.rsp; } - openDialog("info", infoMsg); + openDialog("info", infoMsg); } }); } else if (type.indexOf("LAN") != -1) { @@ -3029,7 +3032,7 @@ function openRemoveVswitchVlanDialog(networkList) { }, success: function(data) { - var infoMsg; + var infoMsg; // Create info message if (jQuery.isArray(data.rsp)) { @@ -3041,7 +3044,7 @@ function openRemoveVswitchVlanDialog(networkList) { infoMsg = data.rsp; } - openDialog("info", infoMsg); + openDialog("info", infoMsg); } }); } @@ -3234,8 +3237,8 @@ function getDiskPool(data) { } // End of if } // End of for } else { - // Load empty table - loadDiskPoolTable(); + // Load empty table + loadDiskPoolTable(); } } @@ -3321,25 +3324,25 @@ function loadDiskPoolTable(data) { var hcp2zvm = new Object(); var args, hcp, pool, stat, tmp; if (data) { - // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { - return; - } - - // Obtain mapping for zHCP to zVM system - hcp2zvm = getHcpZvmHash(); - - args = data.msg.split(';'); - hcp = args[0].replace('hcp=', ''); - pool = args[1].replace('pool=', ''); - stat = args[2].replace('stat=', ''); - tmp = data.rsp[0].split(hcp + ': '); + // Do not continue if the call failed + if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + return; + } + + // Obtain mapping for zHCP to zVM system + hcp2zvm = getHcpZvmHash(); + + args = data.msg.split(';'); + hcp = args[0].replace('hcp=', ''); + pool = args[1].replace('pool=', ''); + stat = args[2].replace('stat=', ''); + tmp = data.rsp[0].split(hcp + ': '); } else { - // Provide empty values so the table will be generated - hcp = ''; - pool = ''; - stat = ''; - tmp = new Array(); + // Provide empty values so the table will be generated + hcp = ''; + pool = ''; + stat = ''; + tmp = new Array(); } // Resource tab ID @@ -3515,23 +3518,23 @@ function loadZfcpPoolTable(data) { var hcp2zvm = new Object(); var args, hcp, pool, tmp; if (data) { - // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { - return; - } - - // Obtain mapping for zHCP to zVM system - hcp2zvm = getHcpZvmHash(); - - args = data.msg.split(';'); - hcp = args[0].replace('hcp=', ''); - pool = args[1].replace('pool=', ''); - tmp = data.rsp[0].split(hcp + ': '); + // Do not continue if the call failed + if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + return; + } + + // Obtain mapping for zHCP to zVM system + hcp2zvm = getHcpZvmHash(); + + args = data.msg.split(';'); + hcp = args[0].replace('hcp=', ''); + pool = args[1].replace('pool=', ''); + tmp = data.rsp[0].split(hcp + ': '); } else { - // Provide empty values so the table will be generated - hcp = ''; - pool = '' - tmp = new Array(); + // Provide empty values so the table will be generated + hcp = ''; + pool = '' + tmp = new Array(); } // Resource tab ID @@ -3573,7 +3576,7 @@ function loadZfcpPoolTable(data) { if (data) { // Skip index 0 and 1 because it contains nothing - var key = ""; + var key = ""; for ( var i = 2; i < tmp.length; i++) { tmp[i] = jQuery.trim(tmp[i]); var diskAttrs = tmp[i].split(','); @@ -3671,26 +3674,26 @@ function openRemoveDiskFromPoolDialog(disks2remove) { var dialogId = 'zvmDeleteDiskFromPool'; var deleteDiskForm = $('
'); - // Obtain mapping for zHCP to zVM system + // Obtain mapping for zHCP to zVM system var hcp2zvm = new Object(); hcp2zvm = getHcpZvmHash(); var disks = new Array(); if (disks2remove.indexOf(',') > -1) - disks = disks2remove.split(','); + disks = disks2remove.split(','); else - disks.push(disks2remove); + disks.push(disks2remove); // Pick the last zHCP and pool it finds var args, tgtHcp = "", tgtPool = "", tgtVol = ""; for (var i in disks) { - args = disks[i].split('-'); + args = disks[i].split('-'); tgtHcp = args[0]; tgtPool = args[1]; tgtVol += args[2] + ','; } - // Strip out last comma + // Strip out last comma tgtVol = tgtVol.slice(0, -1); // Create info bar @@ -3718,7 +3721,7 @@ function openRemoveDiskFromPoolDialog(disks2remove) { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } systemSelect.val(tgtHcp); @@ -3736,7 +3739,7 @@ function openRemoveDiskFromPoolDialog(disks2remove) { } }); - // Generate tooltips + // Generate tooltips deleteDiskForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -3781,10 +3784,10 @@ function openRemoveDiskFromPoolDialog(disks2remove) { var args = new Array('select[name=system]', 'select[name=action]', 'input[name=region]', 'input[name=group]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -3860,10 +3863,10 @@ function openAddDisk2PoolDialog() { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } - // Generate tooltips + // Generate tooltips addDiskForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -3908,10 +3911,10 @@ function openAddDisk2PoolDialog() { var args = new Array('select[name=system]', 'select[name=action]', 'input[name=volume]', 'input[name=group]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -4005,11 +4008,11 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { // Append options for hardware control points systemSelect.append($('')); for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } systemSelect.val(tgtHcp); - // Generate tooltips + // Generate tooltips deleteDiskForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -4053,10 +4056,10 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { var args = new Array('select[name=system]', 'input[name=zfcpPool]', 'input[name=zfcpUnitNo]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -4074,7 +4077,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { var args = '--removezfcpfrompool;' + pool + ';' + unitNo; if (portName) { - args += ';' + portName; + args += ';' + portName; } $.ajax({ url : 'lib/cmd.php', @@ -4130,10 +4133,10 @@ function openAddZfcp2PoolDialog() { systemSelect.append($('')); // Append options for hardware control points for (var hcp in hcp2zvm) { - systemSelect.append($('')); + systemSelect.append($('')); } - // Generate tooltips + // Generate tooltips addDiskForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -4186,10 +4189,10 @@ function openAddZfcp2PoolDialog() { var args = new Array('select[name=system]', 'input[name=zfcpPool]', 'select[name=zfcpStatus]', 'input[name=zfcpPortName]', 'input[name=zfcpUnitNo]'); for (var i in args) { if (!$(this).find(args[i]).val()) { - $(this).find(args[i]).css('border', 'solid #FF0000 1px'); + $(this).find(args[i]).css('border', 'solid #FF0000 1px'); ready = false; } else { - $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); + $(this).find(args[i]).css('border', 'solid #BDBDBD 1px'); } } @@ -4205,13 +4208,21 @@ function openAddZfcp2PoolDialog() { 'Close': function() {$(this).dialog("close");} }); + // zFCP range and owner are optional + var args = '--addzfcp2pool||' + tgtPool + '||' + tgtStatus + '||"' + tgtPortName + '"||' + tgtUnitNo + '||' + tgtSize; + if (tgtRange) { + args += '||' + tgtRange; + } if (tgtOwner) { + args += '||' + tgtOwner; + } + $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'chhypervisor', tgt : tgtSystem, - args : '--addzfcp2pool||' + tgtPool + '||' + tgtStatus + '||"' + tgtPortName + '"||' + tgtUnitNo + '||' + tgtSize + '||' + tgtRange + '||' + tgtOwner, + args : args, msg : dialogId }, @@ -4326,10 +4337,10 @@ function loadNetworkTable(data) { zvm = args[0].toLowerCase(); if (args[1].indexOf('.') != -1) { - tmp = args[1].split('.'); - iHcp = tmp[0]; + tmp = args[1].split('.'); + iHcp = tmp[0]; } else { - iHcp = args[1]; + iHcp = args[1]; } hcp2zvm[iHcp] = zvm; @@ -4395,7 +4406,7 @@ function loadNetworkTable(data) { // Determine the OSI layer var layer = "3"; if (details.indexOf("ETHERNET") != -1) { - layer = "2"; + layer = "2"; } // Find the vSwitch/VLAN owner @@ -4409,7 +4420,7 @@ function loadNetworkTable(data) { var controllers = ""; match = ""; while (match = regex.exec(details)) { - controllers += match[1] + ","; + controllers += match[1] + ","; } controllers = controllers.substring(0, controllers.length - 1); // Delete last two characters @@ -5271,11 +5282,11 @@ function createZProvisionNew(inst) { var thisUserId = $('#' + thisTabId + ' input[name=userId]:visible'); var pos = thisUserEntry.val().indexOf('USER ' + thisUserId.val().toUpperCase()); if (pos < 0) { - - pos = thisUserEntry.val().indexOf('IDENTITY ' + thisUserId.val().toUpperCase()); + + pos = thisUserEntry.val().indexOf('IDENTITY ' + thisUserId.val().toUpperCase()); if (pos < 0) { - errMsg = errMsg + 'The directory entry does not contain the correct user/identity ID.
'; - ready = false; + errMsg = errMsg + 'The directory entry does not contain the correct user/identity ID.
'; + ready = false; } } @@ -5713,7 +5724,7 @@ function setGoldenImagesCookies(data) { var tmp = data.rsp[0].split(","); for ( var i = 0; i < tmp.length; i++) { if (tmp[i] != null && tmp[i] != "") { - copies.push(tmp[i]); + copies.push(tmp[i]); } } @@ -5764,6 +5775,20 @@ function setZfcpPoolCookies(data) { } } +/** + * Set a cookie for zHCP host names + * + * @param zhcps List of zHCPs known + */ +function setzHcpCookies(zhcps) { + if (zhcps.length) { + // Set cookie to expire in 60 minutes + var exDate = new Date(); + exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); + $.cookie('zhcps', zhcps, { expires: exDate }); + } +} + /** * Create virtual machine (service page) * @@ -5887,7 +5912,7 @@ function configProfilePanel(panelId) { deleteLnk.click(function() { var profiles = getNodesChecked(tableId); if (profiles) { - deleteProfileDialog(profiles); + deleteProfileDialog(profiles); } }); @@ -6054,7 +6079,7 @@ function profileDialog() { profileForm.append('
'); profileForm.append('