bug 7701: optimize bindAddHostButton(), bindAddPrimaryStorageButton().

This commit is contained in:
Jessica Wang 2010-12-29 12:27:53 -08:00
parent 2eb2024781
commit 6541c3ba2a
3 changed files with 10 additions and 9 deletions

View File

@ -98,8 +98,8 @@ function hostJsonToDetailsTab() {
if(jsonObj == null)
return;
bindAddHostButton($("#add_host_button"), "host_page", $midmenuItem1);
bindAddPrimaryStorageButton($("#add_primarystorage_button"), "host_page", $midmenuItem1);
bindAddHostButton($midmenuItem1);
bindAddPrimaryStorageButton($midmenuItem1);
$.ajax({
data: createURL("command=listHosts&id="+jsonObj.id),

View File

@ -43,8 +43,8 @@
function podJsonToRightPanel($leftmenuItem1) {
bindAddClusterButton($("#add_cluster_button"), "pod_page", $leftmenuItem1);
bindAddHostButton($("#add_host_button"), "pod_page", $leftmenuItem1);
bindAddPrimaryStorageButton($("#add_primarystorage_button"), "pod_page", $leftmenuItem1);
bindAddHostButton($leftmenuItem1);
bindAddPrimaryStorageButton($leftmenuItem1);
$("#right_panel_content").data("$leftmenuItem1", $leftmenuItem1);
$("#tab_details").click();
@ -390,7 +390,8 @@ function bindAddClusterButton($button, currentPageInRightPanel, $leftmenuItem1)
});
}
function bindAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
function bindAddHostButton($leftmenuItem1) {
var $button = $("#add_host_button");
$button.unbind("click").bind("click", function(event) {
dialogAddHost = $("#dialog_add_host");
dialogAddHost.find("#info_container").hide();
@ -585,8 +586,8 @@ function clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, exist
}
}
function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenuItem1) {
$button.show();
function bindAddPrimaryStorageButton($leftmenuItem1) {
var $button = $("#add_primarystorage_button");
$button.unbind("click").bind("click", function(event) {
if($("#tab_content_primarystorage").length > 0 && $("#tab_content_primarystorage").css("display") == "none")
$("#tab_primarystorage").click();

View File

@ -59,8 +59,8 @@ function primarystorageJsonToDetailsTab() {
if(jsonObj == null)
return;
bindAddHostButton($("#add_host_button"), "primarystorage_page", $midmenuItem1);
bindAddPrimaryStorageButton($("#add_primarystorage_button"), "primarystorage_page", $midmenuItem1);
bindAddHostButton($midmenuItem1);
bindAddPrimaryStorageButton($midmenuItem1);
$.ajax({
data: createURL("command=listStoragePools&id="+jsonObj.id),