Revision 7081fd6f

View differences:

src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js
26 26
  var WizardFields = require('utils/wizard-fields');
27 27
  var UniqueId = require('utils/unique-id');
28 28
  var CustomTagsTable = require('utils/custom-tags-table');
29
  var OpenNebula = require('opennebula');
29 30

  
30 31
  /*
31 32
    TEMPLATES
......
103 104
    });
104 105

  
105 106
    $("#tf_btn_hybrid", context).trigger("click");
107

  
108
    this.hosts_ec2 = [];
109
    var that = this;
110

  
111
    OpenNebula.Host.list({
112
      timeout: true,
113
      success: function(request, results){
114
        $.each(results, function(key, value){
115
          if(value.HOST.TEMPLATE.HYPERVISOR == "ec2"){
116
            that.hosts_ec2.push({"ID":value.HOST.ID, "NAME": value.HOST.NAME});
117
          }
118
        });
119
        return true;
120
      }
121
    });
106 122
  }
107 123

  
108 124
  function _retrieve(context) {
......
156 172

  
157 173
  function _addProviderTab(provider_id, context) {
158 174
    var htmlId  = 'provider' + provider_id + UniqueId.id();
159

  
175
    var that = this;
160 176
    var oneInput = "";
161 177

  
162 178
    if (this.oneEnabled){
......
216 232

  
217 233
      if (this.value == "ec2"){
218 234
        $(".hybrid_inputs", providerSection).append(EC2HTML());
235
        $.each(that.hosts_ec2, function(key, value){
236
          $("#HOST", providerSection).append("<option value="+value.ID+">"+value.NAME+"</option>");
237
        });
238
        $("#HOST", providerSection)
219 239
      } else if (this.value == "AZURE"){
220 240
        $(".hybrid_inputs", providerSection).append(AzureHTML());
221 241
      } else if (this.value == "opennebula"){
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid/ec2.hbs
66 66
    <label>
67 67
      {{tr "OpenNebula Host"}}
68 68
      {{{tip (tr "Defines which OpenNebula host will use this template")}}}
69
      <input wizard_field="HOST" type="text">
69
      <select wizard_field="HOST" id="HOST" name="HOST">
70
        <option value=""></option>
71
      </select>
70 72
    </label>
71 73
  </div>
72 74
  <div class="medium-6 columns">

Also available in: Unified diff