mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Make templates or Isos calls when setup new instance on templates tab.
This commit is contained in:
		
							parent
							
								
									6e48383ef8
								
							
						
					
					
						commit
						e48ebf07a8
					
				| @ -105,89 +105,97 @@ | |||||||
|                     } |                     } | ||||||
|                   }); |                   }); | ||||||
| 
 | 
 | ||||||
|  | 				  //***** get templates/ISOs (begin) *****
 | ||||||
|  | 				  var selectedTemplate = args.currentData['select-template']; | ||||||
|  | 				  if (selectedTemplate == 'select-template') { | ||||||
|  | 					  var hypervisorArray = []; | ||||||
|  | 					  $(hypervisorObjs).each(function(index, item) {									  | ||||||
|  | 							hypervisorArray.push(item.name); | ||||||
|  | 					  }); | ||||||
| 																		 | 																		 | ||||||
| 									//***** get templates/ISOs (begin) *****
 | 					  $.ajax({ | ||||||
| 									var hypervisorArray = []; | 						url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid), | ||||||
| 									$(hypervisorObjs).each(function(index, item) {									  | 						dataType: "json", | ||||||
| 										hypervisorArray.push(item.name); | 						async: false, | ||||||
| 									}); | 						success: function(json) {										   | ||||||
| 																		 | 											  featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {											   | ||||||
|                   $.ajax({ | 												  if($.inArray(item.hypervisor, hypervisorArray) > -1) | ||||||
|                     url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid), | 													return true; | ||||||
|                     dataType: "json", | 												});	 | ||||||
|                     async: false, | 						} | ||||||
|                     success: function(json) {										   | 					  }); | ||||||
| 										  featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {											   | 					  $.ajax({ | ||||||
| 											  if($.inArray(item.hypervisor, hypervisorArray) > -1) | 						url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid), | ||||||
| 											    return true; | 						dataType: "json", | ||||||
| 											});	 | 						async: false, | ||||||
|                     } | 						success: function(json) { | ||||||
|                   }); | 						  communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {											   | ||||||
|                   $.ajax({ | 												  if($.inArray(item.hypervisor, hypervisorArray) > -1) | ||||||
|                     url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid), | 													return true; | ||||||
|                     dataType: "json", | 												});	 | ||||||
|                     async: false, | 						} | ||||||
|                     success: function(json) { | 					  }); | ||||||
|                       communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {											   | 					  $.ajax({ | ||||||
| 											  if($.inArray(item.hypervisor, hypervisorArray) > -1) | 						url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid), | ||||||
| 											    return true; | 						dataType: "json", | ||||||
| 											});	 | 						async: false, | ||||||
|                     } | 						success: function(json) { | ||||||
|                   }); | 						  myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {											   | ||||||
|                   $.ajax({ | 												  if($.inArray(item.hypervisor, hypervisorArray) > -1) | ||||||
|                     url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid), | 													return true; | ||||||
|                     dataType: "json", | 												});	 | ||||||
|                     async: false, | 						} | ||||||
|                     success: function(json) { | 					  }); | ||||||
|                       myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {											   | 				  } else if (selectedTemplate == 'select-iso') { | ||||||
| 											  if($.inArray(item.hypervisor, hypervisorArray) > -1) | 					$.ajax({ | ||||||
| 											    return true; | 						url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"), | ||||||
| 											});	 | 						dataType: "json", | ||||||
|                     } | 						async: false, | ||||||
|                   }); | 						success: function(json) { | ||||||
| 									 | 						  featuredIsoObjs = json.listisosresponse.iso; | ||||||
| 									$.ajax({ | 						} | ||||||
|                     url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"), | 					}); | ||||||
|                     dataType: "json", | 					$.ajax({ | ||||||
|                     async: false, | 						url: createURL("listIsos&isofilter=community&zoneid=" + args.currentData.zoneid + "&bootable=true"), | ||||||
|                     success: function(json) { | 						dataType: "json", | ||||||
|                       featuredIsoObjs = json.listisosresponse.iso; | 						async: false, | ||||||
|                     } | 						success: function(json) { | ||||||
|                   }); | 						  communityIsoObjs = json.listisosresponse.iso; | ||||||
|                   $.ajax({ | 						} | ||||||
|                     url: createURL("listIsos&isofilter=community&zoneid=" + args.currentData.zoneid + "&bootable=true"), | 					}); | ||||||
|                     dataType: "json", | 					$.ajax({ | ||||||
|                     async: false, | 						url: createURL("listIsos&isofilter=selfexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"), | ||||||
|                     success: function(json) { | 						dataType: "json", | ||||||
|                       communityIsoObjs = json.listisosresponse.iso; | 						async: false, | ||||||
|                     } | 						success: function(json) { | ||||||
|                   }); | 						  myIsoObjs = json.listisosresponse.iso; | ||||||
|                   $.ajax({ | 						} | ||||||
|                     url: createURL("listIsos&isofilter=selfexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"), | 					}); | ||||||
|                     dataType: "json", | 				  } | ||||||
|                     async: false, | 				  //***** get templates/ISOs (end) *****
 | ||||||
|                     success: function(json) { |  | ||||||
|                       myIsoObjs = json.listisosresponse.iso; |  | ||||||
|                     } |  | ||||||
|                   });		 |  | ||||||
| 									//***** get templates/ISOs (end) *****
 |  | ||||||
| 
 | 
 | ||||||
| 									 | 									 | ||||||
|                   args.response.success({ | 				  var templatesObj = {}; | ||||||
|  | 				  if (selectedTemplate == 'select-template') { | ||||||
|  | 					templatesObj = { | ||||||
|  | 						featuredtemplates: featuredTemplateObjs, | ||||||
|  | 						communitytemplates: communityTemplateObjs, | ||||||
|  | 						mytemplates: myTemplateObjs | ||||||
|  | 					} | ||||||
|  | 				  } else if (selectedTemplate == 'select-iso') { | ||||||
|  | 					templatesObj = { | ||||||
|  | 						featuredisos: featuredIsoObjs, | ||||||
|  |                         communityisos: communityIsoObjs, | ||||||
|  |                         myisos: myIsoObjs | ||||||
|  | 					} | ||||||
|  | 				  } | ||||||
|  | 				  args.response.success({ | ||||||
|                     hypervisor: { |                     hypervisor: { | ||||||
|                       idField: 'name', |                       idField: 'name', | ||||||
|                       nameField: 'name' |                       nameField: 'name' | ||||||
|                     }, |                     }, | ||||||
|                     data: { |                     data: { | ||||||
|                       templates: { |                       templates: templatesObj, | ||||||
|                         featuredtemplates: featuredTemplateObjs, |  | ||||||
|                         communitytemplates: communityTemplateObjs, |  | ||||||
|                         mytemplates: myTemplateObjs, |  | ||||||
|                          |  | ||||||
| 												featuredisos: featuredIsoObjs, |  | ||||||
|                         communityisos: communityIsoObjs, |  | ||||||
|                         myisos: myIsoObjs 										 |  | ||||||
|                       }, |  | ||||||
|                       hypervisors: hypervisorObjs |                       hypervisors: hypervisorObjs | ||||||
|                     } |                     } | ||||||
|                   }); |                   }); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user