1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Bug #786: Recreate the selects elements for the select dropdown in the update template dialogs.

This commit is contained in:
Hector Sanjuan 2011-09-01 00:06:01 +02:00 committed by Ruben S. Montero
parent 8d9c333ca1
commit 4342caac1e
4 changed files with 30 additions and 8 deletions

View File

@ -218,7 +218,14 @@ var host_actions = {
"Host.update_dialog" : {
type: "custom",
call: function() {
popUpTemplateUpdateDialog("Host",hosts_select,getSelectedNodes(dataTable_hosts));
popUpTemplateUpdateDialog("Host",
makeSelectOptions(dataTable_hosts,
1,//id_col
2,//name_col
[],
[]
),
getSelectedNodes(dataTable_hosts));
}
},

View File

@ -222,7 +222,14 @@ var image_actions = {
"Image.update_dialog" : {
type: "custom",
call: function() {
popUpTemplateUpdateDialog("Image",images_select,getSelectedNodes(dataTable_images));
popUpTemplateUpdateDialog("Image",
makeSelectOptions(dataTable_images,
1,//id_col
4,//name_col
[],
[]
),
getSelectedNodes(dataTable_images));
}
},

View File

@ -638,7 +638,14 @@ var template_actions = {
"Template.update_dialog" : {
type: "custom",
call: function() {
popUpTemplateUpdateDialog("Template",templates_select,getSelectedNodes(dataTable_templates));
popUpTemplateUpdateDialog("Template",
makeSelectOptions(dataTable_templates,
1,//id_col
4,//name_col
[],
[]//bad status col
),
getSelectedNodes(dataTable_templates));
}
},
@ -834,7 +841,7 @@ function updateTemplateSelect(){
makeSelectOptions(dataTable_templates,
1,//id_col
4,//name_col
[7],//published_col
[7],//enabled_col
["no"]//bad status col
);

View File

@ -643,8 +643,8 @@ function setupTemplateUpdateDialog(){
$('#template_update_select',dialog).change(function(){
var id = $(this).val();
var dialog = $('#template_update_dialog');
if (id.length){
if (id && id.length){
var dialog = $('#template_update_dialog');
var resource = $('#template_update_button',dialog).val();
$('#template_update_textarea',dialog).val("Loading...");
Sunstone.runAction(resource+".fetch_template",id);
@ -678,8 +678,9 @@ function popUpTemplateUpdateDialog(elem_str,select_items,sel_elems){
//grep them
var new_select= sel_elems.length > 1? '<option value="">Please select</option>' : "";
$('option','<select>'+select_items+'</select>').each(function(){
if ($.inArray($(this).val(),sel_elems) >= 0){
new_select+='<option value="'+$(this).val()+'">'+$(this).text()+'</option>';
var val = $(this).val();
if ($.inArray(val,sel_elems) >= 0){
new_select+='<option value="'+val+'">'+$(this).text()+'</option>';
};
});
$('#template_update_select',dialog).html(new_select);