fix a bug that zonetree is not expanded/collapsed after being clicked the 2nd time.

This commit is contained in:
Jessica Wang 2010-12-28 16:17:19 -08:00
parent 3a143577b9
commit 383f524725
3 changed files with 34 additions and 49 deletions

View File

@ -180,28 +180,38 @@ $(document).ready(function() {
return false;
});
$("#leftmenu_physical_resource").bind("click", function(event) {
if(currentRightPanelJSP != "jsp/resource.jsp") {
expandOrCollapseZoneTree();
$("#right_panel").data("onRefreshFn", function() {
$("#leftmenu_physical_resource").click();
});
//clearButtonsOnTop();
removeDialogs();
$("#right_panel").load("jsp/resource.jsp", function(){
currentRightPanelJSP = "jsp/resource.jsp";
afterLoadResourceJSP();
});
}
else {
resourceCountTotal();
var $target = $(event.target);
var targetId = $target.attr("id");
if(targetId == "physical_resource_arrow") {
if($target.hasClass("expanded_close") == true) {
$target.removeClass("expanded_close").addClass("expanded_open");
buildZoneTree();
} else {
$target.removeClass("expanded_open").addClass("expanded_close");
$("#leftmenu_zone_tree").find("#tree_container").empty();
}
}
else {
if(currentRightPanelJSP != "jsp/resource.jsp") {
removeDialogs();
$("#right_panel").data("onRefreshFn", function() {
$("#leftmenu_physical_resource").click();
});
$("#right_panel").load("jsp/resource.jsp", function(){
currentRightPanelJSP = "jsp/resource.jsp";
afterLoadResourceJSP();
});
}
else {
resourceCountTotal();
}
}
return false;
});

View File

@ -1111,33 +1111,7 @@ function drawBarChart($capacity, percentused) { //percentused == "0.01%" (having
else if (percentusedFloat > 0.8 )
$capacity.find("#bar_chart").removeClass().addClass("db_barbox high").css("width", percentused);
}
function expandOrCollapseZoneTree() {
$arrowIcon = $("#leftmenu_physical_resource").find("#physical_resource_arrow");
if($arrowIcon.hasClass("expanded_close") == true) {
$arrowIcon.removeClass("expanded_close").addClass("expanded_open");
buildZoneTree();
} else {
$arrowIcon.removeClass("expanded_open").addClass("expanded_close");
$("#leftmenu_zone_tree").find("#tree_container").empty();
}
}

View File

@ -656,8 +656,9 @@ function initAddHostShortcut() {
function initAddZoneLinks() {
$("#add_zone_shortcut,#add_zone_button").unbind("click").bind("click", function(event) {
if($("#leftmenu_physical_resource").find("#physical_resource_arrow").hasClass("expanded_close") == true)
expandOrCollapseZoneTree(); //if Physical Resource arrow shows closed (i.e. zonetree is hidden), expand and show zonetree.
var $arrowIcon = $("#leftmenu_physical_resource").find("#physical_resource_arrow");
if($arrowIcon.hasClass("expanded_close") == true)
$arrowIcon.click(); //if Physical Resource arrow shows closed (i.e. zonetree is hidden), expand and show zonetree.
openAddZoneWizard();
return false;