new UI - create template - add hypervisor dropdown, display different value in format dropdown based on selected item in hypervisor dropdown.

This commit is contained in:
Jessica Wang 2010-10-06 16:12:15 -07:00
parent 0cb11027e9
commit 5cba4a5167
3 changed files with 31 additions and 21 deletions

View File

@ -259,10 +259,10 @@ long milliseconds = new Date().getTime();
</li>
<li>
<label for="add_template_hypervisor">Hypervisor:</label>
<select class="select" name="add_template_hypervisor" id="add_template_hypervisor">
<option value='VmWare'>VMware ESX</option>
<select class="select" name="add_template_hypervisor" id="add_template_hypervisor">
<option value='XenServer'>Citrix XenServer</option>
<option value='KVM'>KVM</option>
<option value='VmWare'>VMware ESX</option>
</select>
</li>
<li>

View File

@ -282,28 +282,20 @@
<label for="add_template_os_type">OS Type:</label>
<select class="select" name="add_template_os_type" id="add_template_os_type">
</select>
</li>
</li>
<li>
<label for="add_template_hypervisor">Hypervisor:</label>
<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>
<label for="add_template_format">Format:</label>
<select class="select" name="add_template_format" id="add_template_format">
</select>
</li>
<!--
<li>
<label for="user_name">Require HVM?:</label>
<select class="select" name="add_template_hvm" id="add_template_hvm">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</li>
<li>
<label for="user_name">OS Arch:</label>
<select class="select" name="add_template_os" id="add_template_os">
<option value="64">64 Bit</option>
<option value="32">32 Bit</option>
</select>
</li>
!-->
<li>
<label>Password Enabled?:</label>
<select class="select" id="add_template_password">

View File

@ -5,11 +5,28 @@ function afterLoadTemplateJSP() {
var $detailsTab = $("#right_panel_content #tab_content_details");
//add button ***
/*
var formatSelect = $("#dialog_add_template #add_template_format").empty();
if (getHypervisorType() == "kvm")
formatSelect.append("<option value='QCOW2'>QCOW2</option>");
else if (getHypervisorType() == "xenserver")
formatSelect.append("<option value='VHD'>VHD</option>");
formatSelect.append("<option value='VHD'>VHD</option>");
*/
$("#dialog_add_template #add_template_hypervisor").bind("change", function(event) {
var formatSelect = $("#dialog_add_template #add_template_format").empty();
var selectedHypervisorType = $(this).val();
if(selectedHypervisorType == "XenServer")
formatSelect.append("<option value='VHD'>VHD</option>");
else if(selectedHypervisorType == "VmWare")
formatSelect.append("<option value='OVA'>OVA</option>");
else if(selectedHypervisorType == "KVM")
formatSelect.append("<option value='QCOW2'>QCOW2</option>");
return false;
});
$("#dialog_add_template #add_template_hypervisor").change();
if(isAdmin())
$("#dialog_add_template #add_template_featured_container, #dialog_edit_template #edit_template_featured_container").show();
@ -41,6 +58,7 @@ function afterLoadTemplateJSP() {
var password = thisDialog.find("#add_template_password").val();
var isPublic = thisDialog.find("#add_template_public").val();
var osType = thisDialog.find("#add_template_os_type").val();
var hypervisor = thisDialog.find("#add_template_hypervisor").val();
var moreCriteria = [];
if(thisDialog.find("#add_template_featured_container").css("display")!="none") {
@ -51,7 +69,7 @@ function afterLoadTemplateJSP() {
var $midmenuItem1 = beforeAddingMidMenuItem() ;
$.ajax({
data: createURL("command=registerTemplate&name="+todb(name)+"&displayText="+todb(desc)+"&url="+encodeURIComponent(url)+"&zoneid="+zoneId+"&ispublic="+isPublic+moreCriteria.join("")+"&format="+format+"&passwordEnabled="+password+"&osTypeId="+osType+"&response=json"),
data: createURL("command=registerTemplate&name="+todb(name)+"&displayText="+todb(desc)+"&url="+encodeURIComponent(url)+"&zoneid="+zoneId+"&ispublic="+isPublic+moreCriteria.join("")+"&format="+format+"&passwordEnabled="+password+"&osTypeId="+osType+"&hypervisor="+hypervisor+"&response=json"),
dataType: "json",
success: function(json) {
var items = json.registertemplateresponse.template;