X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=front-end%2Fdist%2Fbundle.js;h=5d54595b67bf4322feb6e207fd72379a1851e790;hb=af181c0a4516761e4c0822b911b489eb21ace0bd;hp=d8b6cd9646623e45498fd167ad5190aaf4f82e9d;hpb=0be81fc432a2a72b2a11b74acba29de297850819;p=eos%2Fzephyr.git diff --git a/front-end/dist/bundle.js b/front-end/dist/bundle.js index d8b6cd9..5d54595 100644 --- a/front-end/dist/bundle.js +++ b/front-end/dist/bundle.js @@ -59,6 +59,10 @@ __webpack_require__(16); __webpack_require__(17); __webpack_require__(18); + __webpack_require__(19); + __webpack_require__(20); + __webpack_require__(21); + __webpack_require__(22); /***/ }, @@ -41032,7 +41036,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -41046,6 +41050,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -41055,6 +41067,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -41081,6 +41101,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -41088,6 +41123,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -41116,12 +41225,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -41132,11 +41246,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -41171,7 +41297,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -41190,11 +41319,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -41209,6 +41357,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -41219,6 +41370,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -41341,7 +41506,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -41364,9 +41535,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -41384,7 +41556,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -41406,6 +41581,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -41437,12 +41681,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -41488,7 +41738,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -41502,6 +41752,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -41511,6 +41769,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -41537,6 +41803,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -41544,6 +41825,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -41572,12 +41927,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -41588,11 +41948,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -41627,7 +41999,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -41646,11 +42021,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); + }; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -41665,6 +42059,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -41675,6 +42072,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -41797,7 +42208,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -41820,9 +42237,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -41840,7 +42258,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -41862,6 +42283,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -41893,12 +42383,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -41944,7 +42440,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -41958,6 +42454,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -41967,6 +42471,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -41993,6 +42505,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -42000,6 +42527,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -42028,12 +42629,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -42044,11 +42650,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -42083,7 +42701,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -42102,11 +42723,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -42121,6 +42761,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -42131,6 +42774,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -42253,7 +42910,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -42276,9 +42939,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -42296,7 +42960,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -42318,6 +42985,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -42349,12 +43085,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -42400,7 +43142,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -42414,6 +43156,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -42423,6 +43173,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -42449,6 +43207,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -42456,6 +43229,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -42484,12 +43331,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -42500,11 +43352,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -42539,7 +43403,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -42558,11 +43425,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -42577,6 +43463,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -42587,6 +43476,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -42709,7 +43612,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -42732,9 +43641,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -42752,7 +43662,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -42774,6 +43687,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -42805,12 +43787,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -42856,7 +43844,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -42870,6 +43858,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -42879,6 +43875,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -42905,6 +43909,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -42912,6 +43931,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -42940,12 +44033,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -42956,11 +44054,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -42995,7 +44105,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -43014,11 +44127,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -43033,6 +44165,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -43043,6 +44178,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -43165,7 +44314,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -43188,9 +44343,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -43208,7 +44364,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -43230,6 +44389,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -43261,12 +44489,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -43312,7 +44546,2815 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getFiles = function (fileId) { + var endPoint = '/api/v1/workspace'; + if (fileId) { + endPoint += '/' + fileId; + } + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getDirectories = function () { + var endPoint = '/api/v1/all/workspace/directory'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + 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 + }); + }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; + return APIEndPoint; + })(); + services.APIEndPoint = APIEndPoint; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var MyModal = (function () { + function MyModal($uibModal) { + this.$uibModal = $uibModal; + this.modalOption = { + backdrop: true, + controller: null, + templateUrl: null, + size: null + }; + } + MyModal.prototype.open = function (modalName) { + if (modalName === 'SelectCommand') { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.size = 'lg'; + } + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; + return MyModal; + })(); + services.MyModal = MyModal; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Command = (function () { + function Command() { + this.restrict = 'E'; + this.replace = true; + this.scope = true; + this.controller = 'commandController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + index: '=', + name: '=', + remove: '&', + list: '=' + }; + this.templateUrl = 'templates/command.html'; + } + Command.Factory = function () { + var directive = function () { + return new Command(); + }; + directive.$inject = []; + return directive; + }; + return Command; + })(); + directives.Command = Command; + var CommandController = (function () { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; + var controller = this; + this.APIEndPoint + .getOptionControlFile(this.name) + .$promise + .then(function (result) { + controller.options = result.info; + }); + this.APIEndPoint + .getDirectories() + .$promise + .then(function (result) { + controller.dirs = result.info; + }); + this.heading = "[" + this.index + "]: dcdFilePrint"; + this.isOpen = true; + this.$scope.$on('close', function () { + controller.isOpen = false; + }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); + } + CommandController.prototype.submit = function () { + var opt = []; + angular.forEach(this.options, function (option) { + var obj = { + name: option.option, + arguments: [] + }; + angular.forEach(option.arg, function (arg) { + if (arg.input) { + if (typeof arg.input === 'object') { + obj.arguments.push(arg.input.name); + } + else { + obj.arguments.push(arg.input); + } + } + }); + if (obj.arguments.length > 0) { + opt.push(obj); + } + }); + var execObj = { + command: this.name, + workspace: this.workspace.fileId, + options: opt + }; + this.APIEndPoint + .execute(JSON.stringify(execObj)) + .then(function (result) { + console.log(result); + }); + }; + CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); + this.remove()(index, this.list); + this.Console.showIDs(); + }; + 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 () { + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); + }; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; + return CommandController; + })(); + directives.CommandController = CommandController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var HeaderMenu = (function () { + function HeaderMenu() { + this.restrict = 'E'; + this.replace = true; + this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; + } + HeaderMenu.Factory = function () { + var directive = function () { + return new HeaderMenu(); + }; + return directive; + }; + return HeaderMenu; + })(); + directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Option = (function () { + function Option() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'optionController'; + this.bindToController = { + info: '=', + files: '=' + }; + this.scope = true; + this.templateUrl = 'templates/option.html'; + this.controllerAs = 'ctrl'; + } + Option.Factory = function () { + var directive = function () { + return new Option(); + }; + directive.$inject = []; + return directive; + }; + return Option; + })(); + directives.Option = Option; + var OptionController = (function () { + function OptionController() { + var controller = this; + angular.forEach(controller.info.arg, function (arg) { + if (arg.initialValue) { + if (arg.formType === 'number') { + arg.input = parseInt(arg.initialValue); + } + else { + arg.input = arg.initialValue; + } + } + }); + } + OptionController.$inject = []; + return OptionController; + })(); + directives.OptionController = OptionController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Directory = (function () { + function Directory() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'directoryController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + info: '=', + add: '&', + list: '=', + files: '=' + }; + this.templateUrl = 'templates/directory.html'; + } + Directory.Factory = function () { + var directive = function () { + return new Directory(); + }; + return directive; + }; + return Directory; + })(); + directives.Directory = Directory; + var DirectoryController = (function () { + function DirectoryController(APIEndPoint, $scope) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + var controller = this; + this.APIEndPoint + .getFiles(this.info.fileId) + .$promise + .then(function (result) { + if (result.status === 'success') { + controller.files = result.info; + angular.forEach(result.info, function (file) { + if (file.fileType === '0') { + var o = file; + if (controller.info.path === '/') { + o.path = '/' + file.name; + } + else { + o.path = controller.info.path + '/' + file.name; + } + controller.add()(o, controller.list); + } + }); + } + ; + }); + } + DirectoryController.$inject = ['APIEndPoint', '$scope']; + return DirectoryController; + })(); + directives.DirectoryController = DirectoryController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Execution = (function () { + function Execution(MyModal, $scope) { + this.MyModal = MyModal; + this.$scope = $scope; + this.commandInfoList = []; + } + ; + Execution.prototype.add = function () { + this.$scope.$broadcast('close'); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); + }; + Execution.prototype.open = function () { + var result = this.MyModal.open('SelectCommand'); + console.log(result); + }; + Execution.prototype.remove = function (index, list) { + list.splice(index, 1); + }; + Execution.prototype.close = function () { + console.log("close"); + }; + Execution.$inject = ['MyModal', '$scope']; + return Execution; + })(); + controllers.Execution = Execution; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Workspace = (function () { + function Workspace($scope, APIEndPoint, MyModal) { + this.$scope = $scope; + this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; + this.directoryList = []; + var controller = this; + var directoryList = this.directoryList; + var o = { + fileId: '1f83f620-c1ed-11e5-9657-7942989daa00', + name: '', + parentId: '', + fileType: '', + createdAt: '', + updatedAt: '', + path: '/' + }; + directoryList.push(o); + } + Workspace.prototype.addDirectory = function (info, directoryList) { + directoryList.push(info); + }; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; + return Workspace; + })(); + controllers.Workspace = Workspace; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var History = (function () { + function History($scope) { + this.page = "History"; + } + History.$inject = ['$scope']; + return History; + })(); + controllers.History = History; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { + 'use strict'; + var appName = 'zephyr'; + app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); + app.zephyr.config(function ($stateProvider, $urlRouterProvider, $locationProvider) { + $urlRouterProvider.otherwise('/execution'); + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); + $stateProvider + .state('execution', { + url: '/execution', + templateUrl: 'templates/execution.html', + controller: 'executionController', + controllerAs: 'c' + }) + .state('workspace', { + url: '/workspace', + templateUrl: 'templates/workspace.html', + controller: 'workspaceController', + controllerAs: 'c' + }) + .state('history', { + url: '/history', + templateUrl: 'templates/history.html', + controller: 'historyController', + controllerAs: 'c' + }); + }); + app.zephyr.service('APIEndPoint', app.services.APIEndPoint); + app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); + app.zephyr.controller('executionController', app.controllers.Execution); + app.zephyr.controller('workspaceController', app.controllers.Workspace); + app.zephyr.controller('historyController', app.controllers.History); + app.zephyr.controller('commandController', app.directives.CommandController); + app.zephyr.controller('optionController', app.directives.OptionController); + app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); + app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); + app.zephyr.directive('command', app.directives.Command.Factory()); + app.zephyr.directive('option', app.directives.Option.Factory()); + app.zephyr.directive('directory', app.directives.Directory.Factory()); + })(app || (app = {})); + + +/***/ }, +/* 14 */ +/***/ function(module, exports) { + + var app; + (function (app) { + var declares; + (function (declares) { + var CommandInfo = (function () { + function CommandInfo(name) { + this.name = name; + } + return CommandInfo; + })(); + declares.CommandInfo = CommandInfo; + })(declares = app.declares || (app.declares = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var APIEndPoint = (function () { + function APIEndPoint($resource, $http) { + this.$resource = $resource; + this.$http = $http; + } + APIEndPoint.prototype.resource = function (endPoint, data) { + var customAction = { + method: 'GET', + isArray: false + }; + 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/v1/optionControlFile/' + command; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getFiles = function (fileId) { + var endPoint = '/api/v1/workspace'; + if (fileId) { + endPoint += '/' + fileId; + } + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getDirectories = function () { + var endPoint = '/api/v1/all/workspace/directory'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + 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 + }); + }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; + return APIEndPoint; + })(); + services.APIEndPoint = APIEndPoint; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var MyModal = (function () { + function MyModal($uibModal) { + this.$uibModal = $uibModal; + this.modalOption = { + backdrop: true, + controller: null, + templateUrl: null, + size: null + }; + } + MyModal.prototype.open = function (modalName) { + if (modalName === 'SelectCommand') { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.size = 'lg'; + } + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; + return MyModal; + })(); + services.MyModal = MyModal; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Command = (function () { + function Command() { + this.restrict = 'E'; + this.replace = true; + this.scope = true; + this.controller = 'commandController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + index: '=', + name: '=', + remove: '&', + list: '=' + }; + this.templateUrl = 'templates/command.html'; + } + Command.Factory = function () { + var directive = function () { + return new Command(); + }; + directive.$inject = []; + return directive; + }; + return Command; + })(); + directives.Command = Command; + var CommandController = (function () { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; + var controller = this; + this.APIEndPoint + .getOptionControlFile(this.name) + .$promise + .then(function (result) { + controller.options = result.info; + }); + this.APIEndPoint + .getDirectories() + .$promise + .then(function (result) { + controller.dirs = result.info; + }); + this.heading = "[" + this.index + "]: dcdFilePrint"; + this.isOpen = true; + this.$scope.$on('close', function () { + controller.isOpen = false; + }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); + } + CommandController.prototype.submit = function () { + var opt = []; + angular.forEach(this.options, function (option) { + var obj = { + name: option.option, + arguments: [] + }; + angular.forEach(option.arg, function (arg) { + if (arg.input) { + if (typeof arg.input === 'object') { + obj.arguments.push(arg.input.name); + } + else { + obj.arguments.push(arg.input); + } + } + }); + if (obj.arguments.length > 0) { + opt.push(obj); + } + }); + var execObj = { + command: this.name, + workspace: this.workspace.fileId, + options: opt + }; + this.APIEndPoint + .execute(JSON.stringify(execObj)) + .then(function (result) { + console.log(result); + }); + }; + CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); + this.remove()(index, this.list); + this.Console.showIDs(); + }; + 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 () { + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); + }; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; + return CommandController; + })(); + directives.CommandController = CommandController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var HeaderMenu = (function () { + function HeaderMenu() { + this.restrict = 'E'; + this.replace = true; + this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; + } + HeaderMenu.Factory = function () { + var directive = function () { + return new HeaderMenu(); + }; + return directive; + }; + return HeaderMenu; + })(); + directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Option = (function () { + function Option() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'optionController'; + this.bindToController = { + info: '=', + files: '=' + }; + this.scope = true; + this.templateUrl = 'templates/option.html'; + this.controllerAs = 'ctrl'; + } + Option.Factory = function () { + var directive = function () { + return new Option(); + }; + directive.$inject = []; + return directive; + }; + return Option; + })(); + directives.Option = Option; + var OptionController = (function () { + function OptionController() { + var controller = this; + angular.forEach(controller.info.arg, function (arg) { + if (arg.initialValue) { + if (arg.formType === 'number') { + arg.input = parseInt(arg.initialValue); + } + else { + arg.input = arg.initialValue; + } + } + }); + } + OptionController.$inject = []; + return OptionController; + })(); + directives.OptionController = OptionController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Directory = (function () { + function Directory() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'directoryController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + info: '=', + add: '&', + list: '=', + files: '=' + }; + this.templateUrl = 'templates/directory.html'; + } + Directory.Factory = function () { + var directive = function () { + return new Directory(); + }; + return directive; + }; + return Directory; + })(); + directives.Directory = Directory; + var DirectoryController = (function () { + function DirectoryController(APIEndPoint, $scope) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + var controller = this; + this.APIEndPoint + .getFiles(this.info.fileId) + .$promise + .then(function (result) { + if (result.status === 'success') { + controller.files = result.info; + angular.forEach(result.info, function (file) { + if (file.fileType === '0') { + var o = file; + if (controller.info.path === '/') { + o.path = '/' + file.name; + } + else { + o.path = controller.info.path + '/' + file.name; + } + controller.add()(o, controller.list); + } + }); + } + ; + }); + } + DirectoryController.$inject = ['APIEndPoint', '$scope']; + return DirectoryController; + })(); + directives.DirectoryController = DirectoryController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Execution = (function () { + function Execution(MyModal, $scope) { + this.MyModal = MyModal; + this.$scope = $scope; + this.commandInfoList = []; + } + ; + Execution.prototype.add = function () { + this.$scope.$broadcast('close'); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); + }; + Execution.prototype.open = function () { + var result = this.MyModal.open('SelectCommand'); + console.log(result); + }; + Execution.prototype.remove = function (index, list) { + list.splice(index, 1); + }; + Execution.prototype.close = function () { + console.log("close"); + }; + Execution.$inject = ['MyModal', '$scope']; + return Execution; + })(); + controllers.Execution = Execution; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Workspace = (function () { + function Workspace($scope, APIEndPoint, MyModal) { + this.$scope = $scope; + this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; + this.directoryList = []; + var controller = this; + var directoryList = this.directoryList; + var o = { + fileId: '1f83f620-c1ed-11e5-9657-7942989daa00', + name: '', + parentId: '', + fileType: '', + createdAt: '', + updatedAt: '', + path: '/' + }; + directoryList.push(o); + } + Workspace.prototype.addDirectory = function (info, directoryList) { + directoryList.push(info); + }; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; + return Workspace; + })(); + controllers.Workspace = Workspace; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var History = (function () { + function History($scope) { + this.page = "History"; + } + History.$inject = ['$scope']; + return History; + })(); + controllers.History = History; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { + 'use strict'; + var appName = 'zephyr'; + app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); + app.zephyr.config(function ($stateProvider, $urlRouterProvider, $locationProvider) { + $urlRouterProvider.otherwise('/execution'); + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); + $stateProvider + .state('execution', { + url: '/execution', + templateUrl: 'templates/execution.html', + controller: 'executionController', + controllerAs: 'c' + }) + .state('workspace', { + url: '/workspace', + templateUrl: 'templates/workspace.html', + controller: 'workspaceController', + controllerAs: 'c' + }) + .state('history', { + url: '/history', + templateUrl: 'templates/history.html', + controller: 'historyController', + controllerAs: 'c' + }); + }); + app.zephyr.service('APIEndPoint', app.services.APIEndPoint); + app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); + app.zephyr.controller('executionController', app.controllers.Execution); + app.zephyr.controller('workspaceController', app.controllers.Workspace); + app.zephyr.controller('historyController', app.controllers.History); + app.zephyr.controller('commandController', app.directives.CommandController); + app.zephyr.controller('optionController', app.directives.OptionController); + app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); + app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); + app.zephyr.directive('command', app.directives.Command.Factory()); + app.zephyr.directive('option', app.directives.Option.Factory()); + app.zephyr.directive('directory', app.directives.Directory.Factory()); + })(app || (app = {})); + + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + var app; + (function (app) { + var declares; + (function (declares) { + var CommandInfo = (function () { + function CommandInfo(name) { + this.name = name; + } + return CommandInfo; + })(); + declares.CommandInfo = CommandInfo; + })(declares = app.declares || (app.declares = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var APIEndPoint = (function () { + function APIEndPoint($resource, $http) { + this.$resource = $resource; + this.$http = $http; + } + APIEndPoint.prototype.resource = function (endPoint, data) { + var customAction = { + method: 'GET', + isArray: false + }; + 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/v1/optionControlFile/' + command; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getFiles = function (fileId) { + var endPoint = '/api/v1/workspace'; + if (fileId) { + endPoint += '/' + fileId; + } + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getDirectories = function () { + var endPoint = '/api/v1/all/workspace/directory'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + 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 + }); + }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; + return APIEndPoint; + })(); + services.APIEndPoint = APIEndPoint; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var MyModal = (function () { + function MyModal($uibModal) { + this.$uibModal = $uibModal; + this.modalOption = { + backdrop: true, + controller: null, + templateUrl: null, + size: null + }; + } + MyModal.prototype.open = function (modalName) { + if (modalName === 'SelectCommand') { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.size = 'lg'; + } + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; + return MyModal; + })(); + services.MyModal = MyModal; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Command = (function () { + function Command() { + this.restrict = 'E'; + this.replace = true; + this.scope = true; + this.controller = 'commandController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + index: '=', + name: '=', + remove: '&', + list: '=' + }; + this.templateUrl = 'templates/command.html'; + } + Command.Factory = function () { + var directive = function () { + return new Command(); + }; + directive.$inject = []; + return directive; + }; + return Command; + })(); + directives.Command = Command; + var CommandController = (function () { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; + var controller = this; + this.APIEndPoint + .getOptionControlFile(this.name) + .$promise + .then(function (result) { + controller.options = result.info; + }); + this.APIEndPoint + .getDirectories() + .$promise + .then(function (result) { + controller.dirs = result.info; + }); + this.heading = "[" + this.index + "]: dcdFilePrint"; + this.isOpen = true; + this.$scope.$on('close', function () { + controller.isOpen = false; + }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); + } + CommandController.prototype.submit = function () { + var opt = []; + angular.forEach(this.options, function (option) { + var obj = { + name: option.option, + arguments: [] + }; + angular.forEach(option.arg, function (arg) { + if (arg.input) { + if (typeof arg.input === 'object') { + obj.arguments.push(arg.input.name); + } + else { + obj.arguments.push(arg.input); + } + } + }); + if (obj.arguments.length > 0) { + opt.push(obj); + } + }); + var execObj = { + command: this.name, + workspace: this.workspace.fileId, + options: opt + }; + this.APIEndPoint + .execute(JSON.stringify(execObj)) + .then(function (result) { + console.log(result); + }); + }; + CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); + this.remove()(index, this.list); + this.Console.showIDs(); + }; + 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 () { + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); + }; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; + return CommandController; + })(); + directives.CommandController = CommandController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var HeaderMenu = (function () { + function HeaderMenu() { + this.restrict = 'E'; + this.replace = true; + this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; + } + HeaderMenu.Factory = function () { + var directive = function () { + return new HeaderMenu(); + }; + return directive; + }; + return HeaderMenu; + })(); + directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Option = (function () { + function Option() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'optionController'; + this.bindToController = { + info: '=', + files: '=' + }; + this.scope = true; + this.templateUrl = 'templates/option.html'; + this.controllerAs = 'ctrl'; + } + Option.Factory = function () { + var directive = function () { + return new Option(); + }; + directive.$inject = []; + return directive; + }; + return Option; + })(); + directives.Option = Option; + var OptionController = (function () { + function OptionController() { + var controller = this; + angular.forEach(controller.info.arg, function (arg) { + if (arg.initialValue) { + if (arg.formType === 'number') { + arg.input = parseInt(arg.initialValue); + } + else { + arg.input = arg.initialValue; + } + } + }); + } + OptionController.$inject = []; + return OptionController; + })(); + directives.OptionController = OptionController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Directory = (function () { + function Directory() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'directoryController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + info: '=', + add: '&', + list: '=', + files: '=' + }; + this.templateUrl = 'templates/directory.html'; + } + Directory.Factory = function () { + var directive = function () { + return new Directory(); + }; + return directive; + }; + return Directory; + })(); + directives.Directory = Directory; + var DirectoryController = (function () { + function DirectoryController(APIEndPoint, $scope) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + var controller = this; + this.APIEndPoint + .getFiles(this.info.fileId) + .$promise + .then(function (result) { + if (result.status === 'success') { + controller.files = result.info; + angular.forEach(result.info, function (file) { + if (file.fileType === '0') { + var o = file; + if (controller.info.path === '/') { + o.path = '/' + file.name; + } + else { + o.path = controller.info.path + '/' + file.name; + } + controller.add()(o, controller.list); + } + }); + } + ; + }); + } + DirectoryController.$inject = ['APIEndPoint', '$scope']; + return DirectoryController; + })(); + directives.DirectoryController = DirectoryController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Execution = (function () { + function Execution(MyModal, $scope) { + this.MyModal = MyModal; + this.$scope = $scope; + this.commandInfoList = []; + } + ; + Execution.prototype.add = function () { + this.$scope.$broadcast('close'); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); + }; + Execution.prototype.open = function () { + var result = this.MyModal.open('SelectCommand'); + console.log(result); + }; + Execution.prototype.remove = function (index, list) { + list.splice(index, 1); + }; + Execution.prototype.close = function () { + console.log("close"); + }; + Execution.$inject = ['MyModal', '$scope']; + return Execution; + })(); + controllers.Execution = Execution; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Workspace = (function () { + function Workspace($scope, APIEndPoint, MyModal) { + this.$scope = $scope; + this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; + this.directoryList = []; + var controller = this; + var directoryList = this.directoryList; + var o = { + fileId: '1f83f620-c1ed-11e5-9657-7942989daa00', + name: '', + parentId: '', + fileType: '', + createdAt: '', + updatedAt: '', + path: '/' + }; + directoryList.push(o); + } + Workspace.prototype.addDirectory = function (info, directoryList) { + directoryList.push(info); + }; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; + return Workspace; + })(); + controllers.Workspace = Workspace; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var History = (function () { + function History($scope) { + this.page = "History"; + } + History.$inject = ['$scope']; + return History; + })(); + controllers.History = History; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { + 'use strict'; + var appName = 'zephyr'; + app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); + app.zephyr.config(function ($stateProvider, $urlRouterProvider, $locationProvider) { + $urlRouterProvider.otherwise('/execution'); + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); + $stateProvider + .state('execution', { + url: '/execution', + templateUrl: 'templates/execution.html', + controller: 'executionController', + controllerAs: 'c' + }) + .state('workspace', { + url: '/workspace', + templateUrl: 'templates/workspace.html', + controller: 'workspaceController', + controllerAs: 'c' + }) + .state('history', { + url: '/history', + templateUrl: 'templates/history.html', + controller: 'historyController', + controllerAs: 'c' + }); + }); + app.zephyr.service('APIEndPoint', app.services.APIEndPoint); + app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); + app.zephyr.controller('executionController', app.controllers.Execution); + app.zephyr.controller('workspaceController', app.controllers.Workspace); + app.zephyr.controller('historyController', app.controllers.History); + app.zephyr.controller('commandController', app.directives.CommandController); + app.zephyr.controller('optionController', app.directives.OptionController); + app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); + app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); + app.zephyr.directive('command', app.directives.Command.Factory()); + app.zephyr.directive('option', app.directives.Option.Factory()); + app.zephyr.directive('directory', app.directives.Directory.Factory()); + })(app || (app = {})); + + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + var app; + (function (app) { + var declares; + (function (declares) { + var CommandInfo = (function () { + function CommandInfo(name) { + this.name = name; + } + return CommandInfo; + })(); + declares.CommandInfo = CommandInfo; + })(declares = app.declares || (app.declares = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var APIEndPoint = (function () { + function APIEndPoint($resource, $http) { + this.$resource = $resource; + this.$http = $http; + } + APIEndPoint.prototype.resource = function (endPoint, data) { + var customAction = { + method: 'GET', + isArray: false + }; + 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/v1/optionControlFile/' + command; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getFiles = function (fileId) { + var endPoint = '/api/v1/workspace'; + if (fileId) { + endPoint += '/' + fileId; + } + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getDirectories = function () { + var endPoint = '/api/v1/all/workspace/directory'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + 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 + }); + }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; + return APIEndPoint; + })(); + services.APIEndPoint = APIEndPoint; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var MyModal = (function () { + function MyModal($uibModal) { + this.$uibModal = $uibModal; + this.modalOption = { + backdrop: true, + controller: null, + templateUrl: null, + size: null + }; + } + MyModal.prototype.open = function (modalName) { + if (modalName === 'SelectCommand') { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.size = 'lg'; + } + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; + return MyModal; + })(); + services.MyModal = MyModal; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Command = (function () { + function Command() { + this.restrict = 'E'; + this.replace = true; + this.scope = true; + this.controller = 'commandController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + index: '=', + name: '=', + remove: '&', + list: '=' + }; + this.templateUrl = 'templates/command.html'; + } + Command.Factory = function () { + var directive = function () { + return new Command(); + }; + directive.$inject = []; + return directive; + }; + return Command; + })(); + directives.Command = Command; + var CommandController = (function () { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; + var controller = this; + this.APIEndPoint + .getOptionControlFile(this.name) + .$promise + .then(function (result) { + controller.options = result.info; + }); + this.APIEndPoint + .getDirectories() + .$promise + .then(function (result) { + controller.dirs = result.info; + }); + this.heading = "[" + this.index + "]: dcdFilePrint"; + this.isOpen = true; + this.$scope.$on('close', function () { + controller.isOpen = false; + }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); + } + CommandController.prototype.submit = function () { + var opt = []; + angular.forEach(this.options, function (option) { + var obj = { + name: option.option, + arguments: [] + }; + angular.forEach(option.arg, function (arg) { + if (arg.input) { + if (typeof arg.input === 'object') { + obj.arguments.push(arg.input.name); + } + else { + obj.arguments.push(arg.input); + } + } + }); + if (obj.arguments.length > 0) { + opt.push(obj); + } + }); + var execObj = { + command: this.name, + workspace: this.workspace.fileId, + options: opt + }; + this.APIEndPoint + .execute(JSON.stringify(execObj)) + .then(function (result) { + console.log(result); + }); + }; + CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); + this.remove()(index, this.list); + this.Console.showIDs(); + }; + 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 () { + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); + }; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; + return CommandController; + })(); + directives.CommandController = CommandController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var HeaderMenu = (function () { + function HeaderMenu() { + this.restrict = 'E'; + this.replace = true; + this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; + } + HeaderMenu.Factory = function () { + var directive = function () { + return new HeaderMenu(); + }; + return directive; + }; + return HeaderMenu; + })(); + directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Option = (function () { + function Option() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'optionController'; + this.bindToController = { + info: '=', + files: '=' + }; + this.scope = true; + this.templateUrl = 'templates/option.html'; + this.controllerAs = 'ctrl'; + } + Option.Factory = function () { + var directive = function () { + return new Option(); + }; + directive.$inject = []; + return directive; + }; + return Option; + })(); + directives.Option = Option; + var OptionController = (function () { + function OptionController() { + var controller = this; + angular.forEach(controller.info.arg, function (arg) { + if (arg.initialValue) { + if (arg.formType === 'number') { + arg.input = parseInt(arg.initialValue); + } + else { + arg.input = arg.initialValue; + } + } + }); + } + OptionController.$inject = []; + return OptionController; + })(); + directives.OptionController = OptionController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var directives; + (function (directives) { + var Directory = (function () { + function Directory() { + this.restrict = 'E'; + this.replace = true; + this.controller = 'directoryController'; + this.controllerAs = 'ctrl'; + this.bindToController = { + info: '=', + add: '&', + list: '=', + files: '=' + }; + this.templateUrl = 'templates/directory.html'; + } + Directory.Factory = function () { + var directive = function () { + return new Directory(); + }; + return directive; + }; + return Directory; + })(); + directives.Directory = Directory; + var DirectoryController = (function () { + function DirectoryController(APIEndPoint, $scope) { + this.APIEndPoint = APIEndPoint; + this.$scope = $scope; + var controller = this; + this.APIEndPoint + .getFiles(this.info.fileId) + .$promise + .then(function (result) { + if (result.status === 'success') { + controller.files = result.info; + angular.forEach(result.info, function (file) { + if (file.fileType === '0') { + var o = file; + if (controller.info.path === '/') { + o.path = '/' + file.name; + } + else { + o.path = controller.info.path + '/' + file.name; + } + controller.add()(o, controller.list); + } + }); + } + ; + }); + } + DirectoryController.$inject = ['APIEndPoint', '$scope']; + return DirectoryController; + })(); + directives.DirectoryController = DirectoryController; + })(directives = app.directives || (app.directives = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Execution = (function () { + function Execution(MyModal, $scope) { + this.MyModal = MyModal; + this.$scope = $scope; + this.commandInfoList = []; + } + ; + Execution.prototype.add = function () { + this.$scope.$broadcast('close'); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); + }; + Execution.prototype.open = function () { + var result = this.MyModal.open('SelectCommand'); + console.log(result); + }; + Execution.prototype.remove = function (index, list) { + list.splice(index, 1); + }; + Execution.prototype.close = function () { + console.log("close"); + }; + Execution.$inject = ['MyModal', '$scope']; + return Execution; + })(); + controllers.Execution = Execution; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Workspace = (function () { + function Workspace($scope, APIEndPoint, MyModal) { + this.$scope = $scope; + this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; + this.directoryList = []; + var controller = this; + var directoryList = this.directoryList; + var o = { + fileId: '1f83f620-c1ed-11e5-9657-7942989daa00', + name: '', + parentId: '', + fileType: '', + createdAt: '', + updatedAt: '', + path: '/' + }; + directoryList.push(o); + } + Workspace.prototype.addDirectory = function (info, directoryList) { + directoryList.push(info); + }; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; + return Workspace; + })(); + controllers.Workspace = Workspace; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var History = (function () { + function History($scope) { + this.page = "History"; + } + History.$inject = ['$scope']; + return History; + })(); + controllers.History = History; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { + 'use strict'; + var appName = 'zephyr'; + app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); + app.zephyr.config(function ($stateProvider, $urlRouterProvider, $locationProvider) { + $urlRouterProvider.otherwise('/execution'); + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); + $stateProvider + .state('execution', { + url: '/execution', + templateUrl: 'templates/execution.html', + controller: 'executionController', + controllerAs: 'c' + }) + .state('workspace', { + url: '/workspace', + templateUrl: 'templates/workspace.html', + controller: 'workspaceController', + controllerAs: 'c' + }) + .state('history', { + url: '/history', + templateUrl: 'templates/history.html', + controller: 'historyController', + controllerAs: 'c' + }); + }); + app.zephyr.service('APIEndPoint', app.services.APIEndPoint); + app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); + app.zephyr.controller('executionController', app.controllers.Execution); + app.zephyr.controller('workspaceController', app.controllers.Workspace); + app.zephyr.controller('historyController', app.controllers.History); + app.zephyr.controller('commandController', app.directives.CommandController); + app.zephyr.controller('optionController', app.directives.OptionController); + app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); + app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); + app.zephyr.directive('command', app.directives.Command.Factory()); + app.zephyr.directive('option', app.directives.Option.Factory()); + app.zephyr.directive('directory', app.directives.Directory.Factory()); + })(app || (app = {})); + + +/***/ }, +/* 17 */ +/***/ function(module, exports) { + + var app; + (function (app) { + var declares; + (function (declares) { + var CommandInfo = (function () { + function CommandInfo(name) { + this.name = name; + } + return CommandInfo; + })(); + declares.CommandInfo = CommandInfo; + })(declares = app.declares || (app.declares = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var APIEndPoint = (function () { + function APIEndPoint($resource, $http) { + this.$resource = $resource; + this.$http = $http; + } + APIEndPoint.prototype.resource = function (endPoint, data) { + var customAction = { + method: 'GET', + isArray: false + }; + 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/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -43326,6 +47368,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -43335,6 +47385,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -43361,6 +47419,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -43368,6 +47441,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -43396,12 +47543,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -43412,11 +47564,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -43451,7 +47615,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -43470,11 +47637,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -43489,6 +47675,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -43499,6 +47688,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -43621,7 +47824,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -43644,9 +47853,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -43664,7 +47874,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -43686,6 +47899,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -43717,12 +47999,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -43731,7 +48019,7 @@ /***/ }, -/* 14 */ +/* 18 */ /***/ function(module, exports) { var app; @@ -43768,7 +48056,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -43782,6 +48070,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -43791,6 +48087,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -43817,6 +48121,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -43824,6 +48143,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -43852,12 +48245,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -43868,11 +48266,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -43907,7 +48317,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -43926,11 +48339,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); + }; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -43945,6 +48377,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -43955,6 +48390,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -44077,7 +48526,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -44100,9 +48555,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -44120,7 +48576,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -44142,6 +48601,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -44173,12 +48701,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -44187,7 +48721,7 @@ /***/ }, -/* 15 */ +/* 19 */ /***/ function(module, exports) { var app; @@ -44224,7 +48758,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -44238,6 +48772,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -44247,6 +48789,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -44273,6 +48823,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -44280,6 +48845,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -44308,12 +48947,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -44324,11 +48968,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -44363,7 +49019,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -44382,11 +49041,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -44401,6 +49079,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -44411,6 +49092,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -44533,7 +49228,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -44556,9 +49257,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -44576,7 +49278,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -44598,6 +49303,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -44629,12 +49403,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -44643,7 +49423,7 @@ /***/ }, -/* 16 */ +/* 20 */ /***/ function(module, exports) { var app; @@ -44680,7 +49460,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -44694,6 +49474,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -44703,6 +49491,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -44729,6 +49525,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -44736,6 +49547,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -44764,12 +49649,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -44780,11 +49670,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -44819,7 +49721,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -44838,11 +49743,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -44857,6 +49781,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -44867,6 +49794,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -44989,7 +49930,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -45012,9 +49959,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -45032,7 +49980,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -45054,6 +50005,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -45085,12 +50105,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -45099,7 +50125,7 @@ /***/ }, -/* 17 */ +/* 21 */ /***/ function(module, exports) { var app; @@ -45136,7 +50162,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -45150,6 +50176,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -45159,6 +50193,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -45185,6 +50227,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -45192,6 +50249,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -45220,12 +50351,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -45236,11 +50372,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -45275,7 +50423,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -45294,11 +50445,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -45313,6 +50483,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -45323,6 +50496,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -45445,7 +50632,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -45468,9 +50661,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -45488,7 +50682,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -45510,6 +50707,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -45541,12 +50807,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory()); @@ -45555,7 +50827,7 @@ /***/ }, -/* 18 */ +/* 22 */ /***/ function(module, exports) { var app; @@ -45592,7 +50864,7 @@ return this.$resource(endPoint, {}, { execute: execute }); }; APIEndPoint.prototype.getOptionControlFile = function (command) { - var endPoint = '/api/optionControlFile/' + command; + var endPoint = '/api/v1/optionControlFile/' + command; return this.resource(endPoint, {}).get(); }; APIEndPoint.prototype.getFiles = function (fileId) { @@ -45606,6 +50878,14 @@ var endPoint = '/api/v1/all/workspace/directory'; return this.resource(endPoint, {}).get(); }; + APIEndPoint.prototype.getTags = function () { + var endPoint = '/api/v1/tagList'; + return this.resource(endPoint, {}).get(); + }; + APIEndPoint.prototype.getCommands = function () { + var endPoint = '/api/v1/commandList'; + return this.resource(endPoint, {}).get(); + }; APIEndPoint.prototype.execute = function (data) { var endPoint = '/api/v1/execution'; var fd = new FormData(); @@ -45615,6 +50895,14 @@ transformRequest: angular.identity }); }; + APIEndPoint.prototype.debug = function () { + var endPoint = '/api/v1/debug'; + return this.$http.get(endPoint); + }; + APIEndPoint.prototype.help = function (command) { + var endPoint = '/api/v1/help/' + command; + return this.$http.get(endPoint); + }; return APIEndPoint; })(); services.APIEndPoint = APIEndPoint; @@ -45641,6 +50929,21 @@ } return this.$uibModal.open(this.modalOption); }; + MyModal.prototype.selectCommand = function () { + this.modalOption.templateUrl = 'templates/select-command.html'; + this.modalOption.controller = 'selectCommandController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.prototype.preview = function () { + this.modalOption.templateUrl = 'templates/preview.html'; + this.modalOption.controller = 'previewController'; + this.modalOption.controllerAs = 'c'; + this.modalOption.size = 'lg'; + return this.$uibModal.open(this.modalOption); + }; + MyModal.$inject = ['$uibModal']; return MyModal; })(); services.MyModal = MyModal; @@ -45648,6 +50951,80 @@ })(app || (app = {})); var app; (function (app) { + var services; + (function (services) { + var WebSocket = (function () { + function WebSocket($rootScope) { + this.$rootScope = $rootScope; + this.socket = io.connect(); + } + WebSocket.prototype.on = function (eventName, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + socket.on(eventName, function () { + var args = arguments; + rootScope.$apply(function () { + callback.apply(socket, args); + }); + }); + }; + WebSocket.prototype.emit = function (eventName, data, callback) { + var socket = this.socket; + var rootScope = this.$rootScope; + this.socket.emit(eventName, data, function () { + var args = arguments; + rootScope.$apply(function () { + if (callback) + callback.apply(socket, args); + }); + }); + }; + return WebSocket; + })(); + services.WebSocket = WebSocket; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { + var services; + (function (services) { + var Console = (function () { + function Console(WebSocket, $rootScope) { + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.WebSocket = WebSocket; + this.$rootScope = $rootScope; + this.directiveIDs = []; + var directiveIDs = this.directiveIDs; + this.WebSocket.on('console', function (d) { + var id = d.id; + var message = d.message; + if (directiveIDs.indexOf(id) > -1) { + $rootScope.$emit(id, message); + } + }); + } + Console.prototype.addDirective = function (id) { + if (!(this.directiveIDs.indexOf(id) > -1)) { + this.directiveIDs.push(id); + } + }; + Console.prototype.removeDirective = function (id) { + var i = this.directiveIDs.indexOf(id); + if (i > -1) { + this.directiveIDs.splice(i, 1); + } + }; + Console.prototype.showIDs = function () { + console.log(this.directiveIDs); + }; + return Console; + })(); + services.Console = Console; + })(services = app.services || (app.services = {})); + })(app || (app = {})); + var app; + (function (app) { var directives; (function (directives) { var Command = (function () { @@ -45676,12 +51053,17 @@ })(); directives.Command = Command; var CommandController = (function () { - function CommandController(APIEndPoint, $scope) { + function CommandController(APIEndPoint, $scope, MyModal, WebSocket, $window, $rootScope, Console) { this.APIEndPoint = APIEndPoint; this.$scope = $scope; + this.MyModal = MyModal; + this.WebSocket = WebSocket; + this.$window = $window; + this.$rootScope = $rootScope; + this.Console = Console; var controller = this; this.APIEndPoint - .getOptionControlFile('dcdFilePrint') + .getOptionControlFile(this.name) .$promise .then(function (result) { controller.options = result.info; @@ -45692,11 +51074,23 @@ .then(function (result) { controller.dirs = result.info; }); - this.heading = "[" + this.index + "]: dcdFilePring"; + this.heading = "[" + this.index + "]: dcdFilePrint"; this.isOpen = true; this.$scope.$on('close', function () { controller.isOpen = false; }); + function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + } + this.uuid = guid(); + this.Console.addDirective(this.uuid); + this.Console.showIDs(); } CommandController.prototype.submit = function () { var opt = []; @@ -45731,7 +51125,10 @@ }); }; CommandController.prototype.removeMySelf = function (index) { + this.$scope.$destroy(); + this.Console.removeDirective(this.uuid); this.remove()(index, this.list); + this.Console.showIDs(); }; CommandController.prototype.reloadFiles = function () { var _this = this; @@ -45750,11 +51147,30 @@ }); }; CommandController.prototype.debug = function () { - console.log(this.files); - console.log(this.files); - console.log(this.workspace); + var div = angular.element(this.$window.document).find("div"); + var consoleTag; + var parametersTag; + angular.forEach(div, function (v) { + if (v.className === "panel-body console") { + consoleTag = v; + } + else if (v.className === "row parameters-console") { + parametersTag = v; + } + }); + var consoleHeight = parseInt(parametersTag.clientHeight.toString().replace('px', '')) - 150 + 'px'; + var consoleWidth = parseInt(parametersTag.clientWidth.toString().replace('px', '')) / 3 * 2 - 150 + 'px'; + consoleTag.style.height = consoleHeight; + consoleTag.style.width = consoleWidth; + }; + CommandController.prototype.help = function () { + this.APIEndPoint + .help(this.name) + .then(function (result) { + console.log(result); + }); }; - CommandController.$inject = ['APIEndPoint', '$scope']; + CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket', '$window', '$rootScope', 'Console']; return CommandController; })(); directives.CommandController = CommandController; @@ -45769,6 +51185,9 @@ this.restrict = 'E'; this.replace = true; this.templateUrl = 'templates/header-menu.html'; + this.controller = 'HeaderMenuController'; + this.controllerAs = 'hmc'; + this.scope = true; } HeaderMenu.Factory = function () { var directive = function () { @@ -45779,6 +51198,20 @@ return HeaderMenu; })(); directives.HeaderMenu = HeaderMenu; + var HeaderMenuController = (function () { + function HeaderMenuController($state) { + this.$state = $state; + this.isExecution = this.$state.current.name === 'execution'; + this.isWorkspace = this.$state.current.name === 'workspace'; + this.isHistory = this.$state.current.name === 'history'; + } + HeaderMenuController.prototype.transit = function (state) { + this.$state.go(state); + }; + HeaderMenuController.$inject = ['$state']; + return HeaderMenuController; + })(); + directives.HeaderMenuController = HeaderMenuController; })(directives = app.directives || (app.directives = {})); })(app || (app = {})); var app; @@ -45901,7 +51334,13 @@ ; Execution.prototype.add = function () { this.$scope.$broadcast('close'); - this.commandInfoList.push(new app.declares.CommandInfo('dcdFilePrint')); + var commandInfoList = this.commandInfoList; + var commandInstance = this.MyModal.selectCommand(); + commandInstance + .result + .then(function (command) { + commandInfoList.push(new app.declares.CommandInfo(command)); + }); }; Execution.prototype.open = function () { var result = this.MyModal.open('SelectCommand'); @@ -45924,9 +51363,10 @@ var controllers; (function (controllers) { var Workspace = (function () { - function Workspace($scope, APIEndPoint) { + function Workspace($scope, APIEndPoint, MyModal) { this.$scope = $scope; this.APIEndPoint = APIEndPoint; + this.MyModal = MyModal; this.directoryList = []; var controller = this; var directoryList = this.directoryList; @@ -45944,7 +51384,10 @@ Workspace.prototype.addDirectory = function (info, directoryList) { directoryList.push(info); }; - Workspace.$inject = ['$scope', 'APIEndPoint']; + Workspace.prototype.debug = function () { + this.MyModal.preview(); + }; + Workspace.$inject = ['$scope', 'APIEndPoint', 'MyModal']; return Workspace; })(); controllers.Workspace = Workspace; @@ -45966,6 +51409,75 @@ })(app || (app = {})); var app; (function (app) { + var controllers; + (function (controllers) { + var SelectCommand = (function () { + function SelectCommand($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + this.APIEndPoint + .getTags() + .$promise.then(function (result) { + controller.tags = result.info; + }); + this.APIEndPoint + .getCommands() + .$promise.then(function (result) { + controller.commands = result.info; + }); + this.currentTag = 'all'; + } + SelectCommand.prototype.changeTag = function (tag) { + this.currentTag = tag; + }; + SelectCommand.prototype.selectCommand = function (command) { + this.$modalInstance.close(command); + }; + SelectCommand.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return SelectCommand; + })(); + controllers.SelectCommand = SelectCommand; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var app; + (function (app) { + var controllers; + (function (controllers) { + var Preview = (function () { + function Preview($scope, APIEndPoint, $modalInstance) { + this.APIEndPoint = APIEndPoint; + this.$modalInstance = $modalInstance; + var controller = this; + console.log('preview'); + } + Preview.$inject = ['$scope', 'APIEndPoint', '$uibModalInstance']; + return Preview; + })(); + controllers.Preview = Preview; + })(controllers = app.controllers || (app.controllers = {})); + })(app || (app = {})); + var filters; + (function (filters) { + function Tag() { + return function (commands, tag) { + var result = []; + angular.forEach(commands, function (command) { + var flag = false; + angular.forEach(command.tags, function (value) { + if (tag === value) + flag = true; + }); + if (flag) + result.push(command); + }); + return result; + }; + } + filters.Tag = Tag; + })(filters || (filters = {})); + var app; + (function (app) { 'use strict'; var appName = 'zephyr'; app.zephyr = angular.module(appName, ['ui.router', 'ngResource', 'ui.bootstrap']); @@ -45997,12 +51509,18 @@ }); app.zephyr.service('APIEndPoint', app.services.APIEndPoint); app.zephyr.service('MyModal', app.services.MyModal); + app.zephyr.service('WebSocket', app.services.WebSocket); + app.zephyr.service('Console', app.services.Console); + app.zephyr.filter('Tag', filters.Tag); + app.zephyr.controller('selectCommandController', app.controllers.SelectCommand); + app.zephyr.controller('previewController', app.controllers.Preview); app.zephyr.controller('executionController', app.controllers.Execution); app.zephyr.controller('workspaceController', app.controllers.Workspace); app.zephyr.controller('historyController', app.controllers.History); app.zephyr.controller('commandController', app.directives.CommandController); app.zephyr.controller('optionController', app.directives.OptionController); app.zephyr.controller('directoryController', app.directives.DirectoryController); + app.zephyr.controller('HeaderMenuController', app.directives.HeaderMenuController); app.zephyr.directive('headerMenu', app.directives.HeaderMenu.Factory()); app.zephyr.directive('command', app.directives.Command.Factory()); app.zephyr.directive('option', app.directives.Option.Factory());