From eb76b4161aab7a251e447d61b24349d2a4c335d3 Mon Sep 17 00:00:00 2001 From: srikanthv02 Date: Thu, 8 Dec 2016 09:06:04 +0530 Subject: [PATCH 001/110] Task Schedule issue resolved --- .../workzone/orchestration/popups/newTask.html | 6 +++--- .../workzone/orchestration/popups/newTaskCtrl.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html index fb1d95101..49f7313a8 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html @@ -298,7 +298,7 @@
Chef Server Details for - RLChefServer
@@ -387,7 +387,7 @@
Jenkins
@@ -531,7 +531,7 @@
Script Details
diff --git a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js index 319a81705..20869689f 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js @@ -241,8 +241,12 @@ } }, selectTaskCheckbox: function(){ - $scope.showAddTask = true; $scope.isEventAvailable = false; + if($scope._isEventSelected.flag) { + $scope.showAddTask = true; + } else { + $scope.showAddTask = false; + } }, addTaskEvent : function() { $modal.open({ @@ -268,7 +272,7 @@ selectedDayOfTheMonth = $scope.chefJenkScriptTaskObj.selectedDayOfTheMonth; selectedMonth = $scope.chefJenkScriptTaskObj.monthOfYear; $scope.type = 'edit'; - $scope._isEventSelected = true; + //$scope._isEventSelected = true; $scope.repeatPattern = 'Repeat Every -' + $scope.chefJenkScriptTaskObj.repeats; $scope.cronDetails = { @@ -493,6 +497,9 @@ $scope.isExecution = { flag: 'PARALLEL' }; + $scope._isEventSelected = { + flag: false + }; /*in backend at the time of edit of task the jobResultUrlPattern was going as null. So there was in issue with the links disappearing.*/ $scope.jobResultURLPattern = []; From 44aeb075f58f2b2dd7790250d3bd302c5925b3e4 Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Thu, 15 Dec 2016 16:42:28 +0530 Subject: [PATCH 002/110] New changes for Bots --- client/cat3/main.html | 2 +- .../bots/controller/botExecutionLogsCtrl.js | 24 + .../dashboard/bots/controller/chefLogCtrl.js | 244 ++++++++ .../bots/controller/editParamsCtrl.js | 101 +++- .../bots/controller/jenkinsLogCtrl.js | 94 ++++ .../dashboard/bots/controller/libraryCtrl.js | 523 ++++++++++++++---- .../dashboard/bots/view/botExecutionLogs.html | 35 ++ .../dashboard/bots/view/botHistory.html | 44 ++ .../sections/dashboard/bots/view/botInfo.html | 12 +- .../sections/dashboard/bots/view/chefLog.html | 30 + .../dashboard/bots/view/jenkinsLog.html | 6 + .../sections/dashboard/bots/view/library.html | 5 +- .../sections/dashboard/genericServices.js | 20 +- .../blueprint/popups/blueprintLaunchCtrl.js | 7 +- .../popups/blueprintLaunchParamsCtrl.js | 21 +- .../orchestration/orchestrationCtrl.js | 2 + server/app/model/bots/bots.js | 2 +- server/app/routes/v1.0/routes_bots.js | 2 + server/app/services/blueprintService.js | 2 +- server/app/services/botsService.js | 8 +- server/app/services/taskService.js | 2 +- 21 files changed, 1022 insertions(+), 164 deletions(-) create mode 100644 client/cat3/src/partials/sections/dashboard/bots/controller/botExecutionLogsCtrl.js create mode 100644 client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js create mode 100644 client/cat3/src/partials/sections/dashboard/bots/controller/jenkinsLogCtrl.js create mode 100644 client/cat3/src/partials/sections/dashboard/bots/view/botExecutionLogs.html create mode 100644 client/cat3/src/partials/sections/dashboard/bots/view/botHistory.html create mode 100644 client/cat3/src/partials/sections/dashboard/bots/view/chefLog.html create mode 100644 client/cat3/src/partials/sections/dashboard/bots/view/jenkinsLog.html diff --git a/client/cat3/main.html b/client/cat3/main.html index da9406da0..95f0d02cc 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -111,9 +111,9 @@ - + diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/botExecutionLogsCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/botExecutionLogsCtrl.js new file mode 100644 index 000000000..6748b5692 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/botExecutionLogsCtrl.js @@ -0,0 +1,24 @@ +/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited + * Proprietary and confidential + * Written by Relevance UI Team, + * Aug 2015 + */ + +(function (angular) { + "use strict"; + angular.module('dashboard.bots') + .controller('botExecutionLogsCtrl', ['$q', '$scope', '$timeout', 'items', function ($q, $scope, $timeout, items) { + console.log(items); + $scope.parentItemDetail=items; + var botExecLogCtrl={}; + botExecLogCtrl.taskLogType=items.taskType; + botExecLogCtrl.cancelAll=function(){ + $scope.$broadcast ('closeWindow'); + $modalInstance.dismiss('cancel'); + return $scope.close; + }; + return botExecLogCtrl; + } + ]); +})(angular); diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js new file mode 100644 index 000000000..c92bb6ed2 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js @@ -0,0 +1,244 @@ +/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited + * Proprietary and confidential + * Written by Relevance UI Team, + * Aug 2015 + */ + +(function (angular) { + "use strict"; + angular.module('dashboard.bots') + .controller('chefLogCtrl', ['$q', '$scope', 'workzoneServices', '$timeout', 'orchestrationSetting', function ($q, $scope, workzoneServices, $timeout, orchestrationSetting) { + /*This controller can be invoked from either of two flows - Chef Log History Item Logs OR Chef Task Execute + items object will contain only taskId and historyId. */ + //var items = $scope.parentItemDetail; + $scope.isInstanceListLoading = true; + angular.extend($scope, { + logListInitial: [], + logListDelta: [], + cancel: function () { + helper.stopPolling(); + } + }); + // broadcast the cancel function to the parent controller + $scope.$on('closeWindow', function() { + $scope.$parent.close = $scope.cancel(); + }); + var chefLogData = { + chefHistoryItem: {}, + nodeIdsWithActionLog: {} + }; + var timerObject; + var helper = { + lastTimeStamp: '', + getlastTimeStamp: function (logObj) { + if (logObj instanceof Array && logObj.length) { + var lastTime = logObj[logObj.length - 1].timestamp; + return lastTime; + } + }, + scrollBottom : function () { + $timeout(function () { + var elm = angular.element(".logsArea"); + elm.scrollTop(elm[0].scrollHeight); + }, 100); + }, + /*logsPolling: function () { + timerObject = $timeout(function () { + workzoneServices.getChefJobLogs($scope.selectedInstance.nodeId, $scope.selectedInstance.actionLogId, helper.lastTimeStamp).then(function (resp) { + if (resp.data.length) { + var logData = { + logs: resp.data, + fullLogs: false + }; + helper.lastTimeStamp = helper.getlastTimeStamp(logData.logs); + $scope.logListDelta.push.apply($scope.logListDelta, logData.logs); + helper.scrollBottom(); + } + helper.logsPolling(); + }); + }, orchestrationSetting.orchestrationLogsPollerInterval); + },*/ + stopPolling: function () { + $timeout.cancel(timerObject); + } + }; + var selectFirstInstance = function (firstInstance) { + $scope.selectedInstance = firstInstance; + chefLogData.instanceChange(); + }; + var resetAll = function(){ + $scope.isInstanceListLoading = true; + chefLogData.chefHistoryItem = {}; + chefLogData.nodeIdsWithActionLog = {}; + helper.stopPolling(); //Ensuring polling is stopped, eventhough the scope values for instance id and actionlog id are updated on change + helper.lastTimeStamp = ''; + }; + var init = function () { + //get the details of one chef history entry + var param = { + url = '/bots/' + botId + '/history/' + historyId; + } + genSevs.promiseGet(param).then(function (response) { + console.log(response); + chefLogData.createInstanceList(response.data); + //$modalInstance.close(response.data); + //$rootScope.$emit('BOTS_LIBRARY_REFRESH'); + //helper.botLogModal(items._id, response.historyId, response.taskType); + }; + /*workzoneServices.getTaskHistoryItem(items.taskId, items.historyId).then(function (response) { + chefLogData.createInstanceList(response.data); + });*/ + }; + //method to get the names of the nodes associated to the job and add it to the nodeIdsWithActionLog object. + chefLogData.createInstanceList = function (historyItem) { + var nodeIds = []; + var bluePrintJob = false; //flag for blueprint job + var bluePrintActionLogs = []; + var nodeIdWithActionLogs = []; + // if blueprint job, use blueprintExecutionResults + if (historyItem.blueprintExecutionResults && historyItem.blueprintExecutionResults[0].result) { + bluePrintJob = true; + bluePrintActionLogs = historyItem.blueprintExecutionResults[0].result; + for (var j = 0; j < bluePrintActionLogs.length; j++) { + nodeIds.push(bluePrintActionLogs[j].instanceId); + } + } else { // if not blueprint job, use nodeIds + nodeIds = historyItem.nodeIds; + } + var requestObj = { + "instanceIds": nodeIds + }; + workzoneServices.postRetrieveDetailsForInstanceNames(requestObj).then(function (response) { + var _jobInstances = response.data; + //if blueprint job, use blueprintExecutionResults + if (bluePrintJob) { + for (var i = 0; i < bluePrintActionLogs.length; i++) { + bluePrintActionLogs[i].nodeId = bluePrintActionLogs[i].instanceId; + for (var j = 0; j < _jobInstances.length; j++) { + if (bluePrintActionLogs[i].instanceId === _jobInstances[j]._id) { + bluePrintActionLogs[i].uiNodeName = _jobInstances[j].name; + } + } + } + nodeIdWithActionLogs = bluePrintActionLogs; + } else {//if not blueprint job, use nodeIdsWithActionLog + for (var k = 0; k < historyItem.nodeIdsWithActionLog.length; k++) { + for (var l = 0; l < _jobInstances.length; l++) { + if (historyItem.nodeIdsWithActionLog[k].nodeId === _jobInstances[l]._id) { + historyItem.nodeIdsWithActionLog[k].uiNodeName = _jobInstances[l].name; + } + } + } + nodeIdWithActionLogs = historyItem.nodeIdsWithActionLog; + } + chefLogData.chefHistoryItem = historyItem; //saved as we need timestamps from the historyItem + chefLogData.nodeIdsWithActionLog = nodeIdWithActionLogs; //this can now be used to show instance dropdown + if (chefLogData.nodeIdsWithActionLog[0]) { + $scope.isInstanceListLoading = false; + selectFirstInstance(chefLogData.nodeIdsWithActionLog[0]); + } + }, + function (error) { + $scope.isInstanceListLoading = false; + console.log(error); + $scope.errorMessage = ""; + }); + }; + //method called when user changes the instance name from the dropdown. + chefLogData.instanceChange = function () { + $scope.isLogsLoading = true; + helper.stopPolling(); //Ensuring polling is stopped, eventhough the scope values for instance id and actionlog id are updated on change + helper.lastTimeStamp = ''; + /* when task is completed, with success or failed: + - both timestampStarted and timestampEnded will be present + - we get full logs, no need to poll + */ + if (chefLogData.chefHistoryItem.timestampStarted && chefLogData.chefHistoryItem.timestampEnded) { + var urlParams = ''; + if (timestamp) { + urlParams = 'timestamp=' + timestamp; + } + if(timestamp && timestampEnded) { + urlParams = 'timestamp=' + timestamp + '×tampEnded=' + timestampEnded; + } + var param = { + url = "/instances/" + instanceId + '/actionLogs/' + actionId + + '/logs?' + urlParams; + } + genSevs.promiseGet(param).then(function (response) { + $scope.isLogsLoading = false; + var logData = { + logs: response.data, + fullLogs: true + }; + $scope.logListInitial = logData.logs; + helper.scrollBottom(); + }; + /*workzoneServices.getChefJobLogs($scope.selectedInstance.nodeId, $scope.selectedInstance.actionLogId, chefLogData.chefHistoryItem.timestampStarted, chefLogData.chefHistoryItem.timestampEnded).then(function (response) { + $scope.isLogsLoading = false; + var logData = { + logs: response.data, + fullLogs: true + }; + $scope.logListInitial = logData.logs; + helper.scrollBottom(); + }, function (error) { + $scope.isLogsLoading = false; + console.log(error); + $scope.errorMessage = "Unable to fetch logs for this instance"; + });*/ + } + /* when task is pending or running: ie. during Execute flow or if history is viewed immediately after Execute + - only timestampStarted will be present. timestampEnded will be absent + - we need to poll for further logs + */ + else if (chefLogData.chefHistoryItem.timestampStarted && !chefLogData.chefHistoryItem.timestampEnded) { + var urlParams = ''; + if (timestamp) { + urlParams = 'timestamp=' + timestamp; + } + if(timestamp && timestampEnded) { + urlParams = 'timestamp=' + timestamp + '×tampEnded=' + timestampEnded; + } + var param = { + url = "/instances/" + instanceId + '/actionLogs/' + actionId + + '/logs?' + urlParams; + } + genSevs.promiseGet(param).then(function (response) { + $scope.isLogsLoading = false; + var logData = { + logs: response.data, + fullLogs: true + }; + $scope.logListInitial = logData.logs; + helper.scrollBottom(); + }; + /*workzoneServices.getChefJobLogs($scope.selectedInstance.nodeId, $scope.selectedInstance.actionLogId, chefLogData.chefHistoryItem.timestampStarted).then(function (response) { + $scope.isLogsLoading = false; + helper.lastTimeStamp = helper.getlastTimeStamp(response.data) || chefLogData.chefHistoryItem.timestampStarted; + helper.logsPolling(); + var logData = { + logs: response.data, + fullLogs: true + }; + $scope.logListInitial = logData.logs; + helper.scrollBottom(); + }, function (error) { + $scope.isLogsLoading = false; + console.log(error); + $scope.errorMessage = "Unable to fetch logs for this instance"; + });*/ + } + }; + init(); + // on task change event in the parent controller + $scope.$on('parentChangeCompTask', function (event, args) { + items = args; + resetAll(); + init(); + }); + return chefLogData; + } + ]); +})(angular); diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js index 29be3d631..b6822c1fd 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js @@ -8,9 +8,10 @@ (function (angular) { "use strict"; angular.module('library.params', []) - .controller('editParamsCtrl',['$scope', '$rootScope', 'genericServices', 'workzoneServices', 'toastr', '$modalInstance', 'items', 'responseFormatter', function ($scope, $rootScope, genSevs, workzoneServices, toastr, $modalInstance, items, responseFormatter) { - $scope.botName = items.name; - $scope.taskType = items.taskType; + .controller('editParamsCtrl',['$scope', '$rootScope', 'genericServices', 'workzoneServices', 'toastr', '$modalInstance', 'items', 'responseFormatter', '$modal', function ($scope, $rootScope, genSevs, workzoneServices, toastr, $modalInstance, items, responseFormatter, $modal) { + console.log(items); + $scope.botName = items.botName; + $scope.taskType = items.botLinkedSubCategory; $scope.taggingServerList=[]; $scope.envOptions=[]; workzoneServices.getTaggingServer().then(function (topSer) { @@ -18,23 +19,23 @@ }); $scope.chefAttributesFlag = false; $scope.scriptParamsFlag = false; - if(items.taskConfig.runlist && items.taskConfig.runlist.length) { + if(items.botConfig && items.botConfig.runlist && items.botConfig.runlist.length) { $scope.chefAttributesFlag = true; } - if(items.taskType === 'script') { - for (var i=0; i 0) { + if(items.botLinkedSubCategory === 'script' && items.botConfig) { + for (var i=0; i 0) { $scope.scriptParamsFlag = true; } } } $scope.isChefattributesLoading = true; - if (items.taskType === 'chef') { - $scope.chefComponentSelectorList = responseFormatter.findDataForEditValue(items.taskConfig.runlist); + if (items.botLinkedSubCategory === 'chef' && items.botConfig) { + $scope.chefComponentSelectorList = responseFormatter.findDataForEditValue(items.botConfig.runlist); var nodesList = responseFormatter.chefRunlistFormatter($scope.chefComponentSelectorList); $scope.chefattributes = []; - $scope.chefattributes = responseFormatter.formatSavedCookbookAttributes(items.taskConfig.attributes); - workzoneServices.getCookBookListForOrg(items.orgId).then(function(data){ + $scope.chefattributes = responseFormatter.formatSavedCookbookAttributes(items.botConfig.attributes); + workzoneServices.getCookBookListForOrg(items.masterDetails.orgId).then(function(data){ var runlist = []; for (var i = 0; i < nodesList.length; i++) { if (nodesList[i].className === "cookbook" || nodesList[i].className === "deploy") { @@ -67,14 +68,37 @@ } }); } - - $scope.jenkinsparams = items.taskConfig.parameterized; - $scope.scriptparams = items.taskConfig.scriptDetails; + if (items.botConfig) { + $scope.jenkinsparams = items.botConfig.parameterized; + $scope.scriptparams = items.botConfig.scriptDetails; + } $scope.parameters=['']; var cookbookAttributes = []; var scriptParams = []; var choiceParam = {}; $scope.jenparams = {}; + + var helper = { + botLogModal: function(id,historyId,taskType) { + $modal.open({ + animation: true, + templateUrl: 'src/partials/sections/dashboard/bots/view/botExecutionLogs.html', + controller: 'botExecutionLogsCtrl as botExecLogCtrl', + backdrop: 'static', + keyboard: false, + resolve: { + items: function() { + return { + taskId: id, + historyId: historyId, + taskType: taskType + }; + } + } + }); + } + }; + $scope.add = function() { $scope.parameters.push(''); }; @@ -89,7 +113,7 @@ }; $scope.executeBot=function(){ - if (items.taskConfig.taskType === 'script') { + if (items.botConfig && items.botConfig.botLinkedSubCategory === 'script') { var checkParam = false; if ($scope.scriptParamsFlag) { for(var i =0; i<$scope.parameters.length; i++){ @@ -106,32 +130,50 @@ scriptParams = $scope.parameters; } } - if (items.taskConfig.taskType === 'chef') { + if (items.botConfig && items.botConfig.botLinkedSubCategory === 'chef') { cookbookAttributes = responseFormatter.formatSelectedCookbookAttributes($scope.chefattributes); } - if (items.taskConfig.taskType === 'jenkins') { + if (items.botConfig && items.botConfig.botLinkedSubCategory === 'jenkins') { choiceParam = $scope.jenparams; } - $scope.executeTask(); + $scope.executeBot(); }; - $scope.executeTask = function(){ + $scope.executeBot = function(){ var reqBody = {}; - if (items.taskConfig.taskType === 'jenkins') { + if (items.botConfig && items.botConfig.botLinkedSubCategory === 'jenkins') { reqBody.choiceParam = choiceParam; - } else if (items.taskConfig.taskType === 'chef'){ + } else if (items.botConfig && items.botConfig.botLinkedSubCategory === 'chef'){ reqBody.tagServer = $scope.tagSerSelected; if ($scope.chefAttributesFlag) { reqBody.cookbookAttributes = cookbookAttributes; } - } else if (items.taskConfig.taskType === 'script') { + } else if (items.botConfig && items.botConfig.botLinkedSubCategory === 'script') { reqBody.tagServer = $scope.tagSerSelected; if ($scope.scriptParamsFlag) { reqBody.scriptParams = scriptParams; } } - workzoneServices.runTask(items._id, reqBody).then( + var param={ + url:'/bots/' + items.botId + '/execute', + data: reqBody + }; + genSevs.promisePost(param).then(function (response) { + console.log(response); + $modalInstance.close(response.data); + $rootScope.$emit('BOTS_LIBRARY_REFRESH'); + helper.botLogModal(items._id, response.historyId, response.taskType); + }, + function (error) { + error = error.responseText || error; + if (error.message) { + toastr.error(error.message); + } else { + toastr.error(error); + } + }); + /*workzoneServices.runTask(items._id, reqBody).then( function (response) { $modalInstance.close(response.data); $rootScope.$emit('BOTS_LIBRARY_REFRESH'); @@ -145,11 +187,20 @@ toastr.error(error); } } - ); + );*/ + }; + + $scope.cancel= function() { + $modalInstance.dismiss('cancel'); }; + }])/*.controller('botExecutionLogsCtrl',['$scope', 'items', '$modalInstance', function ($scope, items, $modalInstance) { + $scope.botExecutionLogs = items; + console.log(items); + + $scope.cancel= function() { $modalInstance.dismiss('cancel'); }; - }]); + }])*/; })(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/jenkinsLogCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/jenkinsLogCtrl.js new file mode 100644 index 000000000..de0df9032 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/jenkinsLogCtrl.js @@ -0,0 +1,94 @@ +/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited + * Proprietary and confidential + * Written by Relevance UI Team, + * Aug 2015 + */ + +(function(angular) { + "use strict"; + angular.module('dashboard.bots') + /*.service('orchestrationSetting', [function() { + return { + orchestrationLogsPollerInterval: 5000 + }; + }])*/ + .controller('jenkinsLogCtrl', ['$scope', 'workzoneServices', '$interval', 'orchestrationSetting', '$controller','$timeout', function($scope, workzoneServices, $interval, orchestrationSetting, $controller,$timeout) { + var items = $scope.parentItemDetail; + $scope.getJenkinsHistoryDetails = {}; + angular.extend($scope, { + logs: {}, + timerObject: '', + cancel: function() { + helper.stopPolling(); + } + }); + var resetAll = function(){ + $scope.getJenkinsHistoryDetails = {}; + helper.stopPolling(); + }; + var init = function(){ + workzoneServices.getTaskHistoryItem(items.taskId, items.historyId).then(function(response) { + $scope.getJenkinsHistoryDetails = response.data; //to store the response so that the jenkinsServerID,jobName and buildNumber can be passed to fetch the logs. + $scope.getJenkinsLogDetails(response.data); + }); + }; + var helper = { + eventsPolling: function() { + $scope.timerObject = $interval(function() { + workzoneServices.getJenkinsLogs($scope.getJenkinsHistoryDetails.jenkinsServerId, $scope.getJenkinsHistoryDetails.jobName, $scope.getJenkinsHistoryDetails.buildNumber) + .then(function(response) { + if (response.data) { + $scope.logs.output = helper.formatLogs(response.data.output); + } else { + $scope.logs.output = helper.formatLogs(response.output); + } + + }, function(error) { + $scope.logs = error.data.message; + }); + }, orchestrationSetting.orchestrationLogsPollerInterval); + }, + stopPolling: function() { + $interval.cancel($scope.timerObject); + }, + formatLogs: function(str) { + return str.replace(/\r?\n/g, "
"); + } + }; + $scope.getJenkinsLogDetails = function(historyItem) { + $scope.isJenkinsLogLoading = true; + $timeout(function(){ + workzoneServices.getJenkinsLogs(historyItem.jenkinsServerId, historyItem.jobName, historyItem.buildNumber).then(function(response) { + $scope.isJenkinsLogLoading = false; + if (response.data) { + $scope.logs.output = helper.formatLogs(response.data.output); + } else { + $scope.logs.output = helper.formatLogs(response.output); + } + helper.eventsPolling(); + + }, function(error) { + $scope.isJenkinsLogLoading = false; + $scope.logs = error.data.message; + //removed the error helper method as it was failing. Need to test this part again. + }); + }, 10000); + }; + init(); + // on task change event in the parent controller + $scope.$on('parentChangeCompTask', function (event, args) { + items = args; + resetAll(); + init(); + }); + $scope.$on('$destroy', function() { + $interval.cancel($scope.timerObject); + }); + // broadcast the cancel function to the parent controller + $scope.$on('closeWindow', function() { + $scope.$parent.close = $scope.cancel(); + }); + } + ]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js index cb62431a9..fadbd0720 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js @@ -8,52 +8,131 @@ (function (angular) { "use strict"; angular.module('dashboard.bots') - .controller('libraryCtrl',['$scope', '$rootScope', '$state', 'genericServices', 'confirmbox', 'toastr', 'workzoneUIUtils', '$modal', function ($scope, $rootScope, $state, genSevs, confirmbox, toastr, workzoneUIUtils, $modal) { + .controller('libraryCtrl',['$scope', '$rootScope', '$state', 'genericServices', 'confirmbox', 'toastr', 'workzoneUIUtils', '$modal', 'uiGridOptionsService', '$timeout', function ($scope, $rootScope, $state, genSevs, confirmbox, toastr, workzoneUIUtils, $modal, uiGridOptionsService, $timeout) { var treeNames = ['BOTs','Library']; $rootScope.$emit('treeNameUpdate', treeNames); var lib=this; $scope.totalBotsSelected = true; - lib.gridOptions={ - gridOption:{ - paginationPageSizes: [10, 25, 50, 75], - paginationPageSize: 10, - enableColumnMenus:false, - multiSelect :false, + var botLibraryUIGridDefaults = uiGridOptionsService.options(); + $scope.paginationParams = botLibraryUIGridDefaults.pagination; + $scope.paginationParams=[]; + $scope.paginationParams.sortBy = 'createdOn'; + $scope.paginationParams.sortOrder = 'desc'; + console.log($scope.paginationParams.sortBy); + + $scope.initGrids = function(){ + $scope.botLibGridOptions={}; + $scope.botLibGridOptions.columnDefs= [ + { name:'Task Type', field:'botLinkedSubCategory' ,cellTemplate:'row.entity.taskType'+ + 'row.entity.botLinkedSubCategory'+ + 'row.entity.taskType'+ + 'row.entity.botType',cellTooltip: true}, + { name: 'BOT Type',displayName: 'BOT Type',field:'botLinkedCategory',cellTooltip: true}, + { name: 'BOT Name',displayName: 'BOT Name',field:'botName',cellTooltip: true}, + { name: 'Category',field:'botCategory',cellTooltip: true}, + { name: 'description',field:'botDesc',cellTooltip: true}, + { name: 'Org',field:'masterDetails.orgName',cellTooltip: true}, + { name: 'Total Runs',field:'executionCount'}, + { name: 'BOT History',displayName: 'BOT History',cellTemplate:'NA'+ + ''}, + { name: 'BOT Info',displayName: 'BOT Info',cellTemplate: + ''}, + { name: 'BOT Action',displayName: 'BOT Action',cellTemplate: + '' + + '' + + '' + } + ] + $scope.botLibGridOptions.data=[]; + angular.extend($scope.botLibGridOptions,botLibraryUIGridDefaults.gridOption); + }; + $scope.initGrids(); + /*APIs registered are triggered as ui-grid is configured + for server side(external) pagination.*/ + angular.extend($scope.botLibGridOptions,botLibraryUIGridDefaults.gridOption, { + onRegisterApi :function(gridApi) { + $scope.gridApi = gridApi; + gridApi.core.on.sortChanged($scope, function(grid, sortColumns) { + if (sortColumns[0] && sortColumns[0].field && sortColumns[0].sort && sortColumns[0].sort.direction) { + $scope.paginationParams.sortBy = sortColumns[0].field; + $scope.paginationParams.sortOrder = sortColumns[0].sort.direction; + $scope.botLibraryGridView(); + } + }); + //Pagination for page and pageSize + gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) { + $scope.paginationParams.page = newPage; + $scope.paginationParams.pageSize = pageSize; + $scope.botLibraryGridView(); + }); }, - columnDefs: [ - { name:'Task Type', field:'taskType' ,cellTemplate:'row.entity.taskType'+ - 'row.entity.taskType'+ - 'row.entity.taskType'+ - 'row.entity.botType',cellTooltip: true}, - { name: 'BOT Type',displayName: 'BOT Type',field:'botType',cellTooltip: true}, - { name: 'BOT Name',displayName: 'BOT Name',field:'name',cellTooltip: true}, - { name: 'Category',field:'botCategory',cellTooltip: true}, - { name: 'description',field:'shortDesc',cellTooltip: true}, - { name: 'Total Runs',field:'executionCount'}, - { name: 'BOT History',displayName: 'BOT History',cellTemplate:'NA'+ - ''}, - { name: 'BOT Info',displayName: 'BOT Info',cellTemplate: - ''}, - { name: 'BOT Action',displayName: 'BOT Action',cellTemplate: - '' + - '' + - '' + - '' - } - ], - data:[] + }); + $scope.setPaginationDefaults = function() { + $scope.paginationParams.sortBy = 'createdOn'; + $scope.paginationParams.sortOrder = 'desc'; + /*if($scope.paginationParams.page !== 1){ + $scope.setFirstPageView();//if current page is not 1, then ui grid will trigger a call when set to 1. + }else{ + $scope.botLibraryGridView(); + }*/ + }; + $scope.setPaginationDefaults(); + $scope.botLibraryGridView = function() { + lib.gridOptions=[]; + var param={ + url:'/bots?page=1&pageSize=10&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder + }; + genSevs.promiseGet(param).then(function (result) { + $timeout(function() { + console.log(result); + $scope.botLibGridOptions.totalItems = result.metaData.totalRecords; + $scope.botLibGridOptions.data=result.bots; + }, 100); + $scope.isBotLibraryPageLoading = false; + }, function(error) { + $scope.isBotLibraryPageLoading = false; + console.log(error); + $scope.errorMessage = "No Records found"; + }); }; + $scope.botLibraryGridView(); var gridBottomSpace = 190; $scope.gridHeight = workzoneUIUtils.makeTabScrollable('botLibraryPage') - gridBottomSpace; $scope.launchInstance = function(launch){ - if(launch.launcType === 'task'){ + console.log(launch.botLinkedCategory); + /*if(launch.launcType === 'task'){ genSevs.executeTask(launch); } else if(launch.launcType === 'bp') { - genSevs.lunchBlueprint(launch); + genSevs.launchBlueprint(launch); + }*/ + if(launch.botLinkedCategory === 'Task'){ + genSevs.executeTask(launch); + } else if(launch.botLinkedCategory === 'Blueprint') { + genSevs.launchBlueprint(launch); } }; - $scope.botLogs = function(bot){ + /*$scope.botLogs = function(bot){ genSevs.botHistory(bot); + };*/ + $scope.botHistory=function(bot) { + var modalInstance = $modal.open({ + animation: true, + templateUrl: 'src/partials/sections/dashboard/bots/view/botHistory.html', + controller: 'botHistoryCtrl', + backdrop : 'static', + size: 'lg', + keyboard: false, + resolve: { + items: function() { + return bot; + } + } + }); + modalInstance.result.then(function(selectedItem) { + $scope.selected = selectedItem; + }, function() { + console.log('Modal Dismissed at ' + new Date()); + }); }; $scope.botInfo=function(bot) { var modalInstance = $modal.open({ @@ -114,38 +193,7 @@ console.log('Dismiss time is ' + new Date()); }); }; - $scope.deleteBotTask = function(task) { - var modalOptions = { - closeButtonText: 'Cancel', - actionButtonText: 'Delete', - actionButtonStyle: 'cat-btn-delete', - headerText: 'Delete Bot', - bodyText: 'Are you sure you want to delete this bots?' - }; - confirmbox.showModal({}, modalOptions).then(function() { - var param={ - url:'/tasks/serviceDelivery/' + task._id - }; - genSevs.promiseDelete(param).then(function (response) { - if (response) { - toastr.success('Successfully deleted'); - if($scope.totalBotsSelected) { - lib.init(); - } else if($scope.runningBotsselected) { - $scope.showBotsRunning(); - } else if($scope.failedBotsselected) { - $scope.showFailedBots(); - } else { - lib.init(); - } - lib.summary(); - } - }, function(data) { - toastr.error('error:: ' + data.toString()); - }); - }); - }; - $scope.deleteBotBP = function(blueprint) { + $scope.deleteBot = function(bot) { var modalOptions = { closeButtonText: 'Cancel', actionButtonText: 'Delete', @@ -155,19 +203,19 @@ }; confirmbox.showModal({}, modalOptions).then(function() { var param={ - url:'/blueprints/serviceDelivery/' + blueprint._id + url:'/bots/' + bot.botId }; genSevs.promiseDelete(param).then(function (response) { if (response) { toastr.success('Successfully deleted'); if($scope.totalBotsSelected) { - lib.init(); + $scope.botLibraryGridView(); } else if($scope.runningBotsselected) { $scope.showBotsRunning(); } else if($scope.failedBotsselected) { $scope.showFailedBots(); } else { - lib.init(); + $scope.botLibraryGridView(); } lib.summary(); } @@ -178,14 +226,14 @@ }; $rootScope.$on('BOTS_LIBRARY_REFRESH', function() { lib.summary(); - lib.init(); + $scope.botLibraryGridView(); }); $scope.RefreshBotsLibrary = function() { $scope.totalBotsSelected = true; $scope.runningBotsselected = false; $scope.failedBotsselected = false; lib.summary(); - lib.init(); + $scope.botLibraryGridView(); }; $scope.showBotsRunning = function() { $scope.runningBotsselected = true; @@ -193,12 +241,13 @@ $scope.failedBotsselected = false; lib.gridOptions.data=[]; var param={ - url:'/tasks?serviceDeliveryCheck=true&actionStatus=running' + url:'/bots?actionStatus=running?page=1&pageSize=10&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder }; genSevs.promiseGet(param).then(function (result) { - angular.forEach(result,function (val) { - lib.gridOptions.data.push(val); - }); + $timeout(function() { + $scope.botLibGridOptions.totalItems = result.metaData.totalRecords; + $scope.botLibGridOptions.data=result.bots; + }, 100); }); lib.summary(); }; @@ -208,12 +257,13 @@ $scope.totalBotsSelected = false; lib.gridOptions.data=[]; var param={ - url:'/tasks?serviceDeliveryCheck=true&actionStatus=failed' + url:'/bots?actionStatus=failed?page=1&pageSize=10&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder }; genSevs.promiseGet(param).then(function (result) { - angular.forEach(result,function (val) { - lib.gridOptions.data.push(val); - }); + $timeout(function() { + $scope.botLibGridOptions.totalItems = result.metaData.totalRecords; + $scope.botLibGridOptions.data=result.bots; + }, 100); }); lib.summary(); }; @@ -228,28 +278,6 @@ }); }; lib.summary(); - lib.init =function(){ - lib.gridOptions.data=[]; - var param={ - url:'/blueprints?serviceDeliveryCheck=true' - }; - genSevs.promiseGet(param).then(function (result) { - angular.forEach(result,function (val) { - angular.extend(val,{launcType:'bp'}); - lib.gridOptions.data.push(val); - }); - }); - var param2={ - url:'/tasks?serviceDeliveryCheck=true' - }; - genSevs.promiseGet(param2).then(function (resultTask) { - angular.forEach(resultTask,function (val) { - angular.extend(val,{launcType:'task'}); - lib.gridOptions.data.push(val); - }); - }); - }; - lib.init(); }]).controller('botInfoCtrl',['$scope', 'items', '$modalInstance', function ($scope, items, $modalInstance) { $scope.botInfo = items; console.log(items); @@ -344,5 +372,300 @@ $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; - }]); + }]).controller('botHistoryCtrl',["items", '$scope', '$modalInstance', '$modal', '$timeout', 'uiGridOptionsClient', 'genericServices', 'workzoneServices', + function(items, $scope, $modalInstance, $modal, $timeout, uiGridOptionsClient, genSevs, workzoneServices){ + //UI Grid for chef Task starts + console.log(items); + $scope.botHistory = items; + $scope.botId = items.botId; + $scope.taskHistoryChefData = []; + var gridOptionsChef = uiGridOptionsClient.options().gridOption; + $scope.taskHistoryChefGridOptions = gridOptionsChef; + + $scope.initChefGrids = function(){ + $scope.taskHistoryChefGridOptions.data='taskHistoryChefData'; + $scope.taskHistoryChefGridOptions.columnDefs = [ + { name:'Status',field:'status',cellTemplate:'
{{row.entity.status}}
', cellTooltip: true}, + { name:'Message', field: 'message', + cellTemplate:'{{row.entity.message}}'}, + { name:'User',field:'user',cellTooltip: true}, + { name:'Logs',width: 70, + cellTemplate:'
'},{ name:'Start Time',field:'timestampStarted',cellTemplate:'{{row.entity.timestampStarted | timestampToLocaleTime}}', sort:{ direction: 'desc'}, cellTooltip: true}, + { name:'End Time',field:'timestampEnded',cellTemplate:'{{row.entity.timestampEnded | timestampToLocaleTime}}', cellTooltip: true}, + { name:'Execution Time',cellTemplate:'{{grid.appScope.getExecutionTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins'}, + { name:'Manual Time',cellTemplate: '{{row.entity.manualExecutionTime}} mins', cellTooltip: true}, + { name:'Saved Time',cellTemplate:'{{grid.appScope.getSavedTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins' + + 'NA', cellTooltip: true} + ]; + }; + angular.extend($scope, { + taskHistoryChefListView: function() { + $scope.taskHistoryChefData = []; + /*var param={ + url:'/bots/:$scope.botId/bots-history' + };*/ + workzoneServices.getHistory(items.botId).then(function(response) { + console.log(response); + $timeout(function() { + if(response.data){ + $scope.taskHistoryChefData = response.data; + $scope.ischefTaskHistoryPageLoading = false; + }else if(response){ + $scope.taskHistoryChefData = response; + $scope.ischefTaskHistoryPageLoading = false; + } + },100); + }, function(){ + $scope.errorMessage = "No Chef History Records found"; + $scope.ischefTaskHistoryPageLoading = false; + }); + }, + getExecutionTime: function(endTime, startTime) { + $scope.executionTimeinMS = endTime-startTime; + $scope.executionTime = $scope.executionTimeinMS/(60000); + return +(Math.round($scope.executionTime + "e+1") + "e-1"); + }, + getSavedTime: function(endTime, startTime) { + var executionTime = $scope.getExecutionTime(endTime, startTime); + $scope.savedTime = items.manualExecutionTime-executionTime; + return $scope.savedTime; + } + }); + $scope.initchef = function(){ + $scope.initChefGrids(); + $scope.taskHistoryChefListView(); + $scope.getExecutionTime(); + $scope.getSavedTime(); + }; + //$scope.initchef(); + //UI Grid for chef Task ends + + //UI Grid for jenkins Task starts + $scope.taskHistoryJenkinsData = []; + var gridOptionsJenkins = uiGridOptionsClient.options().gridOption; + $scope.taskHistoryJenkinsGridOptions = gridOptionsJenkins; + + $scope.initJenkinsGrids = function(){ + $scope.taskHistoryJenkinsGridOptions.data='taskHistoryJenkinsData'; + $scope.taskHistoryJenkinsGridOptions.columnDefs = [ + { name:'Job Number',field:'buildNumber',cellTemplate:'{{row.entity.buildNumber}}', sort:{ direction: 'desc'}, cellTooltip: true}, + { name:'Job Output',cellTemplate:'',cellTooltip: true}, + { name:'Log Info',width: 90,cellTemplate:'',cellTooltip: true}, + { name:'Status',field:'status',cellTemplate:'
{{row.entity.status.toUpperCase()}}
'}, + { name:'Start Time',field:'timestampStarted',cellTemplate:'{{row.entity.timestampStarted | timestampToLocaleTime}}',cellTooltip: true}, + { name:'End Time',field:'timestampEnded',cellTemplate:'{{row.entity.timestampEnded | timestampToLocaleTime}}',cellTooltip: true}, + { name:'Execution Time',cellTemplate:'{{grid.appScope.getExecutionTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins'}, + { name:'Manual Time',cellTemplate: '{{row.entity.manualExecutionTime}} mins', cellTooltip: true}, + { name:'Saved Time',cellTemplate:'{{grid.appScope.getSavedTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins' + + 'NA', cellTooltip: true} + ]; + }; + angular.extend($scope, { + taskHistoryJenkinsListView: function() { + $scope.taskHistoryJenkinsData = []; + var param={ + url:'/bots/:$scope.botId/bots-history' + }; + workzoneServices.getHistory(items.botId).then(function(response) { + console.log(response); + $timeout(function() { + if(response.data){ + $scope.taskHistoryJenkinsData = response.data; + $scope.isjenkinsTaskHistoryPageLoading = false; + }else if(response){ + $scope.taskHistoryJenkinsData = response; + $scope.isjenkinsTaskHistoryPageLoading = false; + } + },100); + }, function(){ + $scope.errorMessage = "No Jenkins History Records found"; + $scope.isjenkinsTaskHistoryPageLoading = false; + }); + }, + }); + $scope.initjenkins = function(){ + $scope.initJenkinsGrids(); + $scope.taskHistoryJenkinsListView(); + $scope.getExecutionTime(); + $scope.getSavedTime(); + }; + //$scope.initjenkins(); + //UI Grid for jenkins Task ends + + //UI Grid for script Task starts + $scope.taskHistoryScriptData = []; + var gridOptionsScript = uiGridOptionsClient.options().gridOption; + $scope.taskHistoryScriptGridOptions = gridOptionsScript; + + $scope.initScriptGrids = function(){ + $scope.taskHistoryScriptGridOptions.data='taskHistoryScriptData'; + $scope.taskHistoryScriptGridOptions.columnDefs = [ + { name:'Status',field:'status',cellTemplate:'
{{row.entity.status}}
', cellTooltip: true}, + { name:'Message', field: 'message', + cellTemplate:'{{row.entity.message}}'}, + { name:'User',field:'user',cellTooltip: true}, + { name:'Logs',width: 70, + cellTemplate:'
'}, + { name:'Start Time',field:'timestampStarted',cellTemplate:'{{row.entity.timestampStarted | timestampToLocaleTime}}', sort:{ direction: 'desc'}, cellTooltip: true}, + { name:'End Time',field:'timestampEnded',cellTemplate:'{{row.entity.timestampEnded | timestampToLocaleTime}}', cellTooltip: true}, + { name:'Execution Time',cellTemplate:'{{grid.appScope.getExecutionTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins'}, + { name:'Manual Time',cellTemplate: '{{row.entity.manualExecutionTime}} mins', cellTooltip: true}, + { name:'Saved Time',cellTemplate:'{{grid.appScope.getSavedTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins' + + 'NA', cellTooltip: true} + ]; + }; + angular.extend($scope, { + taskHistoryScriptListView: function() { + $scope.taskHistoryScriptData = []; + /*var param={ + url:'/bots/:$scope.botId/bots-history' + };*/ + workzoneServices.getHistory(items.botId).then(function(response) { + console.log(response); + $timeout(function() { + if(response.data){ + $scope.taskHistoryScriptData = response.data; + $scope.isscriptTaskHistoryPageLoading = false; + }else if(response){ + $scope.taskHistoryScriptData = response; + $scope.isscriptTaskHistoryPageLoading = false; + } + },100); + }, function(){ + $scope.errorMessage = "No Script History Records found"; + $scope.isscriptTaskHistoryPageLoading = false; + }); + }, + }); + $scope.initscript = function(){ + $scope.initScriptGrids(); + $scope.taskHistoryScriptListView(); + $scope.getExecutionTime(); + $scope.getSavedTime(); + }; + //$scope.initscript(); + //UI Grid for script Task ends + + //UI Grid for Blueprint starts + $scope.botHistoryBlueprintData = []; + var gridOptionsScript = uiGridOptionsClient.options().gridOption; + $scope.botHistoryBlueprintGridOptions = gridOptionsScript; + + $scope.initBlueprintGrids = function(){ + $scope.botHistoryBlueprintGridOptions.data='botHistoryBlueprintData'; + $scope.botHistoryBlueprintGridOptions.columnDefs = [ + { name:'Status',field:'status',cellTemplate:'
{{row.entity.status}}
', cellTooltip: true}, + { name:'Message', field: 'message', + cellTemplate:'{{row.entity.message}}'}, + { name:'User',field:'user',cellTooltip: true}, + { name:'Logs',width: 70, + cellTemplate:'
'}, + { name:'Start Time',field:'timestampStarted',cellTemplate:'{{row.entity.timestampStarted | timestampToLocaleTime}}', sort:{ direction: 'desc'}, cellTooltip: true}, + { name:'End Time',field:'timestampEnded',cellTemplate:'{{row.entity.timestampEnded | timestampToLocaleTime}}', cellTooltip: true}, + { name:'Execution Time',cellTemplate:'{{grid.appScope.getExecutionTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins'}, + { name:'Manual Time',cellTemplate: '{{row.entity.manualExecutionTime}} mins', cellTooltip: true}, + { name:'Saved Time',cellTemplate:'{{grid.appScope.getSavedTime(row.entity.timestampEnded,row.entity.timestampStarted)}} mins' + + 'NA', cellTooltip: true} + ]; + }; + angular.extend($scope, { + botHistoryBlueprintListView: function() { + $scope.botHistoryBlueprintData = []; + /*var param={ + url:'/bots/:$scope.botId/bots-history' + };*/ + workzoneServices.getHistory(items.botId).then(function(response) { + console.log(response); + $timeout(function() { + if(response.data){ + $scope.botHistoryBlueprintData = response.data; + $scope.isBlueprintBotHistoryPageLoading = false; + }else if(response){ + $scope.botHistoryBlueprintData = response; + $scope.isBlueprintBotHistoryPageLoading = false; + } + },100); + }, function(){ + $scope.errorMessage = "No Script History Records found"; + $scope.isBlueprintBotHistoryPageLoading = false; + }); + }, + }); + $scope.initblueprint = function(){ + $scope.initBlueprintGrids(); + $scope.botHistoryBlueprintListView(); + $scope.getExecutionTime(); + $scope.getSavedTime(); + }; + //$scope.initblueprint(); + //UI Grid for Blueprint ends + + $scope.bot=items; + switch ($scope.bot.botLinkedSubCategory){ + case 'chef' : + $scope.ischefTaskHistoryPageLoading = true; + $scope.isjenkinsTaskHistoryPageLoading = false; + $scope.iscompositeTaskHistoryPageLoading = false; + $scope.ispuppetTaskHistoryPageLoading = false; + $scope.isscriptTaskHistoryPageLoading = false; + $scope.isBlueprintBotHistoryPageLoading = false; + $scope.initchef(); + break; + case 'jenkins' : + $scope.ischefTaskHistoryPageLoading = false; + $scope.isjenkinsTaskHistoryPageLoading = true; + $scope.iscompositeTaskHistoryPageLoading = false; + $scope.ispuppetTaskHistoryPageLoading = false; + $scope.isscriptTaskHistoryPageLoading = false; + $scope.isBlueprintBotHistoryPageLoading = false; + $scope.initjenkins(); + break; + case 'script': + $scope.ischefTaskHistoryPageLoading = false; + $scope.isjenkinsTaskHistoryPageLoading = false; + $scope.iscompositeTaskHistoryPageLoading = false; + $scope.ispuppetTaskHistoryPageLoading = false; + $scope.isscriptTaskHistoryPageLoading = true; + $scope.isBlueprintBotHistoryPageLoading = false; + $scope.initscript(); + break; + case 'instance_launch': + $scope.ischefTaskHistoryPageLoading = false; + $scope.isjenkinsTaskHistoryPageLoading = false; + $scope.iscompositeTaskHistoryPageLoading = false; + $scope.ispuppetTaskHistoryPageLoading = false; + $scope.isscriptTaskHistoryPageLoading = false; + $scope.isBlueprintBotHistoryPageLoading = true; + $scope.initblueprint(); + break; + } + + $scope.historyLogs=function(hist) { + var modalInstance = $modal.open({ + animation: true, + templateUrl: 'src/partials/sections/dashboard/workzone/orchestration/popups/orchestrationLog.html', + controller: 'orchestrationLogCtrl as orchLogCtrl', + backdrop : 'static', + keyboard: false, + resolve: { + items: function() { + return { + taskId : hist.taskId, + historyId : hist._id, + taskType:hist.taskType + }; + } + } + }); + modalInstance.result.then(function(selectedItem) { + $scope.selected = selectedItem; + }, function() { + console.log('Modal Dismissed at ' + new Date()); + }); + }; + $scope.cancel= function() { + $modalInstance.dismiss('cancel'); + }; + } + ]); })(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/view/botExecutionLogs.html b/client/cat3/src/partials/sections/dashboard/bots/view/botExecutionLogs.html new file mode 100644 index 000000000..e2e8e4d80 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/view/botExecutionLogs.html @@ -0,0 +1,35 @@ +
+ + + + + +
\ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/view/botHistory.html b/client/cat3/src/partials/sections/dashboard/bots/view/botHistory.html new file mode 100644 index 000000000..82a6e9c5a --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/view/botHistory.html @@ -0,0 +1,44 @@ +
+ + + + + +
\ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html b/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html index a82e48010..0f6db8808 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html +++ b/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html @@ -19,13 +19,13 @@