Changed confirm() prompt to dialogs.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7604 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2010-09-24 03:06:44 +00:00
parent 8cda0d2b98
commit 3cb18cde24
2 changed files with 124 additions and 72 deletions

View File

@ -488,9 +488,23 @@ zvmPlugin.prototype.loadInventory = function(data) {
*/
var contextMenu = [{
'Remove' : function(menuItem, menu) {
if (confirm('Are you sure?')) {
removeProcessor(node, $(this).text());
}
var addr = $(this).text();
// Open dialog to confirm
var confirmDialog = $('<div><p>Are you sure?</p></div>');
confirmDialog.dialog({
modal: true,
width: 300,
buttons: {
"Cancel": function() {
$(this).dialog("close");
},
"Ok": function(){
removeProcessor(node, addr);
$(this).dialog("close");
}
}
});
}
}];
@ -582,9 +596,23 @@ zvmPlugin.prototype.loadInventory = function(data) {
*/
contextMenu = [{
'Remove' : function(menuItem, menu) {
if (confirm('Are you sure?')) {
removeDisk(node, $(this).text());
}
var addr = $(this).text();
// Open dialog to confirm
var confirmDialog = $('<div><p>Are you sure?</p></div>');
confirmDialog.dialog({
modal: true,
width: 300,
buttons: {
"Cancel": function() {
$(this).dialog("close");
},
"Ok": function(){
removeDisk(node, addr);
$(this).dialog("close");
}
}
});
}
}];
@ -660,9 +688,23 @@ zvmPlugin.prototype.loadInventory = function(data) {
*/
contextMenu = [ {
'Remove' : function(menuItem, menu) {
if (confirm('Are you sure?')) {
removeNic(node, $(this).text());
}
var addr = $(this).text();
// Open dialog to confirm
var confirmDialog = $('<div><p>Are you sure?</p></div>');
confirmDialog.dialog({
modal: true,
width: 300,
buttons: {
"Cancel": function() {
$(this).dialog("close");
},
"Ok": function(){
removeNic(node, addr);
$(this).dialog("close");
}
}
});
}
} ];

View File

@ -2284,73 +2284,83 @@ function createZProvisionNew(inst) {
// If no OS is given, create a virtual server
var msg = '';
if (diskRows.length > 0) {
msg = 'Do you want to create a virtual server without an operating system ?';
msg = 'Do you want to create a virtual server without an operating system?';
} else {
// If no disks are given, create a virtual server (no disk)
msg = 'Do you want to create a virtual server without an operating system or disks?';
}
// If no disks are given, create a virtual server (no disk)
else {
msg = 'Do you want to create a virtual server without an operating system or disks ?';
}
// If user clicks Ok
if (confirm(msg)) {
// Disable provision button
$(this).attr('disabled', 'true');
// Show loader
$('#zProvisionStatBar' + inst).show();
$('#zProvisionLoader' + inst).show();
// Disable add disk button
addDiskLink.attr('disabled', 'true');
// Disable close button on disk table
$('#' + thisTabId + ' table span').unbind('click');
// Disable all inputs
var inputs = $('#' + thisTabId + ' input');
inputs.attr('disabled', 'disabled');
// Disable all selects
var selects = $('#' + thisTabId + ' select');
selects.attr('disabled', 'disabled');
// Add a new line at the end of the user entry
var textarea = $('#' + thisTabId + ' textarea');
var tmp = jQuery.trim(textarea.val());
textarea.val(tmp + '\n');
textarea.attr('readonly', 'readonly');
textarea.css( {
'background-color' : '#F2F2F2'
});
// Get node name
var node = $('#' + thisTabId + ' input[name=nodeName]').val();
// Get userId
var userId = $('#' + thisTabId + ' input[name=userId]').val();
// Get hardware control point
var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
// Get group
var group = $('#' + thisTabId + ' input[name=group]').val();
/**
* (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=nodeadd;out=' + inst
// Open dialog to confirm
var confirmDialog = $('<div><p>' + msg + '</p></div>');
confirmDialog.dialog({
modal: true,
width: 400,
buttons: {
"Cancel": function() {
$(this).dialog("close");
},
"Ok": function(){
// Disable provision button
provisionBtn.attr('disabled', 'true');
// Show loader
$('#zProvisionStatBar' + inst).show();
$('#zProvisionLoader' + inst).show();
success : updateZProvisionNewStatus
});
}
// Disable add disk button
addDiskLink.attr('disabled', 'true');
// Disable close button on disk table
$('#' + thisTabId + ' table span').unbind('click');
// Disable all inputs
var inputs = $('#' + thisTabId + ' input');
inputs.attr('disabled', 'disabled');
// Disable all selects
var selects = $('#' + thisTabId + ' select');
selects.attr('disabled', 'disabled');
// Add a new line at the end of the user entry
var textarea = $('#' + thisTabId + ' textarea');
var tmp = jQuery.trim(textarea.val());
textarea.val(tmp + '\n');
textarea.attr('readonly', 'readonly');
textarea.css( {
'background-color' : '#F2F2F2'
});
// Get node name
var node = $('#' + thisTabId + ' input[name=nodeName]').val();
// Get userId
var userId = $('#' + thisTabId + ' input[name=userId]').val();
// Get hardware control point
var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
// Get group
var group = $('#' + thisTabId + ' input[name=group]').val();
/**
* (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=nodeadd;out=' + inst
},
success : updateZProvisionNewStatus
});
$(this).dialog("close");
} // End of function()
}
});
} else {
/**
* Create a virtual server and install OS