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) *****
|
||||||
//***** get templates/ISOs (begin) *****
|
var selectedTemplate = args.currentData['select-template'];
|
||||||
var hypervisorArray = [];
|
if (selectedTemplate == 'select-template') {
|
||||||
$(hypervisorObjs).each(function(index, item) {
|
var hypervisorArray = [];
|
||||||
hypervisorArray.push(item.name);
|
$(hypervisorObjs).each(function(index, item) {
|
||||||
});
|
hypervisorArray.push(item.name);
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid),
|
url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
|
featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
|
||||||
if($.inArray(item.hypervisor, hypervisorArray) > -1)
|
if($.inArray(item.hypervisor, hypervisorArray) > -1)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid),
|
url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
|
communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
|
||||||
if($.inArray(item.hypervisor, hypervisorArray) > -1)
|
if($.inArray(item.hypervisor, hypervisorArray) > -1)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid),
|
url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
|
myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
|
||||||
if($.inArray(item.hypervisor, hypervisorArray) > -1)
|
if($.inArray(item.hypervisor, hypervisorArray) > -1)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (selectedTemplate == 'select-iso') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"),
|
url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
featuredIsoObjs = json.listisosresponse.iso;
|
featuredIsoObjs = json.listisosresponse.iso;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listIsos&isofilter=community&zoneid=" + args.currentData.zoneid + "&bootable=true"),
|
url: createURL("listIsos&isofilter=community&zoneid=" + args.currentData.zoneid + "&bootable=true"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
communityIsoObjs = json.listisosresponse.iso;
|
communityIsoObjs = json.listisosresponse.iso;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listIsos&isofilter=selfexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"),
|
url: createURL("listIsos&isofilter=selfexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
myIsoObjs = json.listisosresponse.iso;
|
myIsoObjs = json.listisosresponse.iso;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//***** get templates/ISOs (end) *****
|
}
|
||||||
|
//***** 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