diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css index 0de7c9cd2..c6392cc8a 100644 --- a/xCAT-UI/css/style.css +++ b/xCAT-UI/css/style.css @@ -1,16 +1,15 @@ -/***************** Login dialog *****************/ -#logdialog { - margin: 0px 10px 20px 10px; - padding: 0px; -} - -#logdialog label,input,p { - font: 14px verdana, arial, helvetica, sans-serif; -} - -#logdialog input { +/***************** Dialogs *****************/ +.ui-dialog input { border: solid 1px #BDBDBD; - font: 14px verdana, arial, helvetica, sans-serif; + font: 12px verdana, arial, helvetica, sans-serif; +} + +.ui-dialog label, input, p, button { + font: 12px verdana, arial, helvetica, sans-serif; +} + +.ui-widget { + font: 12px verdana, arial, helvetica, sans-serif; } /****************** Header ******************/ @@ -133,15 +132,15 @@ body { } /****************** Info bar ******************/ -.info { - font: 12px verdana, arial, helvetica, sans-serif; -} - span.ui-icon-info { float: left; margin-right: 0.3em; } +.ui-icon { + float: left; +} + .ui-button { display: inline-block; position: relative; @@ -393,6 +392,7 @@ span.ui-icon-info { border-style: solid; border-color: #BDBDBD; vertical-align: middle; + text-align: center; } /*** Row color (odd) ***/ @@ -444,70 +444,6 @@ span.ui-icon-info { background-color: #E6E6E6; } -/****************** Prompts ******************/ -.cleanbluewarning .cleanblue { - background-color: #acb4c4; -} - -.cleanbluefade { - position: absolute; - background-color: #aaaaaa; -} - -div.cleanblue { - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - position: absolute; - background-color: #ffffff; - width: 400px; - font-size: 11px; - text-align: left; - border: solid 1px #213e80; -} - -div.cleanblue .cleanbluecontainer { - background-color: #ffffff; - border-top: solid 14px #213e80; - padding: 5px; - font-weight: bold; -} - -div.cleanblue .cleanblueclose { - float: right; - width: 18px; - cursor: default; - margin: -19px -12px 0 0; - color: #ffffff; - font-weight: bold; -} - -div.cleanblue .cleanbluemessage { - padding: 10px; - line-height: 20px; - font-size: 11px; - color: #333333; -} - -div.cleanblue .cleanbluebuttons { - text-align: right; - padding: 5px 0 5px 0; - border: solid 1px #eeeeee; - background-color: #f4f4f4; -} - -div.cleanblue button { - padding: 3px 10px; - margin: 0 10px; - background-color: #314e90; - border: solid 1px #f4f4f4; - color: #ffffff; - font-weight: bold; - font-size: 12px; -} - -div.cleanblue button:hover { - border: solid 1px #d4d4d4; -} - /****************** Context menu ******************/ .context-menu-theme-vista { background: #FAFAFA url(../images/context-menu-bg.gif) repeat-y left top @@ -585,7 +521,7 @@ div.cleanblue button:hover { display: inline-table; } -.form input { +.form input, textarea, select { font: 12px verdana, arial, helvetica, sans-serif; border: solid 1px #BDBDBD; padding: 5px; @@ -593,10 +529,6 @@ div.cleanblue button:hover { } .form textarea { - font: 12px verdana, arial, helvetica, sans-serif; - border: solid 1px #BDBDBD; - padding: 5px; - display: inline-table; width: 350px; height: 150px; } diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index f0d0867f8..0bded6722 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -145,10 +145,8 @@ bladePlugin.prototype.loadResources = function() { /** * Add node * - * @param f - * Key/value pairs of the form values * @return Nothing */ -bladePlugin.prototype.addNode = function(f) { +bladePlugin.prototype.addNode = function() { }; \ No newline at end of file diff --git a/xCAT-UI/js/custom/fsp.js b/xCAT-UI/js/custom/fsp.js index fa3b50034..2e337704d 100644 --- a/xCAT-UI/js/custom/fsp.js +++ b/xCAT-UI/js/custom/fsp.js @@ -145,10 +145,8 @@ fspPlugin.prototype.loadResources = function() { /** * Add node * - * @param f - * Key/value pairs of the form values * @return Nothing */ -fspPlugin.prototype.addNode = function(f) { +fspPlugin.prototype.addNode = function() { }; \ No newline at end of file diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index ffb986a63..2c289ad1b 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -198,10 +198,8 @@ hmcPlugin.prototype.loadResources = function() { /** * Add node * - * @param f - * Key/value pairs of the form values * @return Nothing */ -hmcPlugin.prototype.addNode = function(f) { +hmcPlugin.prototype.addNode = function() { }; \ No newline at end of file diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index 5a959567e..159a6789c 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -145,10 +145,8 @@ ipmiPlugin.prototype.loadResources = function() { /** * Add node * - * @param f - * Key/value pairs of the form values * @return Nothing */ -ipmiPlugin.prototype.addNode = function(f) { +ipmiPlugin.prototype.addNode = function() { }; \ No newline at end of file diff --git a/xCAT-UI/js/custom/ivm.js b/xCAT-UI/js/custom/ivm.js index 70852ab09..abbd84457 100644 --- a/xCAT-UI/js/custom/ivm.js +++ b/xCAT-UI/js/custom/ivm.js @@ -145,10 +145,8 @@ ivmPlugin.prototype.loadResources = function() { /** * Add node * - * @param f - * Key/value pairs of the form values * @return Nothing */ -ivmPlugin.prototype.addNode = function(f) { +ivmPlugin.prototype.addNode = function() { }; \ No newline at end of file diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index e66d1161a..5f2aa259e 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -556,28 +556,9 @@ zvmPlugin.prototype.loadInventory = function(data) { */ var addProcLink = $('Add processor'); addProcLink.bind('click', function(event) { - var procForm = '
' - + '
' - + '
' - + '
' - + '' - + '
' - + '
'; - - $.prompt(procForm, { - callback : addProcessor, - buttons : { - Ok : true, - Cancel : false - }, - prefix : 'cleanblue' - }); - }); + createAddProcDialog(node); + }); + procFooter.append(addProcLink); procTable.append(procFooter); @@ -653,48 +634,8 @@ zvmPlugin.prototype.loadInventory = function(data) { */ var addDasdLink = $('Add disk'); addDasdLink.bind('click', function(event) { - // Get list of disk pools - var temp = attrs['hcp'][0].split('.'); - var cookie = $.cookie(temp[0] + 'DiskPools'); - - // Create drop down list for disk pool - var pools = cookie.split(','); - var selectPool = ''; - - // Create drop down list for disk mode - var selectMode = ''; - - var dasdForm = '
' - + '
' - + '
' - + '
' - + '
' - + '
' + selectPool + '
' - + '
' + selectMode + '
' - + '
' - + '
'; - - $.prompt(dasdForm, { - callback : addDisk, - buttons : { - Ok : true, - Cancel : false - }, - prefix : 'cleanblue' - }); + var hcp = attrs['hcp'][0].split('.'); + createAddDiskDialog(node, hcp[0]); }); dasdFooter.append(addDasdLink); dasdTable.append(dasdFooter); @@ -774,148 +715,8 @@ zvmPlugin.prototype.loadInventory = function(data) { */ var addNicLink = $('Add NIC'); addNicLink.bind('click', function(event) { - // Get network names - var temp = attrs['hcp'][0].split('.'); - var networks = $.cookie(temp[0] + 'Networks').split(','); - - // Create a drop down list - var gLansQdio = ''; - var vswitches = ''; - gLansQdio = gLansQdio + ''; - gLansHipers = gLansHipers + ''; - - var nicTypeForm = '
' - + '
' - + '
' - + '
' - + '' - + '
' - + '
' - + '' - + '
' - + '
'; - var configGuestLanQdioForm = '
' + gLansQdio + '
'; - var configGuestLanHipersForm = '
' + gLansHipers + '
'; - var configVSwitchForm = '
' + vswitches + '
'; - var notSupportedForm = '

