Skip to content

Commit 856703c

Browse files
author
Jessica Wang
committed
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).
1 parent 03b27c0 commit 856703c

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

‎ui/scripts/instanceWizard.js‎

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
(function($, cloudStack) {
1919
var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, community, networkObjs;
2020
var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj;
21+
var selectedTemplateOrIso; //'select-template', 'select-iso'
2122
var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone)
2223

2324
cloudStack.instanceWizard = {
@@ -122,8 +123,8 @@
122123
});
123124

124125
//***** get templates/ISOs (begin) *****
125-
var selectedTemplate = args.currentData['select-template'];
126-
if (selectedTemplate == 'select-template') {
126+
selectedTemplateOrIso = args.currentData['select-template'];
127+
if (selectedTemplateOrIso == 'select-template') {
127128
var hypervisorArray = [];
128129
$(hypervisorObjs).each(function(index, item) {
129130
hypervisorArray.push(item.name);
@@ -174,7 +175,7 @@
174175
}
175176
}
176177
});
177-
} else if (selectedTemplate == 'select-iso') {
178+
} else if (selectedTemplateOrIso == 'select-iso') {
178179
$.ajax({
179180
url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"),
180181
dataType: "json",
@@ -216,13 +217,13 @@
216217

217218

218219
var templatesObj = {};
219-
if (selectedTemplate == 'select-template') {
220+
if (selectedTemplateOrIso == 'select-template') {
220221
templatesObj = {
221222
featuredtemplates: featuredTemplateObjs,
222223
communitytemplates: communityTemplateObjs,
223224
mytemplates: myTemplateObjs
224225
}
225-
} else if (selectedTemplate == 'select-iso') {
226+
} else if (selectedTemplateOrIso == 'select-iso') {
226227
templatesObj = {
227228
featuredisos: featuredIsoObjs,
228229
communityisos: communityIsoObjs,
@@ -239,9 +240,9 @@
239240
hypervisors: hypervisorObjs
240241
},
241242
customHidden: function(args) {
242-
if (selectedTemplate == 'select-template') {
243+
if (selectedTemplateOrIso == 'select-template') {
243244
return false; //show Root Disk Size field
244-
} else { //selectedTemplate == 'select-iso'
245+
} else { //selectedTemplateOrIso == 'select-iso'
245246
return true; //hide Root Disk Size field
246247
}
247248
}
@@ -295,6 +296,7 @@
295296
serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering;
296297
args.response.success({
297298
customFlag: 'iscustomized',
299+
//customFlag: 'offerha', //for testing only
298300
data: {
299301
serviceOfferings: serviceOfferingObjs
300302
}
@@ -587,10 +589,28 @@
587589
//step 2: select template
588590
array1.push("&templateId=" + args.data.templateid);
589591
array1.push("&hypervisor=" + selectedHypervisor);
590-
592+
593+
if (args.$wizard.find('input[name=rootDiskSize]').parent().css('display') != 'none') {
594+
if (args.$wizard.find('input[name=rootDiskSize]').val().length > 0) {
595+
array1.push("&rootdisksize=" + args.$wizard.find('input[name=rootDiskSize]').val());
596+
}
597+
}
598+
591599
//step 3: select service offering
592600
array1.push("&serviceOfferingId=" + args.data.serviceofferingid);
593-
601+
602+
if (args.$wizard.find('input[name=compute-cpu-cores]').parent().parent().css('display') != 'none') {
603+
if (args.$wizard.find('input[name=compute-cpu-cores]').val().length > 0) {
604+
array1.push("&cpunumber=" + args.$wizard.find('input[name=compute-cpu-cores]').val());
605+
}
606+
if (args.$wizard.find('input[name=compute-cpu]').val().length > 0) {
607+
array1.push("&cpuspeed=" + args.$wizard.find('input[name=compute-cpu]').val());
608+
}
609+
if (args.$wizard.find('input[name=compute-memory]').val().length > 0) {
610+
array1.push("&memory=" + args.$wizard.find('input[name=compute-memory]').val());
611+
}
612+
}
613+
594614
//step 4: select disk offering
595615
if (args.data.diskofferingid != null && args.data.diskofferingid != "0") {
596616
array1.push("&diskOfferingId=" + args.data.diskofferingid);

‎ui/scripts/ui-custom/instanceWizard.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
// Populate data
5050
context: context,
5151
data: data,
52+
$wizard: $wizard,
5253
response: {
5354
success: function(args) {
5455
var $listView = $('.list-view.instances');

0 commit comments

Comments
 (0)