|
636 | 636 | data: data, |
637 | 637 | async: false, |
638 | 638 | success: function(json) { |
639 | | - /* |
640 | | - { |
641 | | - "postuploadtemplateresponse": { |
642 | | - "getuploadparams": { |
643 | | - "id": "d5bdaf23-dcb9-4eef-9b94-81870490f457", |
644 | | - "postURL": "https://10.223.67.4/upload/d5bdaf23-dcb9-4eef-9b94-81870490f457", |
645 | | - "metadata": "7jCvmzKuMBStM/qEjx9HjSAISd+f3VAUqC9CkYmq92O+SznYov415LUndZ4KuLAtGNY37VeePs8X+0oyaVSj+cjD+KKoBJuynjBJViAQQYKT/amcOdrkloBA4DgNEAn16p32Z2qI4+Ky1ecDAtg1vkYNoz9ReaKbehM3n5MIFPonhnYBEmbVSZkCIbVbJeh+vmYs9Y3SHtcG+0gWiU06YQ4KGl7Wc03wp3wusAlj7+L+fEBha54Rx+C7aS6UPZgm8/+atUUric6xiGMsx603NUElcLWE+gQ7PTimsIr6ySvcmc3D0n6JK6A7bc72sfPrHEbnNPD+5+qXJsBcXPLtEAG2WwduarwZ", |
646 | | - "timeout": "2015-01-20T01:01:02.548Z", |
647 | | - "signature": "NLXv5YsNuUn7NKC+ZP5JtSM26MY=" |
648 | | - } |
649 | | - } |
650 | | - } |
651 | | - */ |
652 | | - |
653 | | - var uploadparams = json.postuploadtemplateresponse.getuploadparams; //son.postuploadtemplateresponse.getuploadparams is an object, not an array of object. |
| 639 | + var uploadparams = json.postuploadtemplateresponse.getuploadparams; |
654 | 640 | var templateId = uploadparams.id; |
655 | 641 |
|
656 | 642 | args.response.success({ |
657 | 643 | url: uploadparams.postURL, |
| 644 | + ajaxPost: true, |
658 | 645 | data: { |
659 | | - signature: uploadparams.signature, |
660 | | - expires: uploadparams.timeout, |
661 | | - metadata: uploadparams.metadata |
| 646 | + 'X-signature': uploadparams.signature, |
| 647 | + 'X-expires': uploadparams.expires, |
| 648 | + 'X-metadata': uploadparams.metadata |
662 | 649 | } |
663 | 650 | }); |
664 | | - |
665 | | - cloudStack.dialog.notice({ |
666 | | - message: "This template file has been uploaded. Please check its status at Templates menu > " + args.data.name + " > Zones tab > click a zone > Status field and Ready field." |
667 | | - }); |
668 | | - |
669 | 651 | } |
670 | 652 | }); |
671 | 653 | }, |
672 | 654 | postUpload: function(args) { |
673 | | - console.log("postUpload() is hit"); |
674 | | - // Called when upload is done to do |
675 | | - // verification checks; |
676 | | - // i.e., poll the server to verify successful upload |
677 | | - // |
678 | | - // success() will close the dialog and call standard action |
679 | | - // error() will keep dialog open if user wants to re-submit |
680 | | - args.response.success(); |
| 655 | + if(args.error) { |
| 656 | + args.response.error(args.errorMsg); |
| 657 | + } else { |
| 658 | + cloudStack.dialog.notice({ |
| 659 | + message: "This template file has been uploaded. Please check its status at Templates menu > " + args.data.name + " > Zones tab > click a zone > Status field and Ready field." |
| 660 | + }); |
| 661 | + args.response.success(); |
| 662 | + } |
681 | 663 | } |
682 | 664 | }, |
683 | 665 | fields: { |
|
0 commit comments