diff --git a/ui/scripts/cloud.core.init.js b/ui/scripts/cloud.core.init.js index 711088518f1..57ad6a20c04 100644 --- a/ui/scripts/cloud.core.init.js +++ b/ui/scripts/cloud.core.init.js @@ -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; }); diff --git a/ui/scripts/cloud.core.js b/ui/scripts/cloud.core.js index 303521749fc..e8ee25e10e4 100644 --- a/ui/scripts/cloud.core.js +++ b/ui/scripts/cloud.core.js @@ -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(); - } -} - - - - - - - - - - - - - - - - + diff --git a/ui/scripts/cloud.core.resource.js b/ui/scripts/cloud.core.resource.js index c94f4bd5e8d..2fcbd432c3a 100644 --- a/ui/scripts/cloud.core.resource.js +++ b/ui/scripts/cloud.core.resource.js @@ -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;