From afcf6c136003235f488e16491a4fd657e3800c72 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 20 Oct 2010 11:51:14 -0700 Subject: [PATCH] new UI - resources page - fix a bug that clicking on zone/pod/systemVM node will close system menu. --- ui/new/scripts/cloud.core2.resource.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ui/new/scripts/cloud.core2.resource.js b/ui/new/scripts/cloud.core2.resource.js index 605dcb00df5..077cbb4d80d 100644 --- a/ui/new/scripts/cloud.core2.resource.js +++ b/ui/new/scripts/cloud.core2.resource.js @@ -74,7 +74,7 @@ function buildZoneTree() { case "zone_name": - selectLeftMenu(target.parent().parent().parent()); + selectTreeNodeInLeftMenu(target.parent().parent().parent()); var jsonObj = target.data("jsonObj"); showPage($("#zone_page"), jsonObj); hideMiddleMenu(); @@ -82,7 +82,7 @@ function buildZoneTree() { break; case "pod_name" : - selectLeftMenu(target.parent().parent().parent()); + selectTreeNodeInLeftMenu(target.parent().parent().parent()); var jsonObj = target.data("jsonObj"); showPage($("#pod_page"), jsonObj); hideMiddleMenu(); @@ -90,7 +90,7 @@ function buildZoneTree() { break; case "cluster_name" : - selectLeftMenu(target.parent().parent().parent()); + selectTreeNodeInLeftMenu(target.parent().parent().parent()); var jsonObj = target.data("jsonObj"); showPage($("#cluster_page"), jsonObj); showMiddleMenu(); @@ -102,7 +102,7 @@ function buildZoneTree() { break; case "systemvm_name" : - selectLeftMenu(target.parent().parent().parent()); + selectTreeNodeInLeftMenu(target.parent().parent().parent()); var jsonObj = target.data("jsonObj"); showPage($("#systemvm_page"), jsonObj); hideMiddleMenu(); @@ -117,6 +117,13 @@ function buildZoneTree() { //***** build zone tree (end) ************************************************************************************************* } +function selectTreeNodeInLeftMenu($menuToSelect, expandable) { + if($selectedLeftMenu != null) + $selectedLeftMenu.removeClass("selected"); + $menuToSelect.addClass("selected"); + $selectedLeftMenu = $menuToSelect; +} + function zoneJSONToTreeNode(json, $zoneNode) { var zoneid = json.id; $zoneNode.attr("id", "zone_" + zoneid);