|
18 | 18 | (function($, cloudStack) { |
19 | 19 | var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, community, networkObjs; |
20 | 20 | var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj; |
| 21 | + var selectedTemplateOrIso; //'select-template', 'select-iso' |
21 | 22 | var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone) |
22 | 23 |
|
23 | 24 | cloudStack.instanceWizard = { |
|
122 | 123 | }); |
123 | 124 |
|
124 | 125 | //***** 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') { |
127 | 128 | var hypervisorArray = []; |
128 | 129 | $(hypervisorObjs).each(function(index, item) { |
129 | 130 | hypervisorArray.push(item.name); |
|
174 | 175 | } |
175 | 176 | } |
176 | 177 | }); |
177 | | - } else if (selectedTemplate == 'select-iso') { |
| 178 | + } else if (selectedTemplateOrIso == 'select-iso') { |
178 | 179 | $.ajax({ |
179 | 180 | url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"), |
180 | 181 | dataType: "json", |
|
216 | 217 |
|
217 | 218 |
|
218 | 219 | var templatesObj = {}; |
219 | | - if (selectedTemplate == 'select-template') { |
| 220 | + if (selectedTemplateOrIso == 'select-template') { |
220 | 221 | templatesObj = { |
221 | 222 | featuredtemplates: featuredTemplateObjs, |
222 | 223 | communitytemplates: communityTemplateObjs, |
223 | 224 | mytemplates: myTemplateObjs |
224 | 225 | } |
225 | | - } else if (selectedTemplate == 'select-iso') { |
| 226 | + } else if (selectedTemplateOrIso == 'select-iso') { |
226 | 227 | templatesObj = { |
227 | 228 | featuredisos: featuredIsoObjs, |
228 | 229 | communityisos: communityIsoObjs, |
|
239 | 240 | hypervisors: hypervisorObjs |
240 | 241 | }, |
241 | 242 | customHidden: function(args) { |
242 | | - if (selectedTemplate == 'select-template') { |
| 243 | + if (selectedTemplateOrIso == 'select-template') { |
243 | 244 | return false; //show Root Disk Size field |
244 | | - } else { //selectedTemplate == 'select-iso' |
| 245 | + } else { //selectedTemplateOrIso == 'select-iso' |
245 | 246 | return true; //hide Root Disk Size field |
246 | 247 | } |
247 | 248 | } |
|
295 | 296 | serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering; |
296 | 297 | args.response.success({ |
297 | 298 | customFlag: 'iscustomized', |
| 299 | + //customFlag: 'offerha', //for testing only |
298 | 300 | data: { |
299 | 301 | serviceOfferings: serviceOfferingObjs |
300 | 302 | } |
|
587 | 589 | //step 2: select template |
588 | 590 | array1.push("&templateId=" + args.data.templateid); |
589 | 591 | 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 | + |
591 | 599 | //step 3: select service offering |
592 | 600 | 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 | + |
594 | 614 | //step 4: select disk offering |
595 | 615 | if (args.data.diskofferingid != null && args.data.diskofferingid != "0") { |
596 | 616 | array1.push("&diskOfferingId=" + args.data.diskofferingid); |
|
0 commit comments