diff --git a/ui/scripts/cloud.core.js b/ui/scripts/cloud.core.js index 4ef68cb4bb8..a99a2e72daa 100644 --- a/ui/scripts/cloud.core.js +++ b/ui/scripts/cloud.core.js @@ -1009,7 +1009,7 @@ function listMidMenuItems2(commandString, getSearchParamsFn, jsonResponse1, json var currentLeftMenuId; var currentRightPanelJSP = null; -function listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, leftmenuId) { +function listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, leftmenuId, refreshDataBindingFn) { clearMiddleMenu(); showMiddleMenu(); $("#midmenu_container").hide(); @@ -1042,7 +1042,10 @@ function listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonR afterLoadRightPanelJSPFn(); listMidMenuItems2(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, 1); }); - } else { + } else { + if(refreshDataBindingFn != null) + refreshDataBindingFn(); + listMidMenuItems2(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, 1); } return false; diff --git a/ui/scripts/cloud.core.pod.js b/ui/scripts/cloud.core.pod.js index c3815e3c8c3..d5bd7b6947e 100644 --- a/ui/scripts/cloud.core.pod.js +++ b/ui/scripts/cloud.core.pod.js @@ -613,12 +613,12 @@ function bindAddPrimaryStorageButton($leftmenuItem1) { } var clusterSelect = $("#dialog_add_pool").find("#pool_cluster").empty(); - var mapClusters = {}; + var mapClusters = {}; $.ajax({ data: createURL("command=listClusters&podid=" + podId), async: false, dataType: "json", - success: function(json) { + success: function(json) { var items = json.listclustersresponse.cluster; if(items != null && items.length > 0) { mapClusters = {}; @@ -635,12 +635,12 @@ function bindAddPrimaryStorageButton($leftmenuItem1) { } }); - $("#pool_cluster", dialogAddPool).change(function() { + $("#pool_cluster", dialogAddPool).unbind("change").bind("change", function() { var curOption = $(this).val(); if(!curOption) return false; - var $protocolSelector = $("#add_pool_protocol", dialogAddPool); + var $protocolSelector = $("#add_pool_protocol", dialogAddPool); var objCluster = mapClusters['cluster_'+curOption]; if(objCluster.hypervisortype == "KVM") { diff --git a/ui/scripts/cloud.core.primarystorage.js b/ui/scripts/cloud.core.primarystorage.js index dcddbf9fc13..57bbebf9876 100644 --- a/ui/scripts/cloud.core.primarystorage.js +++ b/ui/scripts/cloud.core.primarystorage.js @@ -63,15 +63,19 @@ function primarystorageToRightPanel($midmenuItem1) { primarystorageJsonToDetailsTab(); } - function afterLoadPrimaryStorageJSP($midmenuItem1) { +function afterLoadPrimaryStorageJSP() { //add pool dialog initDialog("dialog_add_pool"); bindEventHandlerToDialogAddPool($("#dialog_add_pool")); initDialog("dialog_confirmation_delete_primarystorage"); + primaryStorageRefreshDataBinding(); +} + +function primaryStorageRefreshDataBinding() { var $primarystorageNode = $selectedSubMenu.parent(); - bindAddPrimaryStorageButton($primarystorageNode); + bindAddPrimaryStorageButton($primarystorageNode); } function primarystorageJsonToDetailsTab() { @@ -81,9 +85,7 @@ function primarystorageJsonToDetailsTab() { var jsonObj = $midmenuItem1.data("jsonObj"); if(jsonObj == null) - return; - - bindAddPrimaryStorageButton($midmenuItem1); + return; $.ajax({ data: createURL("command=listStoragePools&id="+jsonObj.id), diff --git a/ui/scripts/cloud.core.resource.js b/ui/scripts/cloud.core.resource.js index d0c8ea3d7bf..9abe8cabbb3 100644 --- a/ui/scripts/cloud.core.resource.js +++ b/ui/scripts/cloud.core.resource.js @@ -241,7 +241,7 @@ function buildZoneTree() { primarystorageClearRightPanel(); var clusterObj = $(this).data("clusterObj"); - listMidMenuItems(("listStoragePools&clusterid="+clusterObj.id), primarystorageGetSearchParams, "liststoragepoolsresponse", "storagepool", "jsp/primarystorage.jsp", afterLoadPrimaryStorageJSP, primarystorageToMidmenu, primarystorageToRightPanel, getMidmenuId, false, ("cluster_"+clusterObj.id+"_primarystorage")); + listMidMenuItems(("listStoragePools&clusterid="+clusterObj.id), primarystorageGetSearchParams, "liststoragepoolsresponse", "storagepool", "jsp/primarystorage.jsp", afterLoadPrimaryStorageJSP, primarystorageToMidmenu, primarystorageToRightPanel, getMidmenuId, false, ("cluster_"+clusterObj.id+"_primarystorage"), primaryStorageRefreshDataBinding); return false; });