Updated Branches:
  refs/heads/master 03b27c02a -> 856703cc1

CLOUDSTACK-4758: UI > Instance Wizard > (1) pass cpuNumber, cpuSpeed, memory to 
API when custom area is shown (i.e. when selected compute offering is dynamic).
(2) pass rootDiskSize to API when custom area is shown (i.e. when selected item 
in step 2 is a template).


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/856703cc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/856703cc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/856703cc

Branch: refs/heads/master
Commit: 856703cc1cd29ea8bfef770a02a448c68a718c52
Parents: 03b27c0
Author: Jessica Wang <jessicaw...@apache.org>
Authored: Thu Oct 31 13:50:20 2013 -0700
Committer: Jessica Wang <jessicaw...@apache.org>
Committed: Thu Oct 31 13:56:42 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js           | 38 ++++++++++++++++++++++-------
 ui/scripts/ui-custom/instanceWizard.js |  1 +
 2 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/856703cc/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index d2cde2f..5f08218 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -18,6 +18,7 @@
 (function($, cloudStack) {
     var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, 
myTemplateObjs, featuredIsoObjs, community, networkObjs;
     var selectedZoneObj, selectedTemplateObj, selectedHypervisor, 
selectedDiskOfferingObj;
+    var selectedTemplateOrIso; //'select-template', 'select-iso'
     var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 
'select-network', 'select-security-group', 'select-advanced-sg'(advanced 
sg-enabled zone)
 
     cloudStack.instanceWizard = {
@@ -122,8 +123,8 @@
                 });
 
                 //***** get templates/ISOs (begin) *****
-                var selectedTemplate = args.currentData['select-template'];
-                if (selectedTemplate == 'select-template') {
+                selectedTemplateOrIso = args.currentData['select-template'];
+                if (selectedTemplateOrIso == 'select-template') {
                     var hypervisorArray = [];
                     $(hypervisorObjs).each(function(index, item) {
                         hypervisorArray.push(item.name);
@@ -174,7 +175,7 @@
                             }
                         }
                     });
-                } else if (selectedTemplate == 'select-iso') {
+                } else if (selectedTemplateOrIso == 'select-iso') {
                     $.ajax({
                         url: createURL("listIsos&isofilter=featured&zoneid=" + 
args.currentData.zoneid + "&bootable=true"),
                         dataType: "json",
@@ -216,13 +217,13 @@
 
 
                 var templatesObj = {};
-                if (selectedTemplate == 'select-template') {
+                if (selectedTemplateOrIso == 'select-template') {
                     templatesObj = {
                         featuredtemplates: featuredTemplateObjs,
                         communitytemplates: communityTemplateObjs,
                         mytemplates: myTemplateObjs
                     }
-                } else if (selectedTemplate == 'select-iso') {
+                } else if (selectedTemplateOrIso == 'select-iso') {
                     templatesObj = {
                         featuredisos: featuredIsoObjs,
                         communityisos: communityIsoObjs,
@@ -239,9 +240,9 @@
                         hypervisors: hypervisorObjs
                     },
                     customHidden: function(args) {                        
-                        if (selectedTemplate == 'select-template') {
+                        if (selectedTemplateOrIso == 'select-template') {
                             return false; //show Root Disk Size field
-                        } else { //selectedTemplate == 'select-iso'
+                        } else { //selectedTemplateOrIso == 'select-iso'
                                return true;  //hide Root Disk Size field
                         }                       
                     }
@@ -295,6 +296,7 @@
                         serviceOfferingObjs = 
json.listserviceofferingsresponse.serviceoffering;
                         args.response.success({
                             customFlag: 'iscustomized',
+                               //customFlag: 'offerha', //for testing only
                             data: {
                                 serviceOfferings: serviceOfferingObjs
                             }
@@ -587,10 +589,28 @@
             //step 2: select template
             array1.push("&templateId=" + args.data.templateid);
             array1.push("&hypervisor=" + selectedHypervisor);
-
+           
+            if 
(args.$wizard.find('input[name=rootDiskSize]').parent().css('display') != 
'none')  {
+               if (args.$wizard.find('input[name=rootDiskSize]').val().length 
> 0) {
+                   array1.push("&rootdisksize=" + 
args.$wizard.find('input[name=rootDiskSize]').val());     
+               }
+            }
+            
             //step 3: select service offering
             array1.push("&serviceOfferingId=" + args.data.serviceofferingid);
-
+            
+            if 
(args.$wizard.find('input[name=compute-cpu-cores]').parent().parent().css('display')
 != 'none') {
+                   if 
(args.$wizard.find('input[name=compute-cpu-cores]').val().length > 0)  {   
+                       array1.push("&cpunumber=" + 
args.$wizard.find('input[name=compute-cpu-cores]').val());
+                   }            
+                   if 
(args.$wizard.find('input[name=compute-cpu]').val().length > 0)  {          
+                       array1.push("&cpuspeed=" + 
args.$wizard.find('input[name=compute-cpu]').val());
+                   }            
+                   if 
(args.$wizard.find('input[name=compute-memory]').val().length > 0)  {        
+                       array1.push("&memory=" + 
args.$wizard.find('input[name=compute-memory]').val());
+                   }               
+            }
+            
             //step 4: select disk offering
             if (args.data.diskofferingid != null && args.data.diskofferingid 
!= "0") {
                 array1.push("&diskOfferingId=" + args.data.diskofferingid);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/856703cc/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js 
b/ui/scripts/ui-custom/instanceWizard.js
index 4368ec4..d5203c8 100644
--- a/ui/scripts/ui-custom/instanceWizard.js
+++ b/ui/scripts/ui-custom/instanceWizard.js
@@ -49,6 +49,7 @@
                         // Populate data
                         context: context,
                         data: data,
+                        $wizard: $wizard,
                         response: {
                             success: function(args) {
                                 var $listView = $('.list-view.instances');

Reply via email to