OSDN Git Service

[Manual test] /api/v1/execution with formdata from frontend v0.3.0p0038
authorhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Thu, 4 Feb 2016 00:47:18 +0000 (09:47 +0900)
committerhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Thu, 4 Feb 2016 00:47:18 +0000 (09:47 +0900)
modified:   front-end/app/scripts/declares.ts
modified:   front-end/app/scripts/directives/Command.ts
modified:   front-end/app/scripts/services/APIEndPoint.ts
modified:   front-end/dist/bundle.js
modified:   server/api/v1/execution/index.js

front-end/app/scripts/declares.ts
front-end/app/scripts/directives/Command.ts
front-end/app/scripts/services/APIEndPoint.ts
front-end/dist/bundle.js
server/api/v1/execution/index.js

index 53bc04d..05e9def 100644 (file)
@@ -66,6 +66,7 @@ namespace app.declares {
 
     export interface IResponseResource extends ng.resource.IResourceClass<IResponse> {
         //customAction(): any
+        execute(): any
     }
 
 }
index 58b00b9..b7812e6 100644 (file)
@@ -120,7 +120,12 @@ namespace app.directives {
                 options: opt
             };
 
-            console.log(JSON.stringify(execObj,null,'\t'));
+            //console.log(JSON.stringify(execObj,null,'\t'));
+            this.APIEndPoint
+                .execute(JSON.stringify(execObj))
+                .then((result) => {
+                    console.log(result);
+                })
         }
 
         public removeMySelf(index:number) {
index c7fdf4d..7b3cc16 100644 (file)
@@ -2,12 +2,14 @@ namespace app.services {
     export class APIEndPoint {
 
         private $resource: ng.resource.IResourceService;
+        private $http: ng.IHttpService;
 
-        constructor($resource: ng.resource.IResourceService) {
+        constructor($resource: ng.resource.IResourceService, $http: ng.IHttpService) {
             this.$resource = $resource;
+            this.$http = $http;
         }
 
-        private resource(endPoint: string) {
+        private resource(endPoint: string, data: any) {
             /**
              * setting custom action
              */
@@ -16,12 +18,18 @@ namespace app.services {
                 isArray: false
             };
 
-            return <declares.IResponseResource> this.$resource(endPoint, {}, { customAction: customAction});
+            var execute: ng.resource.IActionDescriptor = {
+                method: 'POST',
+                //transformRequest: data,
+                headers: {'Content-Type':undefined, enctype:'multipart/form-data'}
+            };
+
+            return <declares.IResponseResource> this.$resource(endPoint, {}, { execute: execute});
         }
 
         public getOptionControlFile(command: string): ng.resource.IResource<declares.IResponse> {
             var endPoint = '/api/optionControlFile/' + command;
-            return <declares.IResponseOption>this.resource(endPoint).get();
+            return <declares.IResponseOption>this.resource(endPoint, {}).get();
         }
 
         public getFiles(fileId: string): ng.resource.IResource<declares.IResponse> {
@@ -30,13 +38,25 @@ namespace app.services {
             if(fileId) {
                 endPoint += '/' + fileId;
             }
-            return <declares.IResponseFileInfo>this.resource(endPoint).get();
+            return <declares.IResponseFileInfo>this.resource(endPoint,{}).get();
         }
 
         public getDirectories(): ng.resource.IResource<declares.IResponse> {
             var endPoint = '/api/v1/all/workspace/directory';
 
-            return this.resource(endPoint).get();
+            return this.resource(endPoint,{}).get();
+        }
+
+        public execute(data: any): ng.IHttpPromise<{}> {
+            var endPoint = '/api/v1/execution';
+            var fd = new FormData()
+            fd.append('data', data);
+            return this.$http.post(endPoint,
+            fd, 
+            {
+                headers: {'Content-Type': undefined },
+                transformRequest: angular.identity
+            });
         }
     }
 }
index 0f36f02..d8b6cd9 100644 (file)
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
            var services;
            (function (services) {
                var APIEndPoint = (function () {
-                   function APIEndPoint($resource) {
+                   function APIEndPoint($resource, $http) {
                        this.$resource = $resource;
+                       this.$http = $http;
                    }
-                   APIEndPoint.prototype.resource = function (endPoint) {
+                   APIEndPoint.prototype.resource = function (endPoint, data) {
                        var customAction = {
                            method: 'GET',
                            isArray: false
                        };
-                       return this.$resource(endPoint, {}, { customAction: customAction });
+                       var execute = {
+                           method: 'POST',
+                           headers: { 'Content-Type': undefined, enctype: 'multipart/form-data' }
+                       };
+                       return this.$resource(endPoint, {}, { execute: execute });
                    };
                    APIEndPoint.prototype.getOptionControlFile = function (command) {
                        var endPoint = '/api/optionControlFile/' + command;
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getFiles = function (fileId) {
                        var endPoint = '/api/v1/workspace';
                        if (fileId) {
                            endPoint += '/' + fileId;
                        }
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
                        var endPoint = '/api/v1/all/workspace/directory';
-                       return this.resource(endPoint).get();
+                       return this.resource(endPoint, {}).get();
+                   };
+                   APIEndPoint.prototype.execute = function (data) {
+                       var endPoint = '/api/v1/execution';
+                       var fd = new FormData();
+                       fd.append('data', data);
+                       return this.$http.post(endPoint, fd, {
+                           headers: { 'Content-Type': undefined },
+                           transformRequest: angular.identity
+                       });
                    };
                    return APIEndPoint;
                })();
                        var execObj = {
                            command: this.name,
                            workspace: this.workspace.fileId,
-                           option: opt
+                           options: opt
                        };
-                       console.log(JSON.stringify(execObj, null, '\t'));
+                       this.APIEndPoint
+                           .execute(JSON.stringify(execObj))
+                           .then(function (result) {
+                           console.log(result);
+                       });
                    };
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
index a425741..7e68a38 100644 (file)
@@ -16,7 +16,6 @@ router.post('/', function(req, res) {
         root = __dirname + '/../../../../user-specific-files/workspace/';
     }
     form.parse(req, function(err, fields, files) {
-
         var data = JSON.parse(fields.data);
         var command = data.command;
         var options = data.options;
@@ -41,7 +40,6 @@ router.post('/', function(req, res) {
             };
             res.send(info);
         })
-
     });
 });