new UI - resources page - show Add VLAN IP Range at Network tab, show Add Secondary Storage at Secondary Storage tab, hide them otherwise.

This commit is contained in:
Jessica Wang 2010-10-17 08:31:04 -07:00
parent 7871c26281
commit 2d8de2ec13
2 changed files with 19 additions and 4 deletions

View File

@ -587,13 +587,13 @@ function initializeEditFunction($readonlyFields, $editFields, doUpdateFn) {
});
}
function switchBetweenDifferentTabs(tabArray, tabContentArray) {
function switchBetweenDifferentTabs(tabArray, tabContentArray, afterSwitchFnArray) {
for(var tabIndex=0; tabIndex<tabArray.length; tabIndex++) {
switchToTab(tabIndex, tabArray, tabContentArray);
switchToTab(tabIndex, tabArray, tabContentArray, afterSwitchFnArray);
}
}
function switchToTab(tabIndex, tabArray, tabContentArray) {
function switchToTab(tabIndex, tabArray, tabContentArray, afterSwitchFnArray) {
tabArray[tabIndex].bind("click", function(event){
tabArray[tabIndex].removeClass("off").addClass("on"); //current tab turns on
for(var k=0; k<tabArray.length; k++) {
@ -606,6 +606,9 @@ function switchToTab(tabIndex, tabArray, tabContentArray) {
if(k != tabIndex)
tabContentArray[k].hide(); //other tab content hide
}
if(afterSwitchFnArray != null)
afterSwitchFnArray[tabIndex]();
return false;
});
}

View File

@ -387,13 +387,25 @@ function toSystemVMTypeText(value) {
}
//***** systemVM page (end) ***************************************************************************************************
function afterSwitchToDetailsTab() {
$("#midmenu_add2_link").hide();
}
function afterSwitchToNetworkTab() {
$("#midmenu_add2_link").find("#label").text("Add VLAN IP Range");
$("#midmenu_add2_link").show();
}
function afterSwitchToSecondaryStorageTab() {
$("#midmenu_add2_link").find("#label").text("Add Secondary Storage").show();
$("#midmenu_add2_link").show();
}
function afterLoadResourceJSP() {
//switch between different tabs in zone page
var $zonePage = $("#zone_page");
var tabArray = [$zonePage.find("#tab_details"), $zonePage.find("#tab_network"), $zonePage.find("#tab_secondary_storage")];
var tabContentArray = [$zonePage.find("#tab_content_details"), $zonePage.find("#tab_content_network"), $zonePage.find("#tab_content_secondary_storage")];
switchBetweenDifferentTabs(tabArray, tabContentArray);
var afterSwitchFnArray = [afterSwitchToDetailsTab, afterSwitchToNetworkTab, afterSwitchToSecondaryStorageTab];
switchBetweenDifferentTabs(tabArray, tabContentArray, afterSwitchFnArray);
//dialogs
initDialog("dialog_add_zone");