Revision 0aa6e9a9

View differences:

src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/scheduling.js
27 27
  var TemplateUtils = require('utils/template-utils');
28 28
  var HostsTable = require('tabs/hosts-tab/datatable');
29 29
  var ClustersTable = require('tabs/clusters-tab/datatable');
30
  var DatastoresTable = require('tabs/datastores-tab/datatable');
30 31
  var UniqueId = require('utils/unique-id');
31 32

  
32 33
  /*
......
62 63
    }
63 64
    this.hostsTable = new HostsTable('HostsTable' + UniqueId.id(), options);
64 65
    this.clustersTable = new ClustersTable('ClustersTable' + UniqueId.id(), options);
66
    this.datastoresTable = new DatastoresTable('DatastoresTable' + UniqueId.id(), options);
65 67
  }
66 68

  
67 69
  WizardTab.prototype.constructor = WizardTab;
......
81 83
  function _html() {
82 84
    return TemplateHTML({
83 85
      'hostsTableSelectHTML': this.hostsTable.dataTableHTML,
84
      'clustersTableSelectHTML': this.clustersTable.dataTableHTML
86
      'clustersTableSelectHTML': this.clustersTable.dataTableHTML,
87
      'dsTableSelectHTML': this.datastoresTable.dataTableHTML
85 88
    });
86 89
  }
87 90

  
......
125 128
    that.hostsTable.refreshResourceTableSelect();
126 129
    that.clustersTable.initialize(selectOptions);
127 130
    that.clustersTable.refreshResourceTableSelect();
131
    that.datastoresTable.initialize(selectOptions);
132
    that.datastoresTable.refreshResourceTableSelect();
128 133
  }
129 134

  
130 135
  function _retrieve(context) {
......
132 137
  }
133 138

  
134 139
  function _fill(context, templateJSON) {
135
    WizardFields.fill(context, templateJSON);
136 140

  
137 141
    var reqJSON = templateJSON['SCHED_REQUIREMENTS'];
138 142
    if (reqJSON) {
......
163 167
        }
164 168

  
165 169
      this.clustersTable.selectResourceTableSelect(selectedResources);
166

  
167
      delete templateJSON['SCHED_REQUIREMENTS'];
168 170
    }
169 171

  
170 172
    var dsReqJSON = templateJSON['SCHED_DS_REQUIREMENTS'];
171 173
    if (dsReqJSON) {
172 174
      var dsReq = TemplateUtils.escapeDoubleQuotes(dsReqJSON);
173
      delete templateJSON['SCHED_DS_REQUIREMENTS'];
174
    }
175
      var ds_id_regexp = /(\s|\||\b)ID=\\"([0-9]+)\\"/g;
176
      var ds = [];
177
      while (match = ds_id_regexp.exec(dsReq)) {
178
        ds.push(match[2])
179
      }
180
      var selectedResources = {
181
        ids : ds
182
      }
175 183

  
184
      this.datastoresTable.selectResourceTableSelect(selectedResources);
185
    }
176 186

  
177 187
    var rankJSON = templateJSON["SCHED_RANK"];
178 188
    if (rankJSON) {
......
207 217

  
208 218
        delete templateJSON["SCHED_DS_RANK"];
209 219
    }
220

  
221
     WizardFields.fill(context, templateJSON);
210 222
  }
211 223

  
212 224
  function _generateRequirements(context) {
213 225
      var req_string=[];
226
      var req_ds_string=[];
214 227
      var selected_hosts = this.hostsTable.retrieveResourceTableSelect();
215 228
      var selected_clusters = this.clustersTable.retrieveResourceTableSelect();
229
      var selected_ds = this.datastoresTable.retrieveResourceTableSelect();
216 230

  
217 231
      $.each(selected_hosts, function(index, hostId) {
218 232
        req_string.push('ID="'+hostId+'"');
......
222 236
        req_string.push('CLUSTER_ID="'+clusterId+'"');
223 237
      });
224 238

  
239
      $.each(selected_ds, function(index, dsId) {
240
        req_ds_string.push('ID="'+dsId+'"');
241
      });
242

  
225 243
      $('#SCHED_REQUIREMENTS', context).val(req_string.join(" | "));
244
      $('#SCHED_DS_REQUIREMENTS', context).val(req_ds_string.join(" | "));
226 245
  };
227 246
});
src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/scheduling/html.hbs
53 53
        </fieldset>
54 54
        <fieldset>
55 55
          <legend>{{tr "Datastore Requirements"}}</legend>
56
          <div id="req_type" class="ds_select">{{{dsTableSelectHTML}}}</div>
56 57
          <div class="row">
57 58
            <div class="large-12 columns">
58 59
              <label for="SCHED_DS_REQUIREMENTS">

Also available in: Unified diff