bug 7823: refresh data binding when clicking each primary storage node (since each primary storage has different cluster info).

This commit is contained in:
Jessica Wang 2011-01-03 16:29:52 -08:00
parent 92d9e35110
commit 3f60e579f7
4 changed files with 17 additions and 12 deletions

View File

@ -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;

View File

@ -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") {

View File

@ -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),

View File

@ -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;
});