The requested operation is not supported

'; - - var states = { - // Select NIC type - type : { - html : nicTypeForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (!v) { - return true; - } else { - var nicType = f.nicType; - var networkType = f.nicNetworkType; - if (networkType == 'Guest LAN' && nicType == 'QDIO') - $.prompt.goToState('configGuestLanQdio'); - else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') - $.prompt.goToState('configGuestLanHipers'); - else if (networkType == 'Virtual Switch' && nicType == 'QDIO') - $.prompt.goToState('configVSwitch'); - else - $.prompt.goToState('notSupported'); - return false; - } - } - }, - - // Configure QDIO guest LAN page - configGuestLanQdio : { - html : configGuestLanQdioForm, - callback : addNic, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Configure HIPERS guest LAN page - configGuestLanHipers : { - html : configGuestLanHipersForm, - callback : addNic, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Configure VSwitch page - configVSwitch : { - html : configVSwitchForm, - callback : addNic, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Not supported page - notSupported : { - html : notSupportedForm, - buttons : { - Ok : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - } - }; - - $.prompt(states, { - callback : addNic, - prefix : 'cleanblue' - }); + var hcp = attrs['hcp'][0].split('.'); + createAddNicDialog(node, hcp[0]); }); nicFooter.append(addNicLink); nicTable.append(nicFooter); @@ -1064,179 +865,197 @@ zvmPlugin.prototype.loadResources = function() { /** * Add node * - * @param f - * Key/value pairs of the form values * @return Nothing */ -zvmPlugin.prototype.addNode = function(f) { - var nodeRange = f.node; - var group = f.group; - var hcp = f.hcp; - var userIdRange = f.userId; - - // Check node range and user ID range - var errMsg = ''; - var ready = true; - if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) { - if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) { - errMsg = errMsg + 'A user ID range and node range needs to be given. '; - ready = false; - } else { - var tmp = nodeRange.split('-'); - - // Get node base name - var nodeBase = tmp[0].match(/[a-zA-Z]+/); - // Get starting index - var nodeStart = parseInt(tmp[0].match(/\d+/)); - // Get ending index - var nodeEnd = parseInt(tmp[1]); - - tmp = userIdRange.split('-'); - - // 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]); - - // If starting and ending index do not match - if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) { - // Not ready - errMsg = errMsg + 'The node range and user ID range does not match. '; - ready = false; - } - } - } - - // If there are no errors catched - if (ready) { - // If a node range is given - if (nodeRange.indexOf('-') > -1 && userIdRange.indexOf('-') > -1) { - var tmp = nodeRange.split('-'); +zvmPlugin.prototype.addNode = function() { + var info = createInfoBar('Add a new node'); + var addNodeForm = $('
'); + addNodeForm.append(info); + addNodeForm.append('
'); + addNodeForm.append('
'); + addNodeForm.append('
'); + addNodeForm.append('
'); + + // Create add node dialog + addNodeForm.dialog({ + position: 'top', + modal: true, + width: 400, + buttons: { + "Cancel": function(){ + // Close dialog + $(this).dialog( "close" ); + }, + "Ok": function(){ + // Remove any warning messages + $(this).find('.ui-state-error').remove(); + + // Get inputs + var nodeRange = $(this).find('input[name=node]').val(); + var userIdRange = $(this).find('input[name=userId]').val(); + var group = $(this).find('input[name=group]').val(); + var hcp = $(this).find('input[name=hcp]').val(); + + if (!nodeRange || !userIdRange || !group || !hcp) { + var warn = createWarnBar('Missing values'); + warn.prependTo($(this)); + } else { + // Check node range and user ID range + var errMsg = ''; + var ready = true; + if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) { + if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) { + errMsg = errMsg + 'A user ID range and node range needs to be given. '; + ready = false; + } else { + var tmp = nodeRange.split('-'); - // Get node base name - var nodeBase = tmp[0].match(/[a-zA-Z]+/); - // Get starting index - var nodeStart = parseInt(tmp[0].match(/\d+/)); - // Get ending index - var nodeEnd = parseInt(tmp[1]); + // Get node base name + var nodeBase = tmp[0].match(/[a-zA-Z]+/); + // Get starting index + var nodeStart = parseInt(tmp[0].match(/\d+/)); + // Get ending index + var nodeEnd = parseInt(tmp[1]); - tmp = userIdRange.split('-'); + tmp = userIdRange.split('-'); - // 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]); + // 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]); - // 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; - - /** - * (1) Define node - */ - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'nodeadd', - tgt : '', - args : node + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userId - + ';nodehm.mgt=zvm' + ';groups=' + group, - msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange - }, - - /** - * Return function on successful AJAX call - * - * @param data - * Data returned from HTTP request - * @return Nothing - */ - success : function (data) { - // Get ajax response - var rsp = data.rsp; - var args = data.msg.split(';'); - - // Get command invoked - var cmd = args[0].replace('cmd=', ''); - var inst = args[1].replace('inst=', ''); - var nodeRange = args[2].replace('noderange=', ''); - - // If the last node was added - var tmp = inst.split('/'); - if (tmp[0] == tmp[1]) { - // If there was an error, do not continue - var msg; - if (rsp.length) { - msg = '

