New UI - Fixed issues where clicking on a left nav that is opened will make calls to API again. There is no need to do that.

This commit is contained in:
will 2010-10-27 18:00:50 -07:00
parent f64f399d5d
commit 542b5b2d11
2 changed files with 33 additions and 32 deletions

View File

@ -30,11 +30,12 @@ $(document).ready(function() {
// Setup first level navigation // Setup first level navigation
$("#leftmenu_dashboard").bind("click", function(event) { $("#leftmenu_dashboard").bind("click", function(event) {
selectLeftMenu($(this)); if (selectLeftMenu($(this))) {
hideMiddleMenu(); hideMiddleMenu();
$("#right_panel").load("jsp/dashboard.jsp", function(){ $("#right_panel").load("jsp/dashboard.jsp", function(){
afterLoadDashboardJSP(); afterLoadDashboardJSP();
}); });
}
return false; return false;
}); });
$("#leftmenu_storage").bind("click", function(event) { $("#leftmenu_storage").bind("click", function(event) {
@ -50,8 +51,9 @@ $(document).ready(function() {
return false; return false;
}); });
$("#leftmenu_account").bind("click", function(event) { $("#leftmenu_account").bind("click", function(event) {
selectLeftMenu($(this)); if (selectLeftMenu($(this))) {
listMidMenuItems("listAccounts", "listaccountsresponse", "account", "jsp/account.jsp", afterLoadAccountJSP, accountToMidmenu, accountToRightPanel, getMidmenuId, false); listMidMenuItems("listAccounts", "listaccountsresponse", "account", "jsp/account.jsp", afterLoadAccountJSP, accountToMidmenu, accountToRightPanel, getMidmenuId, false);
}
return false; return false;
}); });
$("#leftmenu_events").bind("click", function(event) { $("#leftmenu_events").bind("click", function(event) {
@ -59,9 +61,28 @@ $(document).ready(function() {
return false; return false;
}); });
$("#leftmenu_system").bind("click", function(event) { $("#leftmenu_system").bind("click", function(event) {
if (selectLeftMenu($(this), true)) {
if($("#leftmenu_resource").find("#resource_arrow").hasClass("expanded_open") == true)
$("#leftmenu_resource").click(); //if resource menu is open (i.e. zonetree is shown), empty zonetree and close resource menu.
}
return false;
});
$("#leftmenu_instances").bind("click", function(event) {
instanceBuildSubMenu();
selectLeftMenu($(this), true); selectLeftMenu($(this), true);
if($("#leftmenu_resource").find("#resource_arrow").hasClass("expanded_open") == true) return false;
$("#leftmenu_resource").click(); //if resource menu is open (i.e. zonetree is shown), empty zonetree and close resource menu. });
$("#leftmenu_domain").bind("click", function(event) {
if (selectLeftMenu($(this), true)) {
hideMiddleMenu();
disableMultipleSelectionInMidMenu();
clearMiddleMenu();
bindEventHandlerToDomainTreeNode();
refreshWholeTree(g_domainid, defaultRootLevel);
}
return false; return false;
}); });
@ -94,24 +115,6 @@ $(document).ready(function() {
bindAndListMidMenuItems($("#leftmenu_disk_offering"), "listDiskOfferings", "listdiskofferingsresponse", "diskoffering", "jsp/diskoffering.jsp", afterLoadDiskOfferingJSP, diskOfferingToMidmenu, diskOfferingToRightPanel, getMidmenuId, false); bindAndListMidMenuItems($("#leftmenu_disk_offering"), "listDiskOfferings", "listdiskofferingsresponse", "diskoffering", "jsp/diskoffering.jsp", afterLoadDiskOfferingJSP, diskOfferingToMidmenu, diskOfferingToRightPanel, getMidmenuId, false);
bindAndListMidMenuItems($("#leftmenu_global_setting"), "listConfigurations", "listconfigurationsresponse", "configuration", "jsp/globalsetting.jsp", afterLoadGlobalSettingJSP, globalSettingToMidmenu, globalSettingToRightPanel, globalSettingGetMidmenuId, false); bindAndListMidMenuItems($("#leftmenu_global_setting"), "listConfigurations", "listconfigurationsresponse", "configuration", "jsp/globalsetting.jsp", afterLoadGlobalSettingJSP, globalSettingToMidmenu, globalSettingToRightPanel, globalSettingGetMidmenuId, false);
$("#leftmenu_instances").bind("click", function(event) {
instanceBuildSubMenu();
selectLeftMenu($(this), true);
return false;
});
$("#leftmenu_domain").bind("click", function(event) {
selectLeftMenu($(this), true);
hideMiddleMenu();
disableMultipleSelectionInMidMenu();
clearMiddleMenu();
bindEventHandlerToDomainTreeNode();
refreshWholeTree(g_domainid, defaultRootLevel);
return false;
});
$("#leftmenu_resource").bind("click", function(event) { $("#leftmenu_resource").bind("click", function(event) {
showMiddleMenu(); showMiddleMenu();
disableMultipleSelectionInMidMenu(); disableMultipleSelectionInMidMenu();
@ -140,10 +143,6 @@ $(document).ready(function() {
return false; return false;
}); });
// Prevent the UI from being iframed if the iframe isn't from the same domain. // Prevent the UI from being iframed if the iframe isn't from the same domain.
try { try {
if ( top != self && self.location.hostname != top.location.hostname) { if ( top != self && self.location.hostname != top.location.hostname) {

View File

@ -606,7 +606,9 @@ function selectLeftMenu($menuToSelect, expandable) {
// Close the help link if it's opened // Close the help link if it's opened
$("#help_dropdown_dialog").hide(); $("#help_dropdown_dialog").hide();
$("#help_button").removeClass("selected"); $("#help_button").removeClass("selected");
return true;
} }
return false;
} }
var $selectedSubMenu; var $selectedSubMenu;