incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [25/49] git commit: CS-16573: cloudstack UI - update ISO - encode data passed to API call.
Date Sat, 27 Oct 2012 10:02:26 GMT
CS-16573: cloudstack UI - update ISO - encode data passed to API call.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1400f84a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1400f84a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1400f84a

Branch: refs/heads/marvin-parallel
Commit: 1400f84a3360c2ebb617f37a0f927444ec687544
Parents: ef83621
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Wed Oct 24 16:12:22 2012 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Thu Oct 25 11:05:53 2012 -0700

----------------------------------------------------------------------
 ui/scripts/templates.js |   73 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 59 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1400f84a/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 35cabfa..f6c209a 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -1058,36 +1058,81 @@
               edit: {
                 label: 'label.edit',
                 action: function(args) {
-                  var array1 = [];
-                  array1.push("&name=" + todb(args.data.name));
-                  array1.push("&displaytext=" + todb(args.data.displaytext));
-                  array1.push("&ostypeid=" + args.data.ostypeid);
+                  //***** updateIso *****
+									var data = {
+									  id: args.context.isos[0].id,
+										zoneid: args.context.isos[0].zoneid,
+										name: args.data.name,
+										displaytext: args.data.displaytext,
+										ostypeid: args.data.ostypeid
+									};                 
                   $.ajax({
-                    url: createURL("updateIso&id=" + args.context.isos[0].id + "&zoneid="
+ args.context.isos[0].zoneid + array1.join("")),
-                    dataType: "json",
+                    url: createURL('updateIso'),
+                    data: data,
                     async: false,
                     success: function(json) {
                       //updateIso API returns an incomplete ISO object (isextractable and
isfeatured are missing)
                     }
                   });
 
-                  var array2 = [];
-                  array2.push("&ispublic=" + (args.data.ispublic=="on"));
-                  array2.push("&isfeatured=" + (args.data.isfeatured=="on"));
-                  array2.push("&isextractable=" + (args.data.isextractable=="on"));
+									
+									//***** updateIsoPermissions *****   
+                  var data = {
+									  id: args.context.isos[0].id,
+										zoneid: args.context.isos[0].zoneid,
+									};									
+									//if args.data.ispublic is undefined, do not pass ispublic to API call.
+									if(args.data.ispublic == "on") {
+									  $.extend(data, {
+										  ispublic: true
+										});					
+                  }										
+									else if(args.data.ispublic == "off") {
+									  $.extend(data, {
+										  ispublic: false
+										});
+									}																		
+									//if args.data.isfeatured is undefined, do not pass isfeatured to API call.
+									if(args.data.isfeatured == "on") {
+									  $.extend(data, {
+										  isfeatured: true
+										});
+									}
+									else if(args.data.isfeatured == "off") {
+									  $.extend(data, {
+										  isfeatured: false
+										});									}									
+									//if args.data.isextractable is undefined, do not pass isextractable to API call.
                 
+									if(args.data.isextractable == "on") {
+									  $.extend(data, {
+										  isextractable: true
+										});			
+									}
+									else if(args.data.isextractable == "off") {
+									  $.extend(data, {
+										  isextractable: false
+										});
+                  }									                 
                   $.ajax({
-                    url: createURL("updateIsoPermissions&id=" + args.context.isos[0].id
+ "&zoneid=" + args.context.isos[0].zoneid + array2.join("")),
-                    dataType: "json",
+                    url: createURL('updateIsoPermissions'),
+                    data: data,
                     async: false,
                     success: function(json) {
                       //updateIsoPermissions API doesn't return ISO object
                     }
                   });
 
+									
+									//***** listIsos *****
                   //So, we call listIsos API to get a complete ISO object
+									var data = {
+									  id: args.context.isos[0].id,
+										zoneid: args.context.isos[0].zoneid,
+										isofilter: 'self'
+									};									
                   $.ajax({
-                    url: createURL("listIsos&id=" + args.context.isos[0].id + "&zoneid="
+ args.context.isos[0].zoneid + "&isofilter=self"),
-                    dataType: "json",
+                    url: createURL('listIsos'),
+                    data: data,
                     async: false,
                     success: function(json){
                       var item = json.listisosresponse.iso;


Mime
View raw message