From 7081fd6fb3dbb97a455de830a3a7b484e4fb8afb Mon Sep 17 00:00:00 2001 From: juanmont Date: Mon, 26 Jun 2017 11:24:29 +0200 Subject: [PATCH] F #5202 Added dropdown to OpenNebula host field --- .../form-panels/create/wizard-tabs/hybrid.js | 22 ++++++++++++++++++- .../create/wizard-tabs/hybrid/ec2.hbs | 4 +++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js index e3926735b9..49ac2f75ec 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js @@ -26,6 +26,7 @@ define(function(require) { var WizardFields = require('utils/wizard-fields'); var UniqueId = require('utils/unique-id'); var CustomTagsTable = require('utils/custom-tags-table'); + var OpenNebula = require('opennebula'); /* TEMPLATES @@ -103,6 +104,21 @@ define(function(require) { }); $("#tf_btn_hybrid", context).trigger("click"); + + this.hosts_ec2 = []; + var that = this; + + OpenNebula.Host.list({ + timeout: true, + success: function(request, results){ + $.each(results, function(key, value){ + if(value.HOST.TEMPLATE.HYPERVISOR == "ec2"){ + that.hosts_ec2.push({"ID":value.HOST.ID, "NAME": value.HOST.NAME}); + } + }); + return true; + } + }); } function _retrieve(context) { @@ -156,7 +172,7 @@ define(function(require) { function _addProviderTab(provider_id, context) { var htmlId = 'provider' + provider_id + UniqueId.id(); - + var that = this; var oneInput = ""; if (this.oneEnabled){ @@ -216,6 +232,10 @@ define(function(require) { if (this.value == "ec2"){ $(".hybrid_inputs", providerSection).append(EC2HTML()); + $.each(that.hosts_ec2, function(key, value){ + $("#HOST", providerSection).append(""); + }); + $("#HOST", providerSection) } else if (this.value == "AZURE"){ $(".hybrid_inputs", providerSection).append(AzureHTML()); } else if (this.value == "opennebula"){ diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid/ec2.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid/ec2.hbs index 019f83a806..ea72795b99 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid/ec2.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid/ec2.hbs @@ -66,7 +66,9 @@