cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: CS-16573: cloudstack UI - create template from VM - encode data passed to API call.
Date Wed, 24 Oct 2012 21:53:21 GMT
Updated Branches:
  refs/heads/master afeced1e4 -> de1fd5d0a


CS-16573: cloudstack UI - create template from VM - 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/de1fd5d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/de1fd5d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/de1fd5d0

Branch: refs/heads/master
Commit: de1fd5d0a8e8b3d8269710f66971a4d0508c8657
Parents: afeced1
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Tue Oct 23 11:12:28 2012 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Wed Oct 24 14:52:53 2012 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js |   38 +++++++++++++-------------------------
 1 files changed, 13 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de1fd5d0/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index e58fc82..68e081e 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -753,31 +753,19 @@
                 url: { label: 'image.directory', validation: { required: true } }
               }
             },
-            action: function(args) {
-              /*
-               var isValid = true;
-               isValid &= validateString("Name", $thisDialog.find("#create_template_name"),
$thisDialog.find("#create_template_name_errormsg"));
-               isValid &= validateString("Display Text", $thisDialog.find("#create_template_desc"),
$thisDialog.find("#create_template_desc_errormsg"));
-               isValid &= validateString("Image Directory", $thisDialog.find("#image_directory"),
$thisDialog.find("#image_directory_errormsg"), false); //image directory is required when
creating template from VM whose hypervisor is BareMetal
-               if (!isValid)
-               return;
-               $thisDialog.dialog("close");
-               */
-
-              var array1 = [];
-              array1.push("&name=" + todb(args.data.name));
-              array1.push("&displayText=" + todb(args.data.displayText));
-              array1.push("&osTypeId=" + args.data.osTypeId);
-
-              //array1.push("&isPublic=" + args.data.isPublic);
-              array1.push("&isPublic=" + (args.data.isPublic=="on"));  //temporary, before
Brian fixes it.
-
-              array1.push("&url=" + todb(args.data.url));
-
+            action: function(args) {              
+              var data = {
+							  virtualmachineid: args.context.instances[0].id,
+							  name: args.data.name,
+								displayText: args.data.displayText,
+								osTypeId: args.data.osTypeId,
+								isPublic: (args.data.isPublic=="on"),
+								url: args.data.url
+							};
+												
               $.ajax({
-                url: createURL("createTemplate&virtualmachineid=" + args.context.instances[0].id
+ array1.join("")),
-                dataType: "json",
-                async: true,
+                url: createURL('createTemplate'),
+                data: data,                
                 success: function(json) {
                   var jid = json.createtemplateresponse.jobid;
                   args.response.success(
@@ -993,7 +981,7 @@
 										'Starting': 1,
 										'Stopping': 1
 									},
-									pollAgainFn: function(context) { //???	
+									pollAgainFn: function(context) { 
                     var toClearInterval = false; 								  
 										$.ajax({
 											url: createURL("listVirtualMachines&id=" + context.instances[0].id),


Mime
View raw message