You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2012/06/21 04:09:47 UTC
git commit: Make templates or Isos calls when setup new instance on
templates tab.
Updated Branches:
refs/heads/master 6e48383ef -> e48ebf07a
Make templates or Isos calls when setup new instance on templates tab.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e48ebf07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e48ebf07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e48ebf07
Branch: refs/heads/master
Commit: e48ebf07a80b825f4cef766ee1853adebbfe51a6
Parents: 6e48383
Author: olgasmola <ol...@gmail.com>
Authored: Thu Jun 14 16:24:47 2012 +0300
Committer: Jessica Wang <je...@citrix.com>
Committed: Wed Jun 20 18:13:18 2012 -0700
----------------------------------------------------------------------
ui/scripts/instances.js | 158 ++++++++++++++++++++++--------------------
1 files changed, 83 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e48ebf07/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index edb732e..b892fd7 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -105,89 +105,97 @@
}
});
-
- //***** get templates/ISOs (begin) *****
- var hypervisorArray = [];
- $(hypervisorObjs).each(function(index, item) {
- hypervisorArray.push(item.name);
- });
+ //***** 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);
+ });
- $.ajax({
- url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid),
- dataType: "json",
- async: false,
- success: function(json) {
- featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
- if($.inArray(item.hypervisor, hypervisorArray) > -1)
- return true;
- });
- }
- });
- $.ajax({
- url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid),
- dataType: "json",
- async: false,
- success: function(json) {
- communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
- if($.inArray(item.hypervisor, hypervisorArray) > -1)
- return true;
- });
- }
- });
- $.ajax({
- url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid),
- dataType: "json",
- async: false,
- success: function(json) {
- myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
- if($.inArray(item.hypervisor, hypervisorArray) > -1)
- return true;
- });
- }
- });
-
- $.ajax({
- 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=community&zoneid=" + args.currentData.zoneid + "&bootable=true"),
- dataType: "json",
- async: false,
- success: function(json) {
- communityIsoObjs = json.listisosresponse.iso;
- }
- });
- $.ajax({
- url: createURL("listIsos&isofilter=selfexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"),
- dataType: "json",
- async: false,
- success: function(json) {
- myIsoObjs = json.listisosresponse.iso;
- }
- });
- //***** get templates/ISOs (end) *****
+ $.ajax({
+ url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid),
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
+ if($.inArray(item.hypervisor, hypervisorArray) > -1)
+ return true;
+ });
+ }
+ });
+ $.ajax({
+ url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid),
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
+ if($.inArray(item.hypervisor, hypervisorArray) > -1)
+ return true;
+ });
+ }
+ });
+ $.ajax({
+ url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid),
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
+ if($.inArray(item.hypervisor, hypervisorArray) > -1)
+ return true;
+ });
+ }
+ });
+ } else if (selectedTemplate == 'select-iso') {
+ $.ajax({
+ 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=community&zoneid=" + args.currentData.zoneid + "&bootable=true"),
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ communityIsoObjs = json.listisosresponse.iso;
+ }
+ });
+ $.ajax({
+ url: createURL("listIsos&isofilter=selfexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"),
+ dataType: "json",
+ async: false,
+ 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: {
idField: 'name',
nameField: 'name'
},
data: {
- templates: {
- featuredtemplates: featuredTemplateObjs,
- communitytemplates: communityTemplateObjs,
- mytemplates: myTemplateObjs,
-
- featuredisos: featuredIsoObjs,
- communityisos: communityIsoObjs,
- myisos: myIsoObjs
- },
+ templates: templatesObj,
hypervisors: hypervisorObjs
}
});