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",
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;

View File

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