From 2515cfc4d41266091616b99e474863d5c7a5089f Mon Sep 17 00:00:00 2001 From: phamt Date: Mon, 29 Apr 2013 15:08:10 +0000 Subject: [PATCH] Fixed bug in how jQuery dialogs are closed. If you use dialog('close'), it will only hide the dialog. But if you use dialog('destroy').remove(), the entire dialog will be removed from the page. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16120 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/blade.js | 4 ++-- xCAT-UI/js/custom/esx.js | 10 +++++----- xCAT-UI/js/custom/hmc.js | 10 +++++----- xCAT-UI/js/custom/ipmi.js | 4 ++-- xCAT-UI/js/custom/kvm.js | 4 ++-- xCAT-UI/js/custom/zvm.js | 8 ++++---- xCAT-UI/js/custom/zvmUtils.js | 4 ++-- xCAT-UI/js/monitor/rmcmon.js | 16 ++++++++-------- xCAT-UI/js/nodes/nodes.js | 12 ++++++------ xCAT-UI/js/ui.js | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index bf3d761f1..bf722afc2 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -367,7 +367,7 @@ function addAmmNode(){ $('#addBladeCenter').prepend(createInfoBar('AMM node was successfully added')); $('#addBladeCenter').dialog("option", "buttons", { "Close" : function() { - $('#addBladeCenter').dialog('close'); + $('#addBladeCenter').dialog('destroy').remove(); } }); } @@ -547,7 +547,7 @@ function addMmScanNode(){ msg : '' }, success : function(data){ - $('#addBladeCenter').dialog('close'); + $('#addBladeCenter').dialog('destroy').remove(); } }); } diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 33f686a59..901e8f95a 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -546,10 +546,10 @@ esxPlugin.prototype.addNode = function() { title: 'Add node', modal: true, width: 400, - close: function(){$(this).remove();}, + close: function() {$(this).remove();}, buttons: { - "OK" : function(){addEsxNode();}, - "Cancel": function(){$(this).dialog('close');} + "OK" : function() {addEsxNode();}, + "Cancel": function() {$(this).dialog('destroy').remove();} } }); }; @@ -587,8 +587,8 @@ function addEsxNode(){ // Change dialog buttons $('#addEsx').dialog('option', 'buttons', { - 'Close':function(){ - $('#addEsx').dialog('close'); + 'Close':function() { + $('#addEsx').dialog('destroy').remove(); } }); diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index 70581a2d9..f8ffc0d16 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -217,7 +217,7 @@ hmcPlugin.prototype.addNode = function() { addHmcNode(); }, 'Cancel' : function() { - $('#addHmc').dialog('close'); + $('#addHmc').dialog('destroy').remove(); } }); } else { @@ -227,7 +227,7 @@ hmcPlugin.prototype.addNode = function() { // Change dialog buttons $('#addHmc').dialog('option', 'buttons', { 'Cancel' : function() { - $('#addHmc').dialog('close'); + $('#addHmc').dialog('destroy').remove(); } }); @@ -295,7 +295,7 @@ function addHmcNode() { msg : '' }, success : function(data) { - $('#addHmc').dialog('close'); + $('#addHmc').dialog('destroy').remove(); } }); } @@ -349,7 +349,7 @@ function drawHmcSelector(hmcs) { addPNode(); }, 'Cancel' : function() { - $('#addHmc').dialog('close'); + $('#addHmc').dialog('destroy').remove(); } }); } @@ -466,7 +466,7 @@ function addPNode() { }, success : function(data) { // Refresh the area on the right side - $('#addHmc').dialog('close'); + $('#addHmc').dialog('destroy').remove(); $('.selectgroup').trigger('click'); } }); diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index f57be63e9..839d94d60 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -207,7 +207,7 @@ ipmiPlugin.prototype.addNode = function() { addIdataplex(); }, "Cancel" : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); @@ -247,7 +247,7 @@ function addIdataplex() { // Change dialog buttons $('#addIdplx').dialog('option', 'buttons', { 'Close' : function() { - $('#addIdplx').dialog('close'); + $('#addIdplx').dialog('destroy').remove(); } }); diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js index 4add9688d..034fc5000 100644 --- a/xCAT-UI/js/custom/kvm.js +++ b/xCAT-UI/js/custom/kvm.js @@ -544,7 +544,7 @@ kvmPlugin.prototype.addNode = function() { close: function(){$(this).remove();}, buttons: { "OK" : function(){addKvmNode();}, - "Cancel": function(){$(this).dialog('close');} + "Cancel": function(){$(this).dialog('destroy').remove();} } }); }; @@ -583,7 +583,7 @@ function addKvmNode(){ // Change dialog buttons $('#addKvm').dialog('option', 'buttons', { 'Close':function(){ - $('#addKvm').dialog('close'); + $('#addKvm').dialog('destroy').remove(); } }); diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 346b6436f..407209b1c 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -2035,12 +2035,12 @@ zvmPlugin.prototype.addNode = function() { // If there are no errors if (ready) { - $('#addZvm').append(createLoader()); + $('#addZvm').append(createLoader()); // Change dialog buttons $('#addZvm').dialog('option', 'buttons', { - 'Close':function(){ - $('#addZvm').dialog('close'); + 'Close':function() { + $('#addZvm').dialog('destroy').remove(); } }); @@ -2233,7 +2233,7 @@ zvmPlugin.prototype.addNode = function() { } }, "Cancel": function(){ - $(this).dialog( "close" ); + $(this).dialog('destroy').remove(); } } }); diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 14f78c8db..3945deb33 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -6098,7 +6098,7 @@ function profileDialog() { // Change dialog buttons $('#' + dialogId).dialog('option', 'buttons', { 'Close':function(){ - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } }); @@ -6279,7 +6279,7 @@ function editProfileDialog(profile, pool, size, entry) { // Change dialog buttons $('#' + dialogId).dialog('option', 'buttons', { 'Close':function(){ - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } }); diff --git a/xCAT-UI/js/monitor/rmcmon.js b/xCAT-UI/js/monitor/rmcmon.js index 932b9544d..6b5aaa517 100644 --- a/xCAT-UI/js/monitor/rmcmon.js +++ b/xCAT-UI/js/monitor/rmcmon.js @@ -828,10 +828,10 @@ function mkCondRespDia() { } }); } - $(this).dialog('close'); + $(this).dialog('destroy').remove(); }, 'Cancel' : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); @@ -920,7 +920,7 @@ function chCondScopeDia() { }); }, 'Cancel' : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); @@ -941,10 +941,10 @@ function mkResponseDia() { }, buttons : { 'Ok' : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); }, 'Cancel' : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); @@ -994,7 +994,7 @@ function startStopCondRespDia() { }, buttons : { 'Close' : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); @@ -1122,10 +1122,10 @@ function stopCondRespDia() { $('#rmcEventStatus div').empty().append(data.rsp[0]); } }); - $(this).dialog('close'); + $(this).dialog('destroy').remove(); }, 'Cancel' : function() { - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 87805849a..ce7034fcf 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -400,7 +400,7 @@ function mkAddNodeLink() { }); // Close dialog - addNodeForm.dialog('close'); + addNodeForm.dialog('destroy').remove(); }); advanced.append(advancedLnk); addNodeForm.append(advanced); @@ -410,9 +410,9 @@ function mkAddNodeLink() { modal: true, width: 400, title:'Add node', - close: function(){$(this).remove();}, + close: function() {$(this).remove();}, buttons: { - 'Ok': function(){ + 'Ok': function() { // Get hardware management var mgt = $(this).find('select[name=mgt]').val(); @@ -438,11 +438,11 @@ function mkAddNodeLink() { break; } + $(this).dialog('destroy').remove(); plugin.addNode(); - $(this).dialog('close'); }, 'Cancel': function(){ - $(this).dialog('close'); + $(this).dialog('destroy').remove(); } } }); @@ -1346,7 +1346,7 @@ function addNodes2Table(data) { $('.node').bind('click', loadNode); // Close dialog for updating table - $('.ui-dialog-content').dialog('close'); + $('.ui-dialog-content').dialog('destroy').remove(); /** * Enable editable columns diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index f43081622..dd0a10153 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -914,7 +914,7 @@ function changePassword() { // Change dialog buttons $('#changePassword').dialog('option', 'buttons', { 'Close':function(){ - $('#changePassword').dialog('close'); + $('#changePassword').dialog('destroy').remove(); } });