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

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

@ -99,6 +99,21 @@ function volumeJsonToDetailsTab(jsonObj){
*/ */
} }
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": {
api: "detachVolume", api: "detachVolume",
@ -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();
}
} }
} }