From a1da362d5a794d67f46720aab0a29ad3a01bb645 Mon Sep 17 00:00:00 2001 From: phamt Date: Fri, 24 Sep 2010 12:27:54 +0000 Subject: [PATCH] Cleaned up code git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7606 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvm.js | 17 +++++++++-------- xCAT-UI/js/custom/zvmUtils.js | 10 ++++++++-- xCAT-UI/js/ui.js | 25 +++++++++++++++++++------ 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index f598373e4..10d9f7952 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -491,7 +491,7 @@ zvmPlugin.prototype.loadInventory = function(data) { var addr = $(this).text(); // Open dialog to confirm - var confirmDialog = $('

Are you sure?

'); + var confirmDialog = $('

Are you sure you want to remove this processor?

'); confirmDialog.dialog({ modal: true, width: 300, @@ -599,7 +599,7 @@ zvmPlugin.prototype.loadInventory = function(data) { var addr = $(this).text(); // Open dialog to confirm - var confirmDialog = $('

Are you sure?

'); + var confirmDialog = $('

Are you sure you want to remove this disk?

'); confirmDialog.dialog({ modal: true, width: 300, @@ -691,7 +691,7 @@ zvmPlugin.prototype.loadInventory = function(data) { var addr = $(this).text(); // Open dialog to confirm - var confirmDialog = $('

Are you sure?

'); + var confirmDialog = $('

Are you sure you want to remove this NIC?

'); confirmDialog.dialog({ modal: true, width: 300, @@ -1041,15 +1041,16 @@ zvmPlugin.prototype.addNode = function() { if (tmp[0] == tmp[1]) { // If there was an error, do not continue if (rsp.length) { - openDialog('(Error) Failed to create node definition'); + openDialog('warn', '(Error) Failed to create node definitions'); } else { - openDialog('Node definitions created for ' + nodeRange); + openDialog('info', 'Node definitions created for ' + nodeRange); } } } }); } } else { + // Only one node to add $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -1079,10 +1080,10 @@ zvmPlugin.prototype.addNode = function() { var node = args[1].replace('node=', ''); // If there was an error, do not continue - if (rsp.length) { - openDialog('(Error) Failed to create node definition'); + if (rsp.length) {s + openDialog('warn', '(Error) Failed to create node definition'); } else { - openDialog('Node definitions created for ' + node); + openDialog('info', 'Node definitions created for ' + node); } } }); diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index d3d7bb860..2780abc65 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -1298,10 +1298,13 @@ function openAddNicDialog(node, hcp) { $(this).parent().parent().find('.ui-state-error').remove(); // Get NIC type and network type - var nicType = nicTypeSelect.val(); + var nicType = $(this).parent().parent().find('select[name=nicType]').val(); var networkType = $(this).val(); // Hide network name drop downs + var guestLanQdio = $(this).parent().parent().find('select[name=nicLanQdioName]').parent(); + var guestLanHipers = $(this).parent().parent().find('select[name=nicLanHipersName]').parent(); + var vswitch = $(this).parent().parent().find('select[name=nicVSwitchName]').parent(); guestLanQdio.hide(); guestLanHipers.hide(); vswitch.hide(); @@ -1329,9 +1332,12 @@ function openAddNicDialog(node, hcp) { // Get NIC type and network type var nicType = $(this).val(); - var networkType = networkTypeSelect.val(); + var networkType = $(this).parent().parent().find('select[name=nicNetworkType]').val(); // Hide network name drop downs + var guestLanQdio = $(this).parent().parent().find('select[name=nicLanQdioName]').parent(); + var guestLanHipers = $(this).parent().parent().find('select[name=nicLanHipersName]').parent(); + var vswitch = $(this).parent().parent().find('select[name=nicVSwitchName]').parent(); guestLanQdio.hide(); guestLanHipers.hide(); vswitch.hide(); diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 8d2eea71d..a9d1b19fa 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -319,7 +319,7 @@ function createStatusBar(barId) { * @return Info bar */ function createInfoBar(msg) { - var infoBar = $('
'); + var infoBar = $('
'); var msg = $('

' + msg + '

'); infoBar.append(msg); @@ -334,7 +334,7 @@ function createInfoBar(msg) { * @return Warning bar */ function createWarnBar(msg) { - var warnBar = $('
'); + var warnBar = $('
'); var msg = $('

' + msg + '

'); warnBar.append(msg); @@ -523,15 +523,28 @@ function writeRsp(rsp, pattern) { /** * Open a dialog and show given message * + * @param type + * Type of dialog, i.e. warn or info * @param msg * Message to show * @return Nothing */ -function openDialog(msg) { - var div = $('

' + msg + '

'); - +function openDialog(type, msg) { + var msgDialog; + if (type == "warn") { + // Create warning message + msgDialog = $('
' + + '

' + msg + '

' + + '
'); + } else { + // Create info message + msgDialog = $('
' + + '

' + msg + '

' + +'
'); + } + // Open dialog - div.dialog({ + msgDialog.dialog({ modal: true, width: 400, buttons: {