diff --git a/ui/scripts/cloud.core.instances.js b/ui/scripts/cloud.core.instances.js index b933d4a4641..1cdbd83e519 100644 --- a/ui/scripts/cloud.core.instances.js +++ b/ui/scripts/cloud.core.instances.js @@ -1411,21 +1411,25 @@ function showInstancesTab(p_domainId, p_account) { var zoneId = vmPopup.find("#wizard_zone").val(); if(zoneId == null || zoneId.length == 0) return; - + + var hypervisor = vmPopup.find("#wizard_hypervisor").val(); + if (hypervisor == null || hypervisor.length == 0) + return; + var container = vmPopup.find("#template_container"); var commandString; var searchInput = vmPopup.find("#search_input").val(); if (selectedTemplateTypeInVmPopup != "blank") { if (searchInput != null && searchInput.length > 0) - commandString = "command=listTemplates&templatefilter="+selectedTemplateTypeInVmPopup+"&zoneid="+zoneId+"&keyword="+searchInput+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; + commandString = "command=listTemplates&templatefilter="+selectedTemplateTypeInVmPopup+"&zoneid="+zoneId+"&hypervisor="+hypervisor+"&keyword="+searchInput+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; else - commandString = "command=listTemplates&templatefilter="+selectedTemplateTypeInVmPopup+"&zoneid="+zoneId+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; + commandString = "command=listTemplates&templatefilter="+selectedTemplateTypeInVmPopup+"&zoneid="+zoneId+"&hypervisor="+hypervisor+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; } else { if (searchInput != null && searchInput.length > 0) - commandString = "command=listIsos&isReady=true&bootable=true&zoneid="+zoneId+"&keyword="+searchInput+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; + commandString = "command=listIsos&isReady=true&bootable=true&zoneid="+zoneId+"&hypervisor="+hypervisor+"&keyword="+searchInput+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; else - commandString = "command=listIsos&isReady=true&bootable=true&zoneid="+zoneId+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; + commandString = "command=listIsos&isReady=true&bootable=true&zoneid="+zoneId+"&hypervisor="+hypervisor+"&page="+currentPageInTemplateGridInVmPopup+"&response=json"; } var loading = vmPopup.find("#wiz_template_loading").show(); @@ -1506,6 +1510,13 @@ function showInstancesTab(p_domainId, p_account) { if(selectedZone != null && selectedZone.length > 0) listTemplatesInVmPopup(); return false; + }); + + vmPopup.find("#wizard_hypervisor").bind("change", function(event) { + var selectedHypervisor = $(this).val(); + if(selectedHypervisor != null && selectedHypervisor.length > 0) + listTemplatesInVmPopup(); + return false; }); function displayDiskOffering(type) { @@ -1633,7 +1644,6 @@ function showInstancesTab(p_domainId, p_account) { // Create a new VM!!!! var moreCriteria = []; moreCriteria.push("&zoneId="+thisPopup.find("#wizard_zone").val()); - moreCriteria.push("&hypervisor="+thisPopup.find("#wizard_hypervisor").val()); var name = trim(thisPopup.find("#wizard_vm_name").val()); if (name != null && name.length > 0)