(Error) Failed to create node definition

'; - } else { - msg = '

Node definitions created for ' + nodeRange + '

'; - } - - $.prompt(msg, { - buttons: { Ok: true }, - prefix: 'cleanblue' - }); + // If starting and ending index do not match + if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) { + // Not ready + errMsg = errMsg + 'The node range and user ID range does not match. '; + ready = false; + } } } - }); - } - } else { - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'nodeadd', - tgt : '', - args : nodeRange + ';zvm.hcp=' + hcp - + ';zvm.userid=' + userIdRange - + ';nodehm.mgt=zvm' + ';groups=' + group, - msg : 'cmd=addnewnode;node=' + nodeRange - }, - - /** - * Return function on successful AJAX call - * - * @param data - * Data returned from HTTP request - * @return Nothing - */ - success : function (data) { - // Get ajax response - var rsp = data.rsp; - var args = data.msg.split(';'); - - // Get command invoked - var cmd = args[0].replace('cmd=', ''); - var node = args[1].replace('node=', ''); - // If there was an error, do not continue - var msg; - if (rsp.length) { - msg = '

(Error) Failed to create node definition

'; + // If there are no errors + if (ready) { + // If a node range is given + if (nodeRange.indexOf('-') > -1 && userIdRange.indexOf('-') > -1) { + var tmp = nodeRange.split('-'); + + // Get node base name + var nodeBase = tmp[0].match(/[a-zA-Z]+/); + // Get starting index + var nodeStart = parseInt(tmp[0].match(/\d+/)); + // Get ending index + var nodeEnd = parseInt(tmp[1]); + + tmp = userIdRange.split('-'); + + // 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]); + + // 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; + + /** + * (1) Define node + */ + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'nodeadd', + tgt : '', + args : node + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userId + + ';nodehm.mgt=zvm' + ';groups=' + group, + msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange + }, + + /** + * Return function on successful AJAX call + * + * @param data + * Data returned from HTTP request + * @return Nothing + */ + success : function (data) { + // Get ajax response + var rsp = data.rsp; + var args = data.msg.split(';'); + + // Get command invoked + var cmd = args[0].replace('cmd=', ''); + var inst = args[1].replace('inst=', ''); + var nodeRange = args[2].replace('noderange=', ''); + + // If the last node was added + var tmp = inst.split('/'); + if (tmp[0] == tmp[1]) { + // If there was an error, do not continue + if (rsp.length) { + openDialog('(Error) Failed to create node definition'); + } else { + openDialog('Node definitions created for ' + nodeRange); + } + } + } + }); + } + } else { + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'nodeadd', + tgt : '', + args : nodeRange + ';zvm.hcp=' + hcp + + ';zvm.userid=' + userIdRange + + ';nodehm.mgt=zvm' + ';groups=' + group, + msg : 'cmd=addnewnode;node=' + nodeRange + }, + + /** + * Return function on successful AJAX call + * + * @param data + * Data returned from HTTP request + * @return Nothing + */ + success : function (data) { + // Get ajax response + var rsp = data.rsp; + var args = data.msg.split(';'); + + // Get command invoked + var cmd = args[0].replace('cmd=', ''); + var node = args[1].replace('node=', ''); + + // If there was an error, do not continue + if (rsp.length) { + openDialog('(Error) Failed to create node definition'); + } else { + openDialog('Node definitions created for ' + node); + } + } + }); + } + + // Close dialog + $(this).dialog( "close" ); } else { - msg = '

Node definition created for ' + node + '

'; - } - - $.prompt(msg, { - buttons: { Ok: true }, - prefix: 'cleanblue' - }); + // Show warning message + var warn = createWarnBar(errMsg); + warn.prependTo($(this)); + } } - }); - } - } else { - // Prompt an error message - $.prompt('

' + errMsg + '

