diff --git a/ui/new/scripts/cloud.core2.js b/ui/new/scripts/cloud.core2.js index 9b307abad5a..eb6c619bb16 100644 --- a/ui/new/scripts/cloud.core2.js +++ b/ui/new/scripts/cloud.core2.js @@ -136,24 +136,28 @@ function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) { dataType: "json", async: false, success: function(json) { - $spinningWheel.hide(); - - //RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037) - //Before Bug 6037 get fixed, use the temporary solution below. - $.ajax({ - cache: false, - data: createURL("command="+listAPI+"&id="+id), - dataType: "json", - async: false, - success: function(json) { - $detailsTab.find("#action_message_box #description").text(label + " action succeeded."); - $detailsTab.find("#action_message_box").removeClass("error").show(); - - afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); - } - }); - //After Bug 6037 is fixed, remove temporary solution above and uncomment the line below - //afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); + $spinningWheel.hide(); + $detailsTab.find("#action_message_box #description").text(label + " action succeeded."); + $detailsTab.find("#action_message_box").removeClass("error").show(); + + if(apiCommand.indexOf("command=delete")!=0) { + //RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037) + //Before Bug 6037 get fixed, use the temporary solution below. + $.ajax({ + cache: false, + data: createURL("command="+listAPI+"&id="+id), + dataType: "json", + async: false, + success: function(json) { + afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); + } + }); + //After Bug 6037 is fixed, remove temporary solution above and uncomment the line below + //afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); + } + else { //apiCommand is deleteXXXXXXX + afterActionSeccessFn(id); + } }, error: function(XMLHttpResponse) { handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); @@ -539,7 +543,8 @@ function clearMiddleMenu() { } function clearRightPanel() { - $("#right_panel_content #action_message_box").hide(); + $("#right_panel_content #action_message_box").hide(); + $("#right_panel_content #tab_content_details #action_link #action_menu #action_list").empty(); } var selected_leftmenu_id = null; diff --git a/ui/new/scripts/cloud.core2.volume.js b/ui/new/scripts/cloud.core2.volume.js index 9e3b329e6de..ee9a5edda50 100644 --- a/ui/new/scripts/cloud.core2.volume.js +++ b/ui/new/scripts/cloud.core2.volume.js @@ -98,6 +98,21 @@ function volumeJsonToDetailsTab(jsonObj){ template.find("#grid_links_container").show(); //show actions panel */ } + +function volumeClearRightPanel() { + var $detailsTab = $("#right_panel_content #tab_content_details"); + $detailsTab.find("#id").text(""); + $detailsTab.find("#name").text(""); + $detailsTab.find("#zonename").text(""); + $detailsTab.find("#device_id").text(""); + $detailsTab.find("#state").text(""); + $detailsTab.find("#storage").text(""); + $detailsTab.find("#account").text(""); + $detailsTab.find("#type").text(""); + $detailsTab.find("#size").text(""); + $detailsTab.find("#vm_name").text(""); + $detailsTab.find("#created").text(""); +} var volumeActionMap = { "Detach Disk": { @@ -118,7 +133,12 @@ var volumeActionMap = { api: "deleteVolume", isAsyncJob: false, inProcessText: "Deleting volume....", - afterActionSeccessFn: function(){} + afterActionSeccessFn: function(id) { + var $midmenuItem1 = $("#midmenuItem_"+id); + $midmenuItem1.remove(); + clearRightPanel(); + volumeClearRightPanel(); + } } }