Skip to content

Commit

Permalink
M #~: Fix images creation dialog (OpenNebula#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Betanzos authored and atodorov-storpool committed Jan 4, 2021
1 parent eea7a0d commit c7b4731
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,19 @@ define(function(require) {
});

// Custom Adapter Type
var custom_attrs = ["vcenter_adapter_type",
"vcenter_disk_type",
"img_dev_prefix",
"img_driver"];

for (var i in custom_attrs){
var field = custom_attrs[i];
var custom_attrs = [
"vcenter_adapter_type",
"vcenter_disk_type",
"img_dev_prefix",
"img_driver"
];

$(custom_attrs).each(function(_, field) {
$('input[name="custom_'+field+'"]',context).parent().hide();
$('select#'+field,context).change(function(){

$('select#'+field, context).on("change", function() {
var field = $(this).attr('name');

if ($(this).val() == "custom"){
$('input[name="custom_'+field+'"]',context).parent().show();
$('input[name="custom_'+field+'"]',context).attr('required', '');
Expand All @@ -227,7 +230,7 @@ define(function(require) {
$('input[name="custom_'+field+'"]',context).removeAttr('required');
}
});
}
});

$('#img_path,#img_size,#file-uploader', context).closest('.row').hide();

Expand Down

0 comments on commit c7b4731

Please sign in to comment.