bug 8514: Instance page - volume tab - Create Template dialog - fix a bug that OS dropdown was empty when 2nd time visiting Instance page.

This commit is contained in:
Jessica Wang 2011-02-09 17:33:56 -08:00
parent 487aa4becc
commit c218b3f9d4

View File

@ -97,8 +97,7 @@ function afterLoadInstanceJSP() {
$doTemplateNo = $("#vm_popup_disk_offering_template_no");
$doTemplateCustom = $("#vm_popup_disk_offering_template_custom");
$doTemplateExisting = $("#vm_popup_disk_offering_template_existing");
$soTemplate = $("#vm_popup_service_offering_template");
vmPopulateDropdown();
$soTemplate = $("#vm_popup_service_offering_template");
init = true;
}
@ -126,12 +125,14 @@ function afterLoadInstanceJSP() {
async: false,
success: function(json) {
types = json.listostypesresponse.ostype;
var osTypeDropdownEdit = $("#right_panel_content").find("#tab_content_details").find("#ostypename_edit").empty();
var osTypeDropdown1 = $("#right_panel_content").find("#tab_content_details").find("#ostypename_edit").empty();
var osTypeDropdown2 = $("#dialog_create_template #create_template_os_type").empty();
if (types != null && types.length > 0) {
for (var i = 0; i < types.length; i++) {
osTypeMap[types[i].id] = fromdb(types[i].description);
var html = "<option value='" + types[i].id + "'>" + fromdb(types[i].description) + "</option>";
osTypeDropdownEdit.append(html);
var html = "<option value='" + types[i].id + "'>" + fromdb(types[i].description) + "</option>";
osTypeDropdown1.append(html);
osTypeDropdown2.append(html);
}
}
}
@ -325,22 +326,6 @@ function bindDestroyVMButton() {
return false;
});
}
function vmPopulateDropdown() {
$.ajax({
data: createURL("command=listOsTypes&response=json"),
dataType: "json",
success: function(json) {
types = json.listostypesresponse.ostype;
if (types != null && types.length > 0) {
var select = $("#dialog_create_template #create_template_os_type").empty();
for (var i = 0; i < types.length; i++) {
select.append("<option value='" + types[i].id + "'>" + types[i].description + "</option>");
}
}
}
});
}
var currentPageInTemplateGridInVmPopup =1;
var selectedTemplateTypeInVmPopup; //selectedTemplateTypeInVmPopup will be set to "featured" when new VM dialog box opens