Browse Source

Change the field type of flavor

Change the field type of flavor from input to select box.
User can select flavor without specifying manually.

Change-Id: I6dfb2a567d39cf621c545ce43272a3b691029817
Hiroyuki Eguchi 2 years ago
parent
commit
312a5742ea

+ 10
- 8
meteos_ui/static/dashboard/machine_learning/templates/create/spec/spec.html View File

@@ -34,10 +34,11 @@
34 34
           <translate>Master Flavor</translate>
35 35
           <span class="hz-icon-required fa fa-asterisk"></span>
36 36
         </label>
37
-        <input name="template-master-flavor-id" type="text" class="form-control" id="template-master-flavor-id"
38
-               ng-model="model.newTemplateSpec.master_flavor_id"
39
-               ng-required="true"
40
-               placeholder="{$ 'Flavor ID of Master Node.'|translate $}">
37
+        <select class="form-control"
38
+                ng-model="model.newTemplateSpec.master_flavor_id"
39
+                ng-required="true"
40
+                ng-options="flavor.id as flavor.id + ':' + flavor.name for flavor in ctrl.flavors">
41
+        </select>
41 42
       </div>
42 43
     </div>
43 44
     <div class="col-xs-12">
@@ -58,10 +59,11 @@
58 59
           <translate>Worker Flavor</translate>
59 60
           <span class="hz-icon-required fa fa-asterisk"></span>
60 61
         </label>
61
-        <input name="template-worker-flavor-id" type="text" class="form-control" id="template-worker-flavor-id"
62
-               ng-model="model.newTemplateSpec.worker_flavor_id"
63
-               ng-required="true"
64
-               placeholder="{$ 'Flavor ID of Worker Node.'|translate $}">
62
+        <select class="form-control"
63
+                ng-model="model.newTemplateSpec.worker_flavor_id"
64
+                ng-required="true"
65
+                ng-options="flavor.id as flavor.id + ':' + flavor.name for flavor in ctrl.flavors">
66
+        </select>
65 67
       </div>
66 68
     </div>
67 69
     <div class="col-xs-12">

+ 9
- 2
meteos_ui/static/dashboard/machine_learning/templates/create/spec/template.spec.controller.js View File

@@ -29,12 +29,14 @@
29 29
   createTemplateSpecController.$inject = [
30 30
     '$scope',
31 31
     'horizon.framework.util.i18n.gettext',
32
-    'horizon.app.core.openstack-service-api.neutron'
32
+    'horizon.app.core.openstack-service-api.neutron',
33
+    'horizon.app.core.openstack-service-api.nova'
33 34
   ];
34 35
 
35
-  function createTemplateSpecController($scope, gettext, neutron) {
36
+  function createTemplateSpecController($scope, gettext, neutron, nova) {
36 37
     var ctrl = this;
37 38
     ctrl.networks = [];
39
+    ctrl.flavors = [];
38 40
 
39 41
     ctrl.templateVersionOptions = [
40 42
       { label: gettext('1.6.0'), value: '1.6.0' }
@@ -44,11 +46,16 @@
44 46
 
45 47
     function init() {
46 48
       neutron.getNetworks().success(onGetNetworks);
49
+      nova.getFlavors().success(onGetFlavors);
47 50
     }
48 51
 
49 52
     function onGetNetworks(response) {
50 53
       ctrl.networks = response.items;
51 54
     }
52 55
 
56
+    function onGetFlavors(response) {
57
+      ctrl.flavors = response.items;
58
+    }
59
+
53 60
   }
54 61
 })();

Loading…
Cancel
Save