diff --git a/ui/scripts/cloud.core.host.js b/ui/scripts/cloud.core.host.js index 8726631dec2..bf8c7803726 100644 --- a/ui/scripts/cloud.core.host.js +++ b/ui/scripts/cloud.core.host.js @@ -84,7 +84,10 @@ function afterLoadHostJSP() { var tabArray = [$("#tab_details"), $("#tab_primarystorage"), $("#tab_instance"), $("#tab_router"), $("#tab_systemvm"), $("#tab_statistics")]; var tabContentArray = [$("#tab_content_details"), $("#tab_content_primarystorage"), $("#tab_content_instance"), $("#tab_content_router"), $("#tab_content_systemvm"), $("#tab_content_statistics")]; var afterSwitchFnArray = [hostJsonToDetailsTab, hostJsonToPrimaryStorageTab, hostJsonToInstanceTab, hostJsonToRouterTab, hostJsonToSystemvmTab, hostJsonToStatisticsTab]; - switchBetweenDifferentTabs(tabArray, tabContentArray, afterSwitchFnArray); + switchBetweenDifferentTabs(tabArray, tabContentArray, afterSwitchFnArray); + + var $hostNode = $selectedSubMenu.parent(); + bindAddHostButton($hostNode); } function hostJsonToDetailsTab() { @@ -95,9 +98,7 @@ function hostJsonToDetailsTab() { var jsonObj = $midmenuItem1.data("jsonObj"); if(jsonObj == null) return; - - bindAddHostButton($midmenuItem1); - + $.ajax({ data: createURL("command=listHosts&id="+jsonObj.id), dataType: "json", diff --git a/ui/scripts/cloud.core.pod.js b/ui/scripts/cloud.core.pod.js index 3eaa2666037..0fb78380b10 100644 --- a/ui/scripts/cloud.core.pod.js +++ b/ui/scripts/cloud.core.pod.js @@ -424,24 +424,14 @@ function bindAddHostButton($leftmenuItem1) { dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename)); dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname)); } - else if(currentRightPanelJSP == "jsp/host.jsp") { - var hostObj = $leftmenuItem1.data("jsonObj"); - zoneId = hostObj.zoneid; - podId = hostObj.podid; - clusterId = hostObj.clusterid; - dialogAddHost.find("#zone_name").text(fromdb(hostObj.zonename)); - dialogAddHost.find("#pod_name").text(fromdb(hostObj.podname)); - } - /* - else if(currentRightPanelJSP == "jsp/primarystorage.jsp") { - var primarystorageObj = $leftmenuItem1.data("jsonObj"); - zoneId = primarystorageObj.zoneid; - podId = primarystorageObj.podid; - clusterId = primarystorageObj.clusterid; - dialogAddHost.find("#zone_name").text(fromdb(primarystorageObj.zonename)); - dialogAddHost.find("#pod_name").text(fromdb(primarystorageObj.podname)); - } - */ + else if(currentRightPanelJSP == "jsp/host.jsp") { + var clusterObj = $leftmenuItem1.data("clusterObj"); + zoneId = clusterObj.zoneid; + podId = clusterObj.podid; + clusterId = clusterObj.id; + dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename)); + dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname)); + } dialogAddHost.find("#host_hypervisor").change(function() { if($(this).val() == "VmWare") { @@ -596,24 +586,14 @@ function bindAddPrimaryStorageButton($leftmenuItem1) { sourceClusterId = clusterObj.id; dialogAddPool.find("#zone_name").text(fromdb(clusterObj.zonename)); dialogAddPool.find("#pod_name").text(fromdb(clusterObj.podname)); - } - /* - else if(currentRightPanelJSP == "jsp/host.jsp") { - var hostObj = $leftmenuItem1.data("jsonObj"); - zoneId = hostObj.zoneid; - podId = hostObj.podid; - sourceClusterId = hostObj.clusterid; - dialogAddPool.find("#zone_name").text(fromdb(hostObj.zonename)); - dialogAddPool.find("#pod_name").text(fromdb(hostObj.podname)); - } - */ + } else if(currentRightPanelJSP == "jsp/primarystorage.jsp") { - var primarystorageObj = $leftmenuItem1.data("jsonObj"); - zoneId = primarystorageObj.zoneid; - podId = primarystorageObj.podid; - sourceClusterId = primarystorageObj.clusterid; - dialogAddPool.find("#zone_name").text(fromdb(primarystorageObj.zonename)); - dialogAddPool.find("#pod_name").text(fromdb(primarystorageObj.podname)); + var clusterObj = $leftmenuItem1.data("clusterObj"); + zoneId = clusterObj.zoneid; + podId = clusterObj.podid; + sourceClusterId = clusterObj.id; + dialogAddPool.find("#zone_name").text(fromdb(clusterObj.zonename)); + dialogAddPool.find("#pod_name").text(fromdb(clusterObj.podname)); } var clusterSelect = $("#dialog_add_pool").find("#pool_cluster").empty(); diff --git a/ui/scripts/cloud.core.primarystorage.js b/ui/scripts/cloud.core.primarystorage.js index 8275ca0daef..a7e8ba15413 100644 --- a/ui/scripts/cloud.core.primarystorage.js +++ b/ui/scripts/cloud.core.primarystorage.js @@ -74,6 +74,9 @@ function primarystorageToRightPanel($midmenuItem1) { initDialog("dialog_add_pool"); bindEventHandlerToDialogAddPool($("#dialog_add_pool")); initDialog("dialog_confirmation_delete_primarystorage"); + + var $primarystorageNode = $selectedSubMenu.parent(); + bindAddPrimaryStorageButton($primarystorageNode); } function primarystorageJsonToDetailsTab() {