Skip to content

Commit c218b3f

Browse files
author
Jessica Wang
committed
bug 8514: Instance page - volume tab - Create Template dialog - fix a bug that OS dropdown was empty when 2nd time visiting Instance page.
1 parent 487aa4b commit c218b3f

1 file changed

Lines changed: 6 additions & 21 deletions

File tree

‎ui/scripts/cloud.core.instance.js‎

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ function afterLoadInstanceJSP() {
9797
$doTemplateNo = $("#vm_popup_disk_offering_template_no");
9898
$doTemplateCustom = $("#vm_popup_disk_offering_template_custom");
9999
$doTemplateExisting = $("#vm_popup_disk_offering_template_existing");
100-
$soTemplate = $("#vm_popup_service_offering_template");
101-
vmPopulateDropdown();
100+
$soTemplate = $("#vm_popup_service_offering_template");
102101
init = true;
103102
}
104103

@@ -126,12 +125,14 @@ function afterLoadInstanceJSP() {
126125
async: false,
127126
success: function(json) {
128127
types = json.listostypesresponse.ostype;
129-
var osTypeDropdownEdit = $("#right_panel_content").find("#tab_content_details").find("#ostypename_edit").empty();
128+
var osTypeDropdown1 = $("#right_panel_content").find("#tab_content_details").find("#ostypename_edit").empty();
129+
var osTypeDropdown2 = $("#dialog_create_template #create_template_os_type").empty();
130130
if (types != null && types.length > 0) {
131131
for (var i = 0; i < types.length; i++) {
132132
osTypeMap[types[i].id] = fromdb(types[i].description);
133-
var html = "<option value='" + types[i].id + "'>" + fromdb(types[i].description) + "</option>";
134-
osTypeDropdownEdit.append(html);
133+
var html = "<option value='" + types[i].id + "'>" + fromdb(types[i].description) + "</option>";
134+
osTypeDropdown1.append(html);
135+
osTypeDropdown2.append(html);
135136
}
136137
}
137138
}
@@ -325,22 +326,6 @@ function bindDestroyVMButton() {
325326
return false;
326327
});
327328
}
328-
329-
function vmPopulateDropdown() {
330-
$.ajax({
331-
data: createURL("command=listOsTypes&response=json"),
332-
dataType: "json",
333-
success: function(json) {
334-
types = json.listostypesresponse.ostype;
335-
if (types != null && types.length > 0) {
336-
var select = $("#dialog_create_template #create_template_os_type").empty();
337-
for (var i = 0; i < types.length; i++) {
338-
select.append("<option value='" + types[i].id + "'>" + types[i].description + "</option>");
339-
}
340-
}
341-
}
342-
});
343-
}
344329

345330
var currentPageInTemplateGridInVmPopup =1;
346331
var selectedTemplateTypeInVmPopup; //selectedTemplateTypeInVmPopup will be set to "featured" when new VM dialog box opens

0 commit comments

Comments
 (0)