diff --git a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js index 27c13e94c0..3789933341 100644 --- a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js @@ -107,6 +107,20 @@ define(function(require) { initValue: cluster_id_raw }); + var vcenter_cluster = $("div#vcenter_cluster_wrapper .resource_list_select", dialog).val(); + if (!vcenter_cluster) vcenter_cluster = undefined; + + ResourceSelect.insert({ + context: $('#vcenter_cluster_wrapper', dialog), + resourceName: 'Host', + initValue: vcenter_cluster, + emptyValue: true, + nameValues: true, + filterKey: 'VM_MAD', + filterValue: 'vcenter', + selectId: 'vcenter_cluster' + }); + return false; } @@ -360,7 +374,7 @@ define(function(require) { $('label[for="iscsi_host"],input#iscsi_host', dialog).parent().hide(); $('label[for="iscsi_user"],input#iscsi_user', dialog).parent().hide(); $('label[for="iscsi_usage"],input#iscsi_usage', dialog).parent().hide(); - $('label[for="vcenter_cluster"],input#vcenter_cluster', dialog).parent().hide(); + $('label[for="vcenter_cluster"],div#vcenter_cluster_wrapper', dialog).parent().hide(); $('label[for="limit_transfer_bw"],input#limit_transfer_bw', dialog).parent().hide(); $('label[for="no_decompress"],input#no_decompress', dialog).parent().hide(); @@ -486,7 +500,7 @@ define(function(require) { $('input#safe_dirs', dialog).attr('disabled', 'disabled'); $('input#limit_mb', dialog).attr('disabled', 'disabled'); $('input#restricted_dirs', dialog).attr('disabled', 'disabled'); - $('label[for="vcenter_cluster"],input#vcenter_cluster', dialog).parent().fadeIn(); + $('label[for="vcenter_cluster"],div#vcenter_cluster_wrapper', dialog).parent().fadeIn(); } function _selectCustom(dialog) { diff --git a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs index 9dc0c57e24..226696f6be 100644 --- a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs +++ b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs @@ -259,8 +259,8 @@ {{tr "The vCenter Cluster that has access to this datastore."}} +
- diff --git a/src/sunstone/public/app/utils/resource-select.js b/src/sunstone/public/app/utils/resource-select.js index ccd70f6bdf..32925d7055 100644 --- a/src/sunstone/public/app/utils/resource-select.js +++ b/src/sunstone/public/app/utils/resource-select.js @@ -17,6 +17,7 @@ define(function(require) { var Notifier = require('utils/notifier'); var Locale = require('utils/locale'); + var TemplateUtils = require('utils/template-utils'); require('opennebula/cluster'); require('opennebula/user'); require('opennebula/group'); @@ -35,6 +36,8 @@ define(function(require) { * @param {string} [opts.extraOptions] - Extra options to be included in the select as a HTML string * @param {string} [opts.filterKey] - Select the resources whose filterKey matches filterValue * @param {string} [opts.filterValue] - RegExp that will be evaluated to filter the resources + * @param {Boolean} [opts.nameValues] - Use the object NAME instead of the ID as the option values + * @param {string} [opts.selectId] - Optional ID for the html select element */ var _insert = function(opts) { var Resource = require('opennebula/' + opts.resourceName.toLowerCase()); @@ -43,7 +46,13 @@ define(function(require) { Resource.list({ timeout: true, success: function (request, elemList) { - var selectHTML = ''; + }else{ + selectHTML = '