From 4b2c414ed52a40a91fbd8b4eef00a70539bba736 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 13 Jan 2011 17:41:30 -0800 Subject: [PATCH] bug 7905: VM wizard - hypervisor field - show text if only one hypervisor is returned from lsitThypervisors API. --- ui/jsp/instance.jsp | 1 + ui/scripts/cloud.core.instance.js | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ui/jsp/instance.jsp b/ui/jsp/instance.jsp index c52110b8a61..2c33906c9a7 100644 --- a/ui/jsp/instance.jsp +++ b/ui/jsp/instance.jsp @@ -860,6 +860,7 @@ --> +
[Submitted by: ]
diff --git a/ui/scripts/cloud.core.instance.js b/ui/scripts/cloud.core.instance.js index 8c05189b013..44fbdb36b94 100644 --- a/ui/scripts/cloud.core.instance.js +++ b/ui/scripts/cloud.core.instance.js @@ -157,9 +157,18 @@ function afterLoadInstanceJSP() { success: function(json) { var items = json.listhypervisorsresponse.hypervisor; var $hypervisorDropdown = $("#vmiso_in_vmwizard").find("#hypervisor_select"); - if(items != null && items.length > 0) { - for(var i=0; i"+fromdb(items[i].name)+""); + var $hypervisorSpan = $("#vmiso_in_vmwizard").find("#hypervisor_span"); + if(items != null && items.length > 0) { + if(items.length == 1) { + $hypervisorSpan.text(fromdb(items[0].name)).show(); + $hypervisorDropdown.hide(); + } + else { + $hypervisorDropdown.show(); + $hypervisorSpan.text("").hide(); + for(var i=0; i"+fromdb(items[i].name)+""); + } } } } @@ -787,10 +796,15 @@ function initVMWizard() { $thisPopup.find("#wizard_review_zone").text($thisPopup.find("#wizard_zone option:selected").text()); // This is taking from the selected template but need to change this to the dropdown that supports ISO. - if($selectedVmWizardTemplate.data("templateType") == "template") + if($selectedVmWizardTemplate.data("templateType") == "template") { $selectedVmWizardTemplate.data("hypervisor", $selectedVmWizardTemplate.find("#hypervisor_text").text()); - else - $selectedVmWizardTemplate.data("hypervisor", $selectedVmWizardTemplate.find("#hypervisor_select").val()); + } + else { + if($selectedVmWizardTemplate.find("#hypervisor_select").css("display") != "none") + $selectedVmWizardTemplate.data("hypervisor", $selectedVmWizardTemplate.find("#hypervisor_select").val()); + else //if($selectedVmWizardTemplate.find("#hypervisor_span").css("display") != "none") + $selectedVmWizardTemplate.data("hypervisor", $selectedVmWizardTemplate.find("#hypervisor_span").text()); + } $thisPopup.find("#wizard_review_hypervisor").text($selectedVmWizardTemplate.data("hypervisor")); $thisPopup.find("#wizard_review_template").text($selectedVmWizardTemplate.data("templateName"));