new UI - clear right panel after deleting a volume.

This commit is contained in:
Jessica Wang 2010-09-21 14:48:48 -07:00
parent 50c319e19b
commit 8dcea8c07e
2 changed files with 45 additions and 20 deletions

View File

@ -136,24 +136,28 @@ function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) {
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
$spinningWheel.hide(); $spinningWheel.hide();
$detailsTab.find("#action_message_box #description").text(label + " action succeeded.");
//RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037) $detailsTab.find("#action_message_box").removeClass("error").show();
//Before Bug 6037 get fixed, use the temporary solution below.
$.ajax({ if(apiCommand.indexOf("command=delete")!=0) {
cache: false, //RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037)
data: createURL("command="+listAPI+"&id="+id), //Before Bug 6037 get fixed, use the temporary solution below.
dataType: "json", $.ajax({
async: false, cache: false,
success: function(json) { data: createURL("command="+listAPI+"&id="+id),
$detailsTab.find("#action_message_box #description").text(label + " action succeeded."); dataType: "json",
$detailsTab.find("#action_message_box").removeClass("error").show(); async: false,
success: function(json) {
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
} }
}); });
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below //After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); //afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
}
else { //apiCommand is deleteXXXXXXX
afterActionSeccessFn(id);
}
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label);
@ -539,7 +543,8 @@ function clearMiddleMenu() {
} }
function clearRightPanel() { 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; var selected_leftmenu_id = null;

View File

@ -98,6 +98,21 @@ function volumeJsonToDetailsTab(jsonObj){
template.find("#grid_links_container").show(); //show actions panel 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 = { var volumeActionMap = {
"Detach Disk": { "Detach Disk": {
@ -118,7 +133,12 @@ var volumeActionMap = {
api: "deleteVolume", api: "deleteVolume",
isAsyncJob: false, isAsyncJob: false,
inProcessText: "Deleting volume....", inProcessText: "Deleting volume....",
afterActionSeccessFn: function(){} afterActionSeccessFn: function(id) {
var $midmenuItem1 = $("#midmenuItem_"+id);
$midmenuItem1.remove();
clearRightPanel();
volumeClearRightPanel();
}
} }
} }