1 namespace app.directives {
2 export class Command implements ng.IDirective {
4 public restrict: string;
5 public replace: boolean;
6 public templateUrl: string;
8 public controller: string;
9 public controllerAs: string;
10 public bindToController: Object;
21 this.controller = 'commandController';
22 this.controllerAs = 'ctrl';
23 this.bindToController = {
29 this.templateUrl = 'templates/command.html';
34 * @returns {function(): HeaderMenu}
37 public static Factory(): ng.IDirectiveFactory {
38 var directive = () => {
41 directive.$inject = [];
46 export class CommandController {
48 public static $inject = ['APIEndPoint', '$scope'];
50 // From parent directive bindToController property
51 private index: string;
53 private remove: Function;
54 private list: declares.CommandInfo[];
55 private workspace: declares.IFileInfo;
57 // property of ui.bootstrap uib-accordion directive
58 private isOpen: boolean;
59 private heading: string;
61 // property about Option directive
63 private options: declares.IOption[];
66 constructor(private APIEndPoint: services.APIEndPoint, private $scope: ng.IScope) {
67 var controller = this;
69 // Get OptionControlFile and bind it to $scope.options
71 .getOptionControlFile('dcdFilePrint')
73 .then(function(result) {
74 controller.options = result.info;
80 .then(function(result) {
81 controller.dirs = result.info;
84 this.heading = "[" + this.index + "]: dcdFilePring";
87 // When call add button at executeController, all accordion close.
88 this.$scope.$on('close', () => {
89 controller.isOpen = false;
95 angular.forEach(this.options, (option) => {
102 angular.forEach(option.arg, (arg) => {
104 obj.arguments.push(arg.input);
108 if(obj.arguments.length > 0) {
115 workspace: this.workspace.fileId,
119 console.log(JSON.stringify(execObj,null,'\t'));
122 public removeMySelf(index:number) {
123 this.remove()(index,this.list);
126 private reloadFiles() {
127 var fileId = this.workspace.fileId;
132 var status = result.status;
133 if(status === 'success') {
134 this.files = result.info;
136 console.log(result.message);
142 console.log(this.files);
143 console.log(this.files);
144 console.log(this.workspace);