From ac0a67e2b485310aa5f9db21275517a7dfc45283 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Fri, 7 Apr 2017 11:07:47 +0200 Subject: [PATCH] F #4913 Added resource pool list in import cluster (#247) * 32 characters max in switch name * Added resource pool list in import cluster * Added VCENTER_RESOURCE_POOL in cluster template --- .../public/app/utils/vcenter/clusters.js | 39 ++++++++++++++----- .../public/app/utils/vcenter/clusters/row.hbs | 1 + 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/sunstone/public/app/utils/vcenter/clusters.js b/src/sunstone/public/app/utils/vcenter/clusters.js index 4757ae6bf6..f34038481a 100644 --- a/src/sunstone/public/app/utils/vcenter/clusters.js +++ b/src/sunstone/public/app/utils/vcenter/clusters.js @@ -93,6 +93,7 @@ define(function(require) { columns : [ '', Locale.tr("Name"), + Locale.tr("Resource Pool"), "" ] }); @@ -102,7 +103,14 @@ define(function(require) { $.each(elements, function(id, cluster) { var cluster_name = cluster.cluster_name; - var opts = { name: cluster_name }; + var rp_list = ''; + var opts = { name: cluster_name , rp: rp_list}; var trow = $(RowTemplate(opts)).appendTo(tbody); $(".check_item", trow).data("cluster", cluster); @@ -164,6 +172,8 @@ define(function(require) { VCenterCommon.importLoading({context : row_context}); + var rp = $('.select_rp option:selected', row_context).val(); + var host_json = { "host": { "name": $(this).data("cluster").cluster_name, @@ -173,7 +183,7 @@ define(function(require) { "cluster_id": cluster_id } }; - + var cluster_ref = $(this).data("cluster").cluster_ref; var vcenter_uuid = $(this).data("cluster").vcenter_uuid; var vcenter_version = $(this).data("cluster").vcenter_version; @@ -187,13 +197,24 @@ define(function(require) { message : Locale.tr("Host created successfully. ID: %1$s", response.HOST.ID) }); - var template_raw = - "VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" + - "VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" + - "VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n" + - "VCENTER_INSTANCE_ID=\"" + vcenter_uuid + "\"\n" + - "VCENTER_CCR_REF=\"" + cluster_ref + "\"\n" + - "VCENTER_VERSION=\"" + vcenter_version + "\"\n"; + if(rp != ""){ + var template_raw = + "VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" + + "VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" + + "VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n" + + "VCENTER_INSTANCE_ID=\"" + vcenter_uuid + "\"\n" + + "VCENTER_CCR_REF=\"" + cluster_ref + "\"\n" + + "VCENTER_VERSION=\"" + vcenter_version + "\"\n" + + "VCENTER_RESOURCE_POOL=\"" + rp + "\"\n"; + } else { + var template_raw = + "VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" + + "VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" + + "VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n" + + "VCENTER_INSTANCE_ID=\"" + vcenter_uuid + "\"\n" + + "VCENTER_CCR_REF=\"" + cluster_ref + "\"\n" + + "VCENTER_VERSION=\"" + vcenter_version + "\"\n"; + } Sunstone.runAction("Host.update_template", response.HOST.ID, template_raw); }, diff --git a/src/sunstone/public/app/utils/vcenter/clusters/row.hbs b/src/sunstone/public/app/utils/vcenter/clusters/row.hbs index 088d0928bb..d1bdfe78e8 100644 --- a/src/sunstone/public/app/utils/vcenter/clusters/row.hbs +++ b/src/sunstone/public/app/utils/vcenter/clusters/row.hbs @@ -19,6 +19,7 @@ {{name}} + {{{rp}}}