Make templates or Isos calls when setup new instance on templates tab.

This commit is contained in:
olgasmola 2012-06-14 16:24:47 +03:00 committed by Jessica Wang
parent 6e48383ef8
commit e48ebf07a8

View File

@ -105,8 +105,9 @@
} }
}); });
//***** get templates/ISOs (begin) ***** //***** get templates/ISOs (begin) *****
var selectedTemplate = args.currentData['select-template'];
if (selectedTemplate == 'select-template') {
var hypervisorArray = []; var hypervisorArray = [];
$(hypervisorObjs).each(function(index, item) { $(hypervisorObjs).each(function(index, item) {
hypervisorArray.push(item.name); hypervisorArray.push(item.name);
@ -145,7 +146,7 @@
}); });
} }
}); });
} 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",
@ -170,24 +171,31 @@
myIsoObjs = json.listisosresponse.iso; myIsoObjs = json.listisosresponse.iso;
} }
}); });
}
//***** get templates/ISOs (end) ***** //***** get templates/ISOs (end) *****
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({ 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
} }
}); });