bug 7905: template page - add template dialog - populate hypervisor dropdown by listHypervisors API response instead of hardcoding.

This commit is contained in:
Jessica Wang 2011-01-13 17:10:31 -08:00
parent 7c2fffe67a
commit a9dd415995
2 changed files with 18 additions and 3 deletions

View File

@ -348,10 +348,12 @@
</li>
<li>
<label for="add_template_hypervisor">Hypervisor:</label>
<select class="select" name="add_template_hypervisor" id="add_template_hypervisor">
<select class="select" name="add_template_hypervisor" id="add_template_hypervisor">
<!--
<option value='XenServer'>Citrix XenServer</option>
<option value='VmWare'>VMware ESX</option>
<option value='KVM'>KVM</option>
-->
</select>
</li>
<li>

View File

@ -54,8 +54,21 @@ function templateGetSearchParams() {
function afterLoadTemplateJSP() {
var $detailsTab = $("#right_panel_content #tab_content_details");
//add button ***
$.ajax({
data: createURL("command=listHypervisors"),
dataType: "json",
success: function(json) {
var items = json.listhypervisorsresponse.hypervisor;
var $hypervisorDropdown = $("#dialog_add_template").find("#add_template_hypervisor");
if(items != null && items.length > 0) {
for(var i=0; i<items.length; i++) {
$hypervisorDropdown.append("<option value='"+fromdb(items[i].name)+"'>"+fromdb(items[i].name)+"</option>");
}
}
}
})
$("#dialog_add_template #add_template_hypervisor").bind("change", function(event) {
var formatSelect = $("#dialog_add_template #add_template_format").empty();
var selectedHypervisorType = $(this).val();