', { - buttons: { Ok: true }, - prefix: 'cleanblue' - }); - } + } + } + }); }; \ No newline at end of file diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 7e9f839c8..c1d4d9e56 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -1001,206 +1001,433 @@ function getAttrs(keys, propNames, data) { } /** - * Add processor - * - * @param v - * Value of the button clicked - * @param m - * jQuery object of the message within the active state when the user - * clicked the button - * @param f - * Key/value pairs of the form values + * Create add processor dialog * + * @param node + * Node to add processor to * @return Nothing */ -function addProcessor(v, m, f) { - // If user clicks Ok, add processor - if (v) { - var node = f.procNode; - var type = f.procType; - var address = f.procAddress; - - // Add processor - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'chvm', - tgt : node, - args : '--addprocessoractive;' + address + ';' + type, - msg : node - }, - - success : updateZNodeStatus - }); - - // Increment node process - incrementNodeProcess(node); - - // Show loader - var statusId = node + 'StatusBar'; - var statusBarLoaderId = node + 'StatusBarLoader'; - $('#' + statusBarLoaderId).show(); - $('#' + statusId).show(); - } -} - -/** - * Add disk - * - * @param v - * Value of the button clicked - * @param m - * jQuery object of the message within the active state when the user - * clicked the button - * @param f - * Key/value pairs of the form values - * @return Nothing - */ -function addDisk(v, m, f) { - // If user clicks Ok, add disk - if (v) { - var node = f.diskNode; - var type = f.diskType; - var address = f.diskAddress; - var size = f.diskSize; - var pool = f.diskPool; - var mode = f.diskMode; - var password = f.diskPassword; - - // Add disk - if (type == '3390') { - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'chvm', - tgt : node, - args : '--add3390;' + pool + ';' + address + ';' + size - + ';' + mode + ';' + password + ';' + password + ';' + password, - msg : node - }, - - success : updateZNodeStatus - }); - - // Increment node process - incrementNodeProcess(node); - - // Show loader - var statusId = node + 'StatusBar'; - var statusBarLoaderId = node + 'StatusBarLoader'; - $('#' + statusBarLoaderId).show(); - $('#' + statusId).show(); - } else if (type == '9336') { - // Default block size for FBA volumes = 512 - var blkSize = '512'; - - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'chvm', - tgt : node, - args : '--add9336;' + pool + ';' + address + ';' + blkSize + ';' + size - + ';' + mode + ';' + password + ';' + password + ';' + password, - msg : node - }, - - success : updateZNodeStatus - }); - - // Increment node process - incrementNodeProcess(node); - - // Show loader - var statusId = node + 'StatusBar'; - var statusBarLoaderId = node + 'StatusBarLoader'; - $('#' + statusBarLoaderId).show(); - $('#' + statusId).show(); - } - } -} - -/** - * Add NIC - * - * @param v - * Value of the button clicked - * @param m - * jQuery object of the message within the active state when the user - * clicked the button - * @param f - * Key/value pairs of the form values - * @return Nothing - */ -function addNic(v, m, f) { - // If user clicks Ok, add NIC - if (v) { - var node = f.nicNode; - var nicType = f.nicType; - var networkType = f.nicNetworkType; - var address = f.nicAddress; - - /** - * Add guest LAN - */ - if (networkType == 'Guest LAN') { - var temp; - if (nicType == 'QDIO') { - temp = f.nicLanQdioName.split(' '); - } else { - temp = f.nicLanHipersName.split(' '); +function createAddProcDialog(node) { + // Create info bar + var info = createInfoBar('Add a processor'); + + // Create add processor form + var addProcForm = $('
'); + addProcForm.append(info); + addProcForm.append('
'); + addProcForm.append('
'); + + // Create drop down for processor type + var procType = $('
'); + procType.append(''); + var typeSelect = $(''); + typeSelect.append(''); + typeSelect.append(''); + typeSelect.append(''); + typeSelect.append(''); + procType.append(typeSelect); + addProcForm.append(procType); + + // Create add processor dialog + addProcForm.dialog({ + position: 'top', + modal: true, + width: 400, + buttons: { + "Cancel": function() { + // Close dialog + $(this).dialog( "close" ); + }, + "Ok": function(){ + // Remove any warning messages + $(this).find('.ui-state-error').remove(); + + // Get processor properties + var node = $(this).find('input[name=procNode]').val(); + var address = $(this).find('input[name=procAddress]').val(); + var type = $(this).find('select[name=procType]').val(); + + if (!node || !address || !type) { + var warn = createWarnBar('Missing values'); + warn.prependTo($(this)); + } else { + // Add processor + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chvm', + tgt : node, + args : '--addprocessoractive;' + address + ';' + type, + msg : node + }, + + success : updateZNodeStatus + }); + + // Increment node process + incrementNodeProcess(node); + + // Show loader + var statusId = node + 'StatusBar'; + var statusBarLoaderId = node + 'StatusBarLoader'; + $('#' + statusBarLoaderId).show(); + $('#' + statusId).show(); + + // Close dialog + $(this).dialog( "close" ); + } } - - var lanOwner = temp[0]; - var lanName = temp[1]; - - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'chvm', - tgt : node, - args : '--addnic;' + address + ';' + nicType + ';3', - msg : 'node=' + node + ';addr=' + address + ';lan=' - + lanName + ';owner=' + lanOwner - }, - success : connect2GuestLan - }); } + }); +} - /** - * Add virtual switch - */ - else if (networkType == 'Virtual Switch') { - var temp = f.nicVSwitchName.split(' '); - var vswitchName = temp[1]; - - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'chvm', - tgt : node, - args : '--addnic;' + address + ';' + nicType + ';3', - msg : 'node=' + node + ';addr=' + address + ';vsw=' - + vswitchName - }, - - success : connect2VSwitch - }); - } - - // Increment node process - incrementNodeProcess(node); - - // Show loader - var statusId = node + 'StatusBar'; - var statusBarLoaderId = node + 'StatusBarLoader'; - $('#' + statusBarLoaderId).show(); - $('#' + statusId).show(); +/** + * Create add disk dialog + * + * @param node + * Node to add disk to + * @param hcp + * Hardware control point of node + * @return Nothing + */ +function createAddDiskDialog(node, hcp) { + // Get list of disk pools + var cookie = $.cookie(hcp + 'DiskPools'); + var pools = cookie.split(','); + + // Create info bar + var info = createInfoBar('Add a disk'); + + // Create add disk form + var addDiskForm = $('
'); + addDiskForm.append(info); + addDiskForm.append('
'); + addDiskForm.append('
'); + addDiskForm.append('
'); + addDiskForm.append('
'); + + // Create drop down for disk pool + var diskPool = $('
'); + diskPool.append(''); + var poolSelect = $(''); + for ( var i = 0; i < pools.length; i++) { + poolSelect.append(''); } + diskPool.append(poolSelect); + addDiskForm.append(diskPool); + + // Create drop down for disk mode + var diskMode = $('
'); + diskMode.append(''); + var modeSelect = $(''); + modeSelect.append(''); + modeSelect.append(''); + modeSelect.append(''); + modeSelect.append(''); + modeSelect.append(''); + modeSelect.append(''); + modeSelect.append(''); + diskMode.append(modeSelect); + addDiskForm.append(diskMode); + + addDiskForm.append('
'); + + // Create add disk dialog + addDiskForm.dialog({ + position: 'top', + modal: true, + width: 400, + buttons: { + "Cancel": function() { + // Close dialog + $(this).dialog( "close" ); + }, + "Ok": function(){ + // Remove any warning messages + $(this).find('.ui-state-error').remove(); + + // Get disk properties + var node = $(this).find('input[name=diskNode]').val(); + var type = $(this).find('select[name=diskType]').val(); + var address = $(this).find('input[name=diskAddress]').val(); + var size = $(this).find('input[name=diskSize]').val(); + var pool = $(this).find('select[name=diskPool]').val(); + var mode = $(this).find('select[name=diskMode]').val(); + var password = $(this).find('input[name=diskPassword]').val(); + + if (!node || !type || !address || !size || !pool || !mode) { + var warn = createWarnBar('Missing values'); + warn.prependTo($(this)); + } else { + // Add disk + if (type == '3390') { + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chvm', + tgt : node, + args : '--add3390;' + pool + ';' + address + ';' + size + + ';' + mode + ';' + password + ';' + password + ';' + password, + msg : node + }, + + success : updateZNodeStatus + }); + + // Increment node process + incrementNodeProcess(node); + + // Show loader + var statusId = node + 'StatusBar'; + var statusBarLoaderId = node + 'StatusBarLoader'; + $('#' + statusBarLoaderId).show(); + $('#' + statusId).show(); + } else if (type == '9336') { + // Default block size for FBA volumes = 512 + var blkSize = '512'; + + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chvm', + tgt : node, + args : '--add9336;' + pool + ';' + address + ';' + blkSize + ';' + size + + ';' + mode + ';' + password + ';' + password + ';' + password, + msg : node + }, + + success : updateZNodeStatus + }); + + // Increment node process + incrementNodeProcess(node); + + // Show loader + var statusId = node + 'StatusBar'; + var statusBarLoaderId = node + 'StatusBarLoader'; + $('#' + statusBarLoaderId).show(); + $('#' + statusId).show(); + } + + // Close dialog + $(this).dialog( "close" ); + } // End of else + } + } + }); +} + +/** + * Create add NIC dialog + * + * @param node + * Node to add NIC to + * @param hcp + * Hardware control point of node + * @return Nothing + */ +function createAddNicDialog(node, hcp) { + // Get network names + var networks = $.cookie(hcp + 'Networks').split(','); + + // Create info bar + var info = createInfoBar('Add a NIC'); + + // Create add NIC form + var addNicForm = $('
'); + addNicForm.append(info); + addNicForm.append('
'); + addNicForm.append('
'); + + // Create drop down for NIC types + var nicType = $('
'); + nicType.append(''); + var nicTypeSelect = $(''); + nicTypeSelect.append(''); + nicTypeSelect.append(''); + nicTypeSelect.append(''); + nicType.append(nicTypeSelect); + addNicForm.append(nicType); + + // Create drop down for network types + var networkType = $('
'); + networkType.append(''); + var networkTypeSelect = $(''); + networkTypeSelect.append(''); + networkTypeSelect.append(''); + networkTypeSelect.append(''); + networkType.append(networkTypeSelect); + addNicForm.append(networkType); + + // Create drop down for network names + var gLansQdioSelect = $(''); + var gLansHipersSelect = $(''); + var vswitchSelect = $(''); + for ( var i = 0; i < networks.length; i++) { + var network = networks[i].split(' '); + var networkOption = $(''); + if (network[0] == 'VSWITCH') { + vswitchSelect.append(networkOption); + } else if (network[0] == 'LAN:QDIO') { + gLansQdioSelect.append(networkOption); + } else if (network[0] == 'LAN:HIPERS') { + gLansHipersSelect.append(networkOption); + } + } + + var guestLanQdio = $('
').hide(); + guestLanQdio.append(''); + guestLanQdio.append(gLansQdioSelect); + addNicForm.append(guestLanQdio); + + var guestLanHipers = $('
').hide(); + guestLanHipers.append(''); + guestLanHipers.append(gLansHipersSelect); + addNicForm.append(guestLanHipers); + + var vswitch = $('
').hide(); + vswitch.append(''); + vswitch.append(vswitchSelect); + addNicForm.append(vswitch); + + // Show network names on change + networkTypeSelect.change(function(){ + // Remove any warning messages + $(this).parent().parent().find('.ui-state-error').remove(); + + var nicType = nicTypeSelect.val(); + var networkType = $(this).val(); + + guestLanQdio.hide(); + guestLanHipers.hide(); + vswitch.hide(); + + if (networkType == 'Guest LAN' && nicType == 'QDIO') + guestLanQdio.show(); + else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') + guestLanHipers.show(); + else if (networkType == 'Virtual Switch' && nicType == 'QDIO') + vswitch.show(); + else if (networkType == 'Virtual Switch' && nicType != 'QDIO') { + var warn = createWarnBar('The selected choices are not valid'); + warn.prependTo($(this).parent().parent()); + } + }); + + nicTypeSelect.change(function(){ + // Remove any warning messages + $(this).parent().parent().find('.ui-state-error').remove(); + + var nicType = $(this).val(); + var networkType = networkTypeSelect.val(); + + guestLanQdio.hide(); + guestLanHipers.hide(); + vswitch.hide(); + + if (networkType == 'Guest LAN' && nicType == 'QDIO') + guestLanQdio.show(); + else if (networkType == 'Guest LAN' && nicType == 'HiperSockets') + guestLanHipers.show(); + else if (networkType == 'Virtual Switch' && nicType == 'QDIO') + vswitch.show(); + else if (networkType == 'Virtual Switch' && nicType != 'QDIO') { + var warn = createWarnBar('The selected choices are not valid'); + warn.prependTo($(this).parent().parent()); + } + }); + + // Create add NIC dialog + addNicForm.dialog({ + position: 'top', + modal: true, + width: 400, + buttons: { + "Cancel": function(){ + // Close dialog + $(this).dialog( "close" ); + }, + "Ok": function(){ + // Remove any warning messages + $(this).find('.ui-state-error').remove(); + + var node = $(this).find('input[name=nicNode]').val(); + var nicType = $(this).find('select[name=nicType]').val(); + var networkType = $(this).find('select[name=nicNetworkType]').val(); + var address = $(this).find('input[name=nicAddress]').val(); + + if (!node || !nicType || !networkType || !address) { + var warn = createWarnBar('Missing values'); + warn.prependTo($(this)); + } else { + /** + * Add guest LAN + */ + if (networkType == 'Guest LAN') { + var temp; + if (nicType == 'QDIO') { + temp = $(this).find('select[name=nicLanQdioName]').val().split(' '); + } else { + temp = $(this).find('select[name=nicLanHipersName]').val().split(' '); + } + + var lanOwner = temp[0]; + var lanName = temp[1]; + + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chvm', + tgt : node, + args : '--addnic;' + address + ';' + nicType + ';3', + msg : 'node=' + node + ';addr=' + address + ';lan=' + + lanName + ';owner=' + lanOwner + }, + success : connect2GuestLan + }); + } + + /** + * Add virtual switch + */ + else if (networkType == 'Virtual Switch' && nicType == 'QDIO') { + var temp = $(this).find('select[name=nicVSwitchName]').val().split(' '); + var vswitchName = temp[1]; + + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chvm', + tgt : node, + args : '--addnic;' + address + ';' + nicType + ';3', + msg : 'node=' + node + ';addr=' + address + ';vsw=' + + vswitchName + }, + + success : connect2VSwitch + }); + } + + // Increment node process + incrementNodeProcess(node); + + // Show loader + var statusId = node + 'StatusBar'; + var statusBarLoaderId = node + 'StatusBarLoader'; + $('#' + statusBarLoaderId).show(); + $('#' + statusId).show(); + + // Close dialog + $(this).dialog( "close" ); + } // End of else + } + } + }); } /** diff --git a/xCAT-UI/js/jquery/jquery-impromptu.3.0.min.js b/xCAT-UI/js/jquery/jquery-impromptu.3.0.min.js deleted file mode 100644 index 3e9d45b02..000000000 --- a/xCAT-UI/js/jquery/jquery-impromptu.3.0.min.js +++ /dev/null @@ -1,318 +0,0 @@ -/* - * jQuery Impromptu - * By: Trent Richardson [http://trentrichardson.com] - * Version 3.0 - * Last Modified: 2/15/2010 - * - * Copyright 2010 Trent Richardson - * Dual licensed under the MIT and GPL licenses. - * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt - * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt - * - */ -(function($) { - $.prompt = function(message, options) { - options = $.extend( {}, $.prompt.defaults, options); - $.prompt.currentPrefix = options.prefix; - var ie6 = ($.browser.msie && $.browser.version < 7); - var $body = $(document.body); - var $window = $(window); - options.classes = $.trim(options.classes); - if (options.classes != '') - options.classes = ' ' + options.classes; - var msgbox = '
'; - if (options.useiframe && (($('object, applet').length > 0) || ie6)) { - msgbox += ''; - } else { - if (ie6) { - $('select').css('visibility', 'hidden'); - } - msgbox += '
'; - } - msgbox += '
X
'; - msgbox += '
'; - var $jqib = $(msgbox).appendTo($body); - var $jqi = $jqib.children('#' + options.prefix); - var $jqif = $jqib.children('#' + options.prefix + 'fade'); - if (message.constructor == String) { - message = { - state0 : { - html : message, - buttons : options.buttons, - focus : options.focus, - submit : options.submit - } - }; - } - var states = ""; - $ - .each( - message, - function(statename, stateobj) { - stateobj = $.extend( {}, $.prompt.defaults.state, stateobj); - message[statename] = stateobj; - states += ''; - }); - $jqi.find('#' + options.prefix + 'states').html(states).children( - '.' + options.prefix + '_state:first').css('display', 'block'); - $jqi.find('.' + options.prefix + 'buttons:empty') - .css('display', 'none'); - $ - .each( - message, - function(statename, stateobj) { - var $state = $jqi - .find('#' + options.prefix + '_state_' + statename); - $state - .children('.' + options.prefix + 'buttons') - .children('button') - .click( - function() { - var msg = $state - .children('.' + options.prefix + 'message'); - var clicked = stateobj.buttons[$(this).text()]; - var forminputs = {}; - $ - .each( - $jqi - .find( - '#' + options.prefix + 'states :input') - .serializeArray(), - function(i, obj) { - if (forminputs[obj.name] === undefined) { - forminputs[obj.name] = obj.value; - } else if (typeof forminputs[obj.name] == Array || typeof forminputs[obj.name] == 'object') { - forminputs[obj.name] - .push(obj.value); - } else { - forminputs[obj.name] = [ - forminputs[obj.name], - obj.value ]; - } - }); - var close = stateobj.submit(clicked, msg, - forminputs); - if (close === undefined || close) { - removePrompt(true, clicked, msg, forminputs); - } - }); - $state - .find( - '.' + options.prefix + 'buttons button:eq(' + stateobj.focus + ')') - .addClass(options.prefix + 'defaultbutton'); - }); - var ie6scroll = function() { - $jqib.css( { - top : $window.scrollTop() - }); - }; - var fadeClicked = function() { - if (options.persistent) { - var i = 0; - $jqib.addClass(options.prefix + 'warning'); - var intervalid = setInterval(function() { - $jqib.toggleClass(options.prefix + 'warning'); - if (i++ > 1) { - clearInterval(intervalid); - $jqib.removeClass(options.prefix + 'warning'); - } - }, 100); - } else { - removePrompt(); - } - }; - var keyPressEventHandler = function(e) { - var key = (window.event) ? event.keyCode : e.keyCode; - if (key == 27) { - fadeClicked(); - } - if (key == 9) { - var $inputels = $(':input:enabled:visible', $jqib); - var fwd = !e.shiftKey && e.target == $inputels[$inputels.length - 1]; - var back = e.shiftKey && e.target == $inputels[0]; - if (fwd || back) { - setTimeout( - function() { - if (!$inputels) - return; - var el = $inputels[back === true ? $inputels.length - 1 : 0]; - if (el) - el.focus(); - }, 10); - return false; - } - } - }; - var positionPrompt = function() { - $jqib.css( { - position : (ie6) ? "absolute" : "fixed", - height : $window.height(), - width : "100%", - top : (ie6) ? $window.scrollTop() : 0, - left : 0, - right : 0, - bottom : 0 - }); - $jqif.css( { - position : "absolute", - height : $window.height(), - width : "100%", - top : 0, - left : 0, - right : 0, - bottom : 0 - }); - $jqi.css( { - position : "absolute", - top : options.top, - left : "50%", - marginLeft : (($jqi.outerWidth() / 2) * -1) - }); - }; - var stylePrompt = function() { - $jqif.css( { - zIndex : options.zIndex, - display : "none", - opacity : options.opacity - }); - $jqi.css( { - zIndex : options.zIndex + 1, - display : "none" - }); - $jqib.css( { - zIndex : options.zIndex - }); - }; - var removePrompt = function(callCallback, clicked, msg, formvals) { - $jqi.remove(); - if (ie6) { - $body.unbind('scroll', ie6scroll); - } - $window.unbind('resize', positionPrompt); - $jqif.fadeOut(options.overlayspeed, function() { - $jqif.unbind('click', fadeClicked); - $jqif.remove(); - if (callCallback) { - options.callback(clicked, msg, formvals); - } - $jqib.unbind('keypress', keyPressEventHandler); - $jqib.remove(); - if (ie6 && !options.useiframe) { - $('select').css('visibility', 'visible'); - } - }); - }; - positionPrompt(); - stylePrompt(); - if (ie6) { - $window.scroll(ie6scroll); - } - $jqif.click(fadeClicked); - $window.resize(positionPrompt); - $jqib.bind("keydown keypress", keyPressEventHandler); - $jqi.find('.' + options.prefix + 'close').click(removePrompt); - $jqif.fadeIn(options.overlayspeed); - $jqi[options.show](options.promptspeed, options.loaded); - $jqi - .find( - '#' + options.prefix + 'states .' + options.prefix + '_state:first .' + options.prefix + 'defaultbutton') - .focus(); - if (options.timeout > 0) - setTimeout($.prompt.close, options.timeout); - return $jqib; - }; - $.prompt.defaults = { - prefix : 'jqi', - classes : '', - buttons : { - Ok : true - }, - loaded : function() { - }, - submit : function() { - return true; - }, - callback : function() { - }, - opacity : 0.6, - zIndex : 999, - overlayspeed : 'slow', - promptspeed : 'fast', - show : 'fadeIn', - focus : 0, - useiframe : false, - top : "15%", - persistent : true, - timeout : 0, - state : { - html : '', - buttons : { - Ok : true - }, - focus : 0, - submit : function() { - return true; - } - } - }; - $.prompt.currentPrefix = $.prompt.defaults.prefix; - $.prompt.setDefaults = function(o) { - $.prompt.defaults = $.extend( {}, $.prompt.defaults, o); - }; - $.prompt.setStateDefaults = function(o) { - $.prompt.defaults.state = $.extend( {}, $.prompt.defaults.state, o); - }; - $.prompt.getStateContent = function(state) { - return $('#' + $.prompt.currentPrefix + '_state_' + state); - }; - $.prompt.getCurrentState = function() { - return $('.' + $.prompt.currentPrefix + '_state:visible'); - }; - $.prompt.getCurrentStateName = function() { - var stateid = $.prompt.getCurrentState().attr('id'); - return stateid.replace($.prompt.currentPrefix + '_state_', ''); - }; - $.prompt.goToState = function(state) { - $('.' + $.prompt.currentPrefix + '_state').slideUp('slow'); - $('#' + $.prompt.currentPrefix + '_state_' + state).slideDown( - 'slow', - function() { - $(this).find('.' + $.prompt.currentPrefix + 'defaultbutton') - .focus(); - }); - }; - $.prompt.nextState = function() { - var $next = $('.' + $.prompt.currentPrefix + '_state:visible').next(); - $('.' + $.prompt.currentPrefix + '_state').slideUp('slow'); - $next.slideDown('slow', function() { - $next.find('.' + $.prompt.currentPrefix + 'defaultbutton').focus(); - }); - }; - $.prompt.prevState = function() { - var $next = $('.' + $.prompt.currentPrefix + '_state:visible').prev(); - $('.' + $.prompt.currentPrefix + '_state').slideUp('slow'); - $next.slideDown('slow', function() { - $next.find('.' + $.prompt.currentPrefix + 'defaultbutton').focus(); - }); - }; - $.prompt.close = function() { - $('#' + $.prompt.currentPrefix + 'box').fadeOut('fast', function() { - $(this).remove(); - }); - }; - $.fn.prompt = function(options) { - if (options == undefined) - options = {}; - if (options.withDataAndEvents == undefined) - options.withDataAndEvents = false; - $.prompt($(this).clone(withDataAndEvents).html(), options); - } -})(jQuery); diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index f88f226b3..fe95a5929 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -154,195 +154,63 @@ function loadGroups(data) { // Create link to add nodes var addNodeLink = $('Add node'); addNodeLink.bind('click', function(event) { - // Create form to give node range, group, and hardware management - var mgtForm = '
' - + '
' - + '
' - + '
' - + '' - + '
' - + '
'; - - // Create form for ipmi plugin - var ipmiForm = '
' - + '
Under contruction
' - + '
'; - - // Create form for blade plugin - var bladeForm = '
' - + '
Under contruction
' - + '
'; - - // Create form for hmc plugin - var hmcForm = '
' - + '
Under contruction
' - + '
'; - - // Create form for ivm plugin - var ivmForm = '
' - + '
Under contruction
' - + '
'; - - // Create form for fsp plugin - var fspForm = '
' - + '
Under contruction
' - + '
'; - - // Create form for zvm plugin - var zvmForm = '
' - + '
' - + '
' - + '
'; - - var states = { - mgt : { - html : mgtForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (!v) { - return true; - } else { - // Get the hardware management selected - var mgt = f.mgt; - switch(mgt) { - case "blade": - $.prompt.goToState("blade"); - break; - case "fsp": - $.prompt.goToState("fsp"); - break; - case "hmc": - $.prompt.goToState("hmc"); - break; - case "ipmi": - $.prompt.goToState("ipmi"); - break; - case "ivm": - $.prompt.goToState("ivm"); - break; - case "zvm": - $.prompt.goToState("zvm"); - break; - } - - return false; - } // End of else - } // End of submit - }, - - // Show blade form - blade : { - html : bladeForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Show fsp form - fsp : { - html : fspForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Show hmc form - hmc : { - html : hmcForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Show ipmi form - ipmi : { - html : ipmiForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Show ivm form - ivm : { - html : ivmForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } - }, - - // Show zvm form - zvm : { - html : zvmForm, - buttons : { - Ok : true, - Cancel : false - }, - focus : 1, - prefix : 'cleanblue', - submit : function(v, m, f) { - if (v) { - return true; - } - } + var info = createInfoBar('Select the hardware management for the new node range'); + var addNodeForm = $('
'); + addNodeForm.append(info); + addNodeForm.append('
' + + '' + + '
' ); + + // Create add processor dialog + addNodeForm.dialog({ + position: 'top', + modal: true, + width: 400, + buttons: { + "Cancel": function(){ + // Close dialog + $(this).dialog( "close" ); + }, + "Ok": function(){ + // Get processor properties + var mgt = $(this).find('select[name=mgt]').val(); + + var plugin; + switch(mgt) { + case "blade": + plugin = new bladePlugin(); + break; + case "fsp": + plugin = new fspPlugin(); + break; + case "hmc": + plugin = new hmcPlugin(); + break; + case "ipmi": + plugin = new ipmiPlugin(); + break; + case "ivm": + plugin = new ivmPlugin(); + break; + case "zvm": + plugin = new zvmPlugin(); + break; + } + + plugin.addNode(); + + // Close dialog + $(this).dialog( "close" ); + } } - }; - - $.prompt(states, { - callback : addNode, - prefix : 'cleanblue' - }); + }); }); $('#groups').append(addNodeLink); @@ -1671,47 +1539,4 @@ function loadRconsPage(tgtNodes){ //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"); -} - -/** - * Add node - * - * @param v - * Value of the button clicked - * @param m - * jQuery object of the message within the active state when the user - * clicked the button - * @param f - * Key/value pairs of the form values - * - * @return Nothing - */ -function addNode(v, m, f) { - // If user clicks Ok - if (v) { - var mgt = f.mgt; - var plugin; - switch(mgt) { - case "blade": - plugin = new bladePlugin(); - break; - case "fsp": - plugin = new fspPlugin(); - break; - case "hmc": - plugin = new hmcPlugin(); - break; - case "ipmi": - plugin = new ipmiPlugin(); - break; - case "ivm": - plugin = new ivmPlugin(); - break; - case "zvm": - plugin = new zvmPlugin(); - break; - } - - plugin.addNode(f); - } // End of if } \ No newline at end of file diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 6a79983f2..e89cfacca 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -320,12 +320,27 @@ function createStatusBar(barId) { */ function createInfoBar(msg) { var infoBar = $('
'); - var msg = $('

' + msg + '

'); + var msg = $('

' + msg + '

'); infoBar.append(msg); return infoBar; } +/** + * Create warning bar + * + * @param msg + * Warning message + * @return Warning bar + */ +function createWarnBar(msg) { + var warnBar = $('
'); + var msg = $('

' + msg + '

'); + warnBar.append(msg); + + return warnBar; +} + /** * Create a loader * @@ -504,4 +519,29 @@ function writeRsp(rsp, pattern) { } return prg; -} \ No newline at end of file +} + +/** + * Open a dialog and show given message + * + * @param msg + * Message to show + * @return Nothing + */ +function openDialog(msg) { + // If there was an error, do not continue + var div = $('

' + msg + '

'); + + // Create dialog + div.dialog({ + position: 'top', + modal: true, + width: 400, + buttons: { + "Ok": function(){ + // Close dialog + $(this).dialog("close"); + } + } + }); +}