Cleaned up code

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7606 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2010-09-24 12:27:54 +00:00
parent a6338d15a7
commit a1da362d5a
3 changed files with 36 additions and 16 deletions

View File

@ -491,7 +491,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
var addr = $(this).text();
// Open dialog to confirm
var confirmDialog = $('<div><p>Are you sure?</p></div>');
var confirmDialog = $('<div><p>Are you sure you want to remove this processor?</p></div>');
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 = $('<div><p>Are you sure?</p></div>');
var confirmDialog = $('<div><p>Are you sure you want to remove this disk?</p></div>');
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 = $('<div><p>Are you sure?</p></div>');
var confirmDialog = $('<div><p>Are you sure you want to remove this NIC?</p></div>');
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);
}
}
});

View File

@ -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();

View File

@ -319,7 +319,7 @@ function createStatusBar(barId) {
* @return Info bar
*/
function createInfoBar(msg) {
var infoBar = $('<div class="ui-state-highlight ui-corner-all">');
var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>');
var msg = $('<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>');
infoBar.append(msg);
@ -334,7 +334,7 @@ function createInfoBar(msg) {
* @return Warning bar
*/
function createWarnBar(msg) {
var warnBar = $('<div class="ui-state-error ui-corner-all">');
var warnBar = $('<div class="ui-state-error ui-corner-all"></div>');
var msg = $('<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>');
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 = $('<div><p>' + msg + '</p></div>');
function openDialog(type, msg) {
var msgDialog;
if (type == "warn") {
// Create warning message
msgDialog = $('<div class="ui-state-error ui-corner-all">'
+ '<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>'
+ '</div>');
} else {
// Create info message
msgDialog = $('<div class="ui-state-highlight ui-corner-all">'
+ '<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>'
+'</div>');
}
// Open dialog
div.dialog({
msgDialog.dialog({
modal: true,
width: 400,
buttons: {