From 67fd52db0837e24b90232d384e946b8ff2061a82 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 29 Nov 2010 16:26:43 -0800 Subject: [PATCH] new UI - refresh button - replace leftmenuId with onRefreshFn which is more flexible to customize. --- ui/scripts/cloud.core.init.js | 22 +++++++++++++++------- ui/scripts/cloud.core.js | 6 ++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ui/scripts/cloud.core.init.js b/ui/scripts/cloud.core.init.js index 9d4710f3d4d..02c597428c8 100644 --- a/ui/scripts/cloud.core.init.js +++ b/ui/scripts/cloud.core.init.js @@ -49,7 +49,9 @@ $(document).ready(function() { disableMultipleSelectionInMidMenu(); clearMiddleMenu(); - $("#right_panel").data("leftmenuId", "leftmenu_domain"); + $("#right_panel").data("onRefresh", function() { + $("#leftmenu_domain").click(); + }); bindEventHandlerToDomainTreeNode(); refreshWholeTree(g_domainid, defaultRootLevel); @@ -69,7 +71,9 @@ $(document).ready(function() { clearMiddleMenu(); hideMiddleMenu(); - $("#right_panel").data("leftmenuId", "leftmenu_dashboard"); + $("#right_panel").data("onRefreshFn", function() { + $("#leftmenu_dashboard").click(); + }); $("#right_panel").load("jsp/dashboard.jsp", function(){ afterLoadDashboardJSP(); @@ -136,7 +140,9 @@ $(document).ready(function() { hideMiddleMenu(); clearMiddleMenu(); - $("#right_panel").data("leftmenuId", "leftmenu_global_setting"); + $("#right_panel").data("onRefreshFn", function() { + $("#leftmenu_global_setting").click(); + }); $("#right_panel").load("jsp/globalsetting.jsp", function(){ var $actionLink = $("#right_panel_content #tab_content_details #action_link"); @@ -162,7 +168,9 @@ $(document).ready(function() { expandOrCollapseZoneTree(); - $("#right_panel").data("leftmenuId", "leftmenu_physical_resource"); + $("#right_panel").data("onRefreshFn", function() { + $("#leftmenu_physical_resource").click(); + }); resourceLoadPage("jsp/resource.jsp", null); return false; @@ -204,9 +212,9 @@ $(document).ready(function() { // refresh button $("#refresh_link").bind("click", function(event) { - var leftmenuId = $("#right_panel").data("leftmenuId"); - if(leftmenuId != null && leftmenuId.length > 0) - $("#"+leftmenuId).click(); + var onRefreshFn = $("#right_panel").data("onRefreshFn"); + if(onRefreshFn != null) + onRefreshFn(); return false; }); diff --git a/ui/scripts/cloud.core.js b/ui/scripts/cloud.core.js index bec54e9a77c..fff1902cc93 100644 --- a/ui/scripts/cloud.core.js +++ b/ui/scripts/cloud.core.js @@ -981,8 +981,10 @@ function listMidMenuItems(commandString, jsonResponse1, jsonResponse2, rightPane $("#midmenu_container").hide(); $("#midmenu_spinning_wheel").show(); - $("#right_panel").data("leftmenuId", leftmenuId); - + $("#right_panel").data("onRefreshFn", function() { + $("#"+leftmenuId).click(); + }); + $("#right_panel").load(rightPanelJSP, function(){ var $actionLink = $("#right_panel_content #tab_content_details #action_link"); $actionLink.bind("mouseover", function(event) {