OSDN Git Service

[Develop and Manual Testing] Front-end select workspace and get file v0.3.0p0031
authorhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 3 Feb 2016 07:02:49 +0000 (16:02 +0900)
committerhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 3 Feb 2016 07:02:49 +0000 (16:02 +0900)
list

front-end/app/scripts/declares.ts
front-end/app/scripts/directives/Command.ts
front-end/app/scripts/services/APIEndPoint.ts
front-end/app/templates/command.html
front-end/app/templates/option.html
front-end/dist/bundle.js
front-end/dist/templates/command.html
front-end/dist/templates/option.html
server/api/v1/all/workspace/directory/index.js

index cd764b8..53bc04d 100644 (file)
@@ -48,16 +48,19 @@ namespace app.declares {
 
     export interface IResponse extends ng.resource.IResource<IResponse> {
         status: string,
+        message: string,
         info: any
     }
 
     export interface IResponseOption extends IResponse {
         status: string,
+        message: string,
         info: IOption[]
     }
 
     export interface IResponseFileInfo extends IResponse {
         status: string,
+        message: string,
         info: IFileInfo[]
     }
 
index ec6bec9..5f7daee 100644 (file)
@@ -52,30 +52,34 @@ namespace app.directives {
         private name: string;
         private remove: Function;
         private list: declares.CommandInfo[];
+        private workspace: declares.IFileInfo;
 
         // property of ui.bootstrap uib-accordion directive
         private isOpen: boolean;
         private heading: string;
 
         // property about Option directive
-        private files: string[];
+        private files: any;
         private options: declares.IOption[];
+        private dirs: any;
 
         constructor(private APIEndPoint: services.APIEndPoint, private $scope: ng.IScope) {
             var controller = this;
 
-            console.log(this.list);
-
             // Get OptionControlFile and bind it to $scope.options
             this.APIEndPoint
                 .getOptionControlFile('dcdFilePrint')
                 .$promise
                 .then(function(result) {
-                    console.log(result);
                     controller.options = result.info;
                 });
 
-            this.files = ['a.file', 'b.file', 'c.file'];
+            this.APIEndPoint
+                .getDirectories()
+                .$promise
+                .then(function(result) {
+                    controller.dirs = result.info;
+                });
 
             this.heading = "[" + this.index + "]: dcdFilePring";
             this.isOpen = true;
@@ -108,5 +112,26 @@ namespace app.directives {
         public removeMySelf(index:number) {
             this.remove()(index,this.list);
         }
+
+        private reloadFiles() {
+            var fileId = this.workspace.fileId;
+            this.APIEndPoint
+                .getFiles(fileId)
+                .$promise
+                .then((result) => { 
+                    var status = result.status;
+                    if(status === 'success') {
+                        this.files = result.info;
+                    } else {
+                        console.log(result.message);
+                    }
+                });
+        }
+
+        public debug() {
+                    console.log(this.files);
+                    console.log(this.files);
+            console.log(this.workspace);
+        }
     } 
 }
index 60adc23..c7fdf4d 100644 (file)
@@ -34,7 +34,7 @@ namespace app.services {
         }
 
         public getDirectories(): ng.resource.IResource<declares.IResponse> {
-            var endPoint = '/spi/v1/workspace/';
+            var endPoint = '/api/v1/all/workspace/directory';
 
             return this.resource(endPoint).get();
         }
index f9beaed..8b29d4f 100644 (file)
@@ -1,21 +1,40 @@
 <div>
-    <uib-accordion-group heading="{{ctrl.heading}}" is-open="ctrl.isOpen" panel-class="panel-danger">
-        <uib-accordion-heading>
-            <h4 class="panel-title">
-                [{{ctrl.index}}: {{ctrl.name}}]
-                <button class="pull-right"
-                        ng-click="ctrl.removeMySelf(ctrl.index)">
-                    <span class="glyphicon glyphicon-remove"></span>
-                </button>
-            </h4>
-        </uib-accordion-heading>
-        <code>
-            <form ng-submit="ctrl.submit()">
-                <option info="o" files="ctrl.files"  ng-repeat="o in ctrl.options"></option>
-                <button type="submit" class="btn btn-default">
-                    Execute
-                </button>
-            </form>
-        </code>
+<uib-accordion-group heading="{{ctrl.heading}}" is-open="ctrl.isOpen" panel-class="panel-danger">
+    <uib-accordion-heading>
+    <h4 class="panel-title">
+        [{{ctrl.index}}: {{ctrl.name}}]
+        <button class="pull-right"
+                ng-click="ctrl.removeMySelf(ctrl.index)">
+            <span class="glyphicon glyphicon-remove"></span>
+        </button>
+    </h4>
+    </uib-accordion-heading>
+    <code>
+        <form class="form-horizontal" ng-submit="ctrl.submit()">
+            <ul class="list-inline">
+                <li>
+                    <label class="control-label">
+                        workspace
+                    </label>
+                    <select class="form-control"
+                            ng-options="dir.name for dir in ctrl.dirs"
+                            ng-model="ctrl.workspace"
+                            ng-change="ctrl.reloadFiles()"
+                            required>
+                    </select>
+                </li>
+            </ul>
+
+            <option info="o" files="ctrl.files"  ng-repeat="o in ctrl.options"></option>
+            <button type="submit" class="btn btn-default">
+                Execute
+            </button>
+
+            <button type="button" ng-click="ctrl.debug()" class="btn btn-default">
+                Debug
+            </button>
+
+        </form>
+    </code>
     </uib-accordion-group>
 </div>
index 14096dd..082b66c 100644 (file)
@@ -1,6 +1,6 @@
 <ul class="list-inline">
-    <li ng-repeat="arg in ctrl.info.arg">
-        <span ng-switch="arg.formType">
+<li ng-repeat="arg in ctrl.info.arg">
+    <span ng-switch="arg.formType">
         <span ng-switch-when="number">
             <label class="control-label">
                 {{arg.argName}}
                    ng-required="ctrl.info.optionProperties">
 
         </span>
-        <span ng-switch-when="text">
+        <span ng-switch-when="select">
             <label class="control-label">
                 {{arg.argName}}
             </label>
             <select class="form-control"
-                    ng-options="file for file in ctrl.files"
+                    ng-options="file.name for file in ctrl.files"
                     ng-model="arg.input"
                     ng-required="ctrl.info.optionProperties">
             </select>
         </span>
-        <span ng-switch-when="select">
+
+        <span ng-switch-when="text">
             <label class="control-label">
                 {{arg.argName}}
             </label>
@@ -30,6 +31,6 @@
                    ng-model="arg.input"
                    ng-required="ctrl.info.optionProperties">
         </span>
-        </p>
-    </li>
+    </span>
+</li>
 </ul>
index aabada4..efb7398 100644 (file)
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
                        return this.resource(endPoint).get();
                    };
                    APIEndPoint.prototype.getDirectories = function () {
-                       var endPoint = '/spi/v1/workspace/';
+                       var endPoint = '/api/v1/all/workspace/directory';
                        return this.resource(endPoint).get();
                    };
                    return APIEndPoint;
                        this.APIEndPoint = APIEndPoint;
                        this.$scope = $scope;
                        var controller = this;
-                       console.log(this.list);
                        this.APIEndPoint
                            .getOptionControlFile('dcdFilePrint')
                            .$promise
                            .then(function (result) {
-                           console.log(result);
                            controller.options = result.info;
                        });
-                       this.files = ['a.file', 'b.file', 'c.file'];
+                       this.APIEndPoint
+                           .getDirectories()
+                           .$promise
+                           .then(function (result) {
+                           controller.dirs = result.info;
+                       });
                        this.heading = "[" + this.index + "]: dcdFilePring";
                        this.isOpen = true;
                        this.$scope.$on('close', function () {
                    CommandController.prototype.removeMySelf = function (index) {
                        this.remove()(index, this.list);
                    };
+                   CommandController.prototype.reloadFiles = function () {
+                       var _this = this;
+                       var fileId = this.workspace.fileId;
+                       this.APIEndPoint
+                           .getFiles(fileId)
+                           .$promise
+                           .then(function (result) {
+                           var status = result.status;
+                           if (status === 'success') {
+                               _this.files = result.info;
+                           }
+                           else {
+                               console.log(result.message);
+                           }
+                       });
+                   };
+                   CommandController.prototype.debug = function () {
+                       console.log(this.files);
+                       console.log(this.files);
+                       console.log(this.workspace);
+                   };
                    CommandController.$inject = ['APIEndPoint', '$scope'];
                    return CommandController;
                })();
index f9beaed..8b29d4f 100644 (file)
@@ -1,21 +1,40 @@
 <div>
-    <uib-accordion-group heading="{{ctrl.heading}}" is-open="ctrl.isOpen" panel-class="panel-danger">
-        <uib-accordion-heading>
-            <h4 class="panel-title">
-                [{{ctrl.index}}: {{ctrl.name}}]
-                <button class="pull-right"
-                        ng-click="ctrl.removeMySelf(ctrl.index)">
-                    <span class="glyphicon glyphicon-remove"></span>
-                </button>
-            </h4>
-        </uib-accordion-heading>
-        <code>
-            <form ng-submit="ctrl.submit()">
-                <option info="o" files="ctrl.files"  ng-repeat="o in ctrl.options"></option>
-                <button type="submit" class="btn btn-default">
-                    Execute
-                </button>
-            </form>
-        </code>
+<uib-accordion-group heading="{{ctrl.heading}}" is-open="ctrl.isOpen" panel-class="panel-danger">
+    <uib-accordion-heading>
+    <h4 class="panel-title">
+        [{{ctrl.index}}: {{ctrl.name}}]
+        <button class="pull-right"
+                ng-click="ctrl.removeMySelf(ctrl.index)">
+            <span class="glyphicon glyphicon-remove"></span>
+        </button>
+    </h4>
+    </uib-accordion-heading>
+    <code>
+        <form class="form-horizontal" ng-submit="ctrl.submit()">
+            <ul class="list-inline">
+                <li>
+                    <label class="control-label">
+                        workspace
+                    </label>
+                    <select class="form-control"
+                            ng-options="dir.name for dir in ctrl.dirs"
+                            ng-model="ctrl.workspace"
+                            ng-change="ctrl.reloadFiles()"
+                            required>
+                    </select>
+                </li>
+            </ul>
+
+            <option info="o" files="ctrl.files"  ng-repeat="o in ctrl.options"></option>
+            <button type="submit" class="btn btn-default">
+                Execute
+            </button>
+
+            <button type="button" ng-click="ctrl.debug()" class="btn btn-default">
+                Debug
+            </button>
+
+        </form>
+    </code>
     </uib-accordion-group>
 </div>
index 14096dd..082b66c 100644 (file)
@@ -1,6 +1,6 @@
 <ul class="list-inline">
-    <li ng-repeat="arg in ctrl.info.arg">
-        <span ng-switch="arg.formType">
+<li ng-repeat="arg in ctrl.info.arg">
+    <span ng-switch="arg.formType">
         <span ng-switch-when="number">
             <label class="control-label">
                 {{arg.argName}}
                    ng-required="ctrl.info.optionProperties">
 
         </span>
-        <span ng-switch-when="text">
+        <span ng-switch-when="select">
             <label class="control-label">
                 {{arg.argName}}
             </label>
             <select class="form-control"
-                    ng-options="file for file in ctrl.files"
+                    ng-options="file.name for file in ctrl.files"
                     ng-model="arg.input"
                     ng-required="ctrl.info.optionProperties">
             </select>
         </span>
-        <span ng-switch-when="select">
+
+        <span ng-switch-when="text">
             <label class="control-label">
                 {{arg.argName}}
             </label>
@@ -30,6 +31,6 @@
                    ng-model="arg.input"
                    ng-required="ctrl.info.optionProperties">
         </span>
-        </p>
-    </li>
+    </span>
+</li>
 </ul>
index befe924..901eec3 100644 (file)
@@ -10,7 +10,11 @@ router.get('/', function(req, res) {
     console.log('hogehoge');
     db.getDirectories()
     .then(function(dirs) {
-        res.send(dirs);
+        var info = {
+            status: 'success',
+            info: dirs
+        }
+        res.send(info);
     })
 });