bug 7357: pod page - clear tab when pod is deleted and a tab is clicked.

This commit is contained in:
Jessica Wang 2011-01-24 16:54:48 -08:00
parent 035adf4e57
commit 89961333c8

View File

@ -54,12 +54,16 @@ function podJsonToRightPanel($leftmenuItem1) {
function podJsonToDetailsTab() { function podJsonToDetailsTab() {
var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1"); var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
if($leftmenuItem1 == null) if($leftmenuItem1 == null) {
podClearDetailsTab();
return; return;
}
var jsonObj = $leftmenuItem1.data("jsonObj"); var jsonObj = $leftmenuItem1.data("jsonObj");
if(jsonObj == null) if(jsonObj == null) {
podClearDetailsTab();
return; return;
}
$.ajax({ $.ajax({
data: createURL("command=listPods&id="+jsonObj.id), data: createURL("command=listPods&id="+jsonObj.id),
@ -139,12 +143,16 @@ function podJsonToDetailsTab() {
function podJsonToNetworkTab() { function podJsonToNetworkTab() {
var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1"); var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
if($leftmenuItem1 == null) if($leftmenuItem1 == null) {
podClearNetworkTab();
return; return;
}
var jsonObj = $leftmenuItem1.data("jsonObj"); var jsonObj = $leftmenuItem1.data("jsonObj");
if(jsonObj == null) if(jsonObj == null) {
podClearNetworkTab();
return; return;
}
var $thisTab = $("#right_panel_content #tab_content_ipallocation"); var $thisTab = $("#right_panel_content #tab_content_ipallocation");
$thisTab.find("#tab_container").hide(); $thisTab.find("#tab_container").hide();
@ -170,6 +178,12 @@ function podJsonToNetworkTab() {
}); });
} }
function podClearNetworkTab() {
var $thisTab = $("#right_panel_content #tab_content_ipallocation");
$thisTab.find("#tab_container").empty();
}
function podNetworkJsonToTemplate(jsonObj, template) { function podNetworkJsonToTemplate(jsonObj, template) {
template.data("jsonObj", jsonObj); template.data("jsonObj", jsonObj);
template.attr("id", "pod_VLAN_"+fromdb(jsonObj.id)).data("podVLANId", fromdb(jsonObj.id)); template.attr("id", "pod_VLAN_"+fromdb(jsonObj.id)).data("podVLANId", fromdb(jsonObj.id));
@ -209,11 +223,12 @@ var podNetworkActionMap = {
} }
} }
function podJsonClearRightPanel(jsonObj) { function podClearRightPanel() {
podJsonClearDetailsTab(jsonObj); podClearDetailsTab();
podClearNetworkTab();
} }
function podJsonClearDetailsTab(jsonObj) { function podClearDetailsTab() {
var $thisTab = $("#right_panel_content #tab_content_details"); var $thisTab = $("#right_panel_content #tab_content_details");
$thisTab.find("#grid_header_title").text(""); $thisTab.find("#grid_header_title").text("");
$thisTab.find("#id").text(""); $thisTab.find("#id").text("");
@ -913,7 +928,7 @@ var podActionMap = {
$(this).remove(); $(this).remove();
if(id.toString() == $("#right_panel_content").find("#tab_content_details").find("#id").text()) { if(id.toString() == $("#right_panel_content").find("#tab_content_details").find("#id").text()) {
clearRightPanel(); clearRightPanel();
podJsonClearRightPanel(); podClearRightPanel();
} }
}); });
} }