diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js
index 1376a8566d..431985711f 100644
--- a/src/sunstone/public/js/plugins/hosts-tab.js
+++ b/src/sunstone/public/js/plugins/hosts-tab.js
@@ -84,7 +84,11 @@ var create_host_tmpl =
\
\
\
+ \
\
+
\
\
@@ -94,18 +98,28 @@ var create_host_tmpl =
\
\
\
+
\
\
+
\
+ \
+ \
+
\
\
\
\
@@ -595,9 +609,35 @@ function setupCreateHostDialog(){
$('button',dialog).button();
+ $('input[name="custom_vmm_mad"],'+
+ 'input[name="custom_im_mad"],'+
+ 'input[name="custom_vnm_mad"]',dialog).parent().hide();
+
+ $('select#vmm_mad',dialog).change(function(){
+ if ($(this).val()=="custom")
+ $('input[name="custom_vmm_mad"]').parent().show();
+ else
+ $('input[name="custom_vmm_mad"]').parent().hide();
+ });
+
+ $('select#im_mad',dialog).change(function(){
+ if ($(this).val()=="custom")
+ $('input[name="custom_im_mad"]').parent().show();
+ else
+ $('input[name="custom_im_mad"]').parent().hide();
+ });
+
+ $('select#vnm_mad',dialog).change(function(){
+ if ($(this).val()=="custom")
+ $('input[name="custom_vnm_mad"]').parent().show();
+ else
+ $('input[name="custom_vnm_mad"]').parent().hide();
+ });
+
//Handle the form submission
$('#create_host_form',dialog).submit(function(){
- if (!($('#name',this).val().length)){
+ var name = $('#name',this).val();
+ if (!name){
notifyError(tr("Host name missing!"));
return false;
}
@@ -605,12 +645,19 @@ function setupCreateHostDialog(){
var cluster_id = $('#host_cluster_id',this).val();
if (!cluster_id) cluster_id = "-1";
+ var vmm_mad = $('select#vmm_mad',this).val();
+ vmm_mad = vmm_mad == "custom" ? $('input[name="custom_vmm_mad"]').val() : vmm_mad;
+ var im_mad = $('select#im_mad',this).val();
+ im_mad = im_mad == "custom" ? $('input[name="custom_im_mad"]').val() : im_mad;
+ var vnm_mad = $('select#vnm_mad',this).val();
+ vnm_mad = vnm_mad == "custom" ? $('input[name="custom_vnm_mad"]').val() : vnm_mad;
+
var host_json = {
"host": {
- "name": $('#name',this).val(),
- "vm_mad": $('#vmm_mad',this).val(),
- "vnm_mad": $('#vnm_mad',this).val(),
- "im_mad": $('#im_mad',this).val(),
+ "name": name,
+ "vm_mad": vmm_mad,
+ "vnm_mad": vnm_mad,
+ "im_mad": im_mad,
"cluster_id": cluster_id
}
};
diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js
index 1585513a31..d1f4aa34ab 100644
--- a/src/sunstone/public/js/plugins/users-tab.js
+++ b/src/sunstone/public/js/plugins/users-tab.js
@@ -60,7 +60,12 @@ var create_user_tmpl =
\
\
\
+
\
\
+
\
+ \
+
\
+
\
\
\