diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 2ab648a27c..23f243d82b 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -171,7 +171,12 @@ var create_datastore_tmpl = \ \ \ + \ \ +
\ + \ + \ +
\ \
\
\ @@ -190,7 +195,12 @@ var create_datastore_tmpl = \ \ \ + \ \ +
\ + \ + \ +
\ \
\
\ @@ -790,6 +800,9 @@ function hide_all(context) $('select#disk_type').children('option').each(function() { $(this).removeAttr('disabled'); }); + + $('input[name="ds_tab_custom_ds_mad"]').parent().hide(); + $('input[name="ds_tab_custom_tm_mad"]').parent().hide(); } // Set up the create datastore dialog @@ -805,6 +818,24 @@ function setupCreateDatastoreDialog(){ setupTips(dialog); + // Show custom driver input only when custom is selected in selects + $('input[name="ds_tab_custom_ds_mad"],'+ + 'input[name="ds_tab_custom_tm_mad"]',dialog).parent().hide(); + + $('select#ds_mad',dialog).change(function(){ + if ($(this).val()=="custom") + $('input[name="ds_tab_custom_ds_mad"]').parent().show(); + else + $('input[name="ds_tab_custom_ds_mad"]').parent().hide(); + }); + + $('select#tm_mad',dialog).change(function(){ + if ($(this).val()=="custom") + $('input[name="ds_tab_custom_tm_mad"]').parent().show(); + else + $('input[name="ds_tab_custom_tm_mad"]').parent().hide(); + }); + $('#presets').change(function(){ hide_all($(this).parent()); var choice_str = $(this).val(); @@ -841,7 +872,9 @@ function setupCreateDatastoreDialog(){ var cluster_id = $('#cluster_id',context).val(); var ds_type = $('input[name=ds_type]:checked',context).val(); var ds_mad = $('#ds_mad',context).val(); + ds_mad = ds_mad == "custom" ? $('input[name="ds_tab_custom_ds_mad"]').val() : ds_mad; var tm_mad = $('#tm_mad',context).val(); + tm_mad = tm_mad == "custom" ? $('input[name="ds_tab_custom_tm_mad"]').val() : tm_mad; var type = $('#disk_type',context).val(); var safe_dirs = $('#safe_dirs',context).val(); var restricted_dirs = $('#restricted_dirs',context).val();