You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2015/01/07 00:16:46 UTC

git commit: updated refs/heads/ui-template-uploader to ed903e3

Repository: cloudstack
Updated Branches:
  refs/heads/ui-template-uploader ca824cb7f -> ed903e358


Properly pass file upload response to success()


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

Branch: refs/heads/ui-template-uploader
Commit: ed903e3589f6edc37fdca121a7375310a3f465ac
Parents: ca824cb
Author: Brian Federle <br...@citrix.com>
Authored: Tue Jan 6 15:16:25 2015 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Jan 6 15:16:25 2015 -0800

----------------------------------------------------------------------
 ui/scripts/templates.js | 8 ++++++--
 ui/scripts/ui/dialog.js | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed903e35/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index de9beaf..297eb61 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -110,6 +110,9 @@
                                 title: 'label.action.register.template',
                                 docID: 'helpNetworkOfferingName',
                                 preFilter: cloudStack.preFilter.createTemplate,
+
+                                // Handles POST to upload server
+                                // -- standard action handler won't be called until success() callback
                                 fileUpload: {
                                     action: function(args) {
                                         var fileData = args.fileData;
@@ -121,9 +124,10 @@
                                             cache: false,
                                             dataType: 'json',
                                             processData: false, // Don't process the files
-                                            contentType: false, // Set content type to false as jQuery will tell the server its a query string request
+                                            contentType: false, // jQuery will tell the server this is a query string request
                                             success: function(uploadData, textStatus, jqXHR) {
-                                                args.response.succes();
+                                                // Files uploaded successfully; proceed to handle rest of action
+                                                args.response.succes({ data: uploadData });
                                             },
                                             error: function(error) {
                                                 args.response.error('Error uploading files');

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed903e35/ui/scripts/ui/dialog.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js
index b23fb56..98a9dfa 100644
--- a/ui/scripts/ui/dialog.js
+++ b/ui/scripts/ui/dialog.js
@@ -693,12 +693,12 @@
                         context: args.context,
                         uploadData: formData,
                         response: {
-                            success: function() {
+                            success: function(successArgs) {
                                 $form.find('.loading-overlay').remove();
                                 $form.data('files', null);
 
                                 args.after({
-                                    data: $.extend(data, { uploadData: uploadData }),
+                                    data: $.extend(data, { uploadData: successArgs.data }),
                                     ref: args.ref, // For backwards compatibility; use context
                                     context: args.context,
                                     $form: $form