diff --git a/client/cat3/main.html b/client/cat3/main.html index 2f351c95c..7aee82223 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -37,6 +37,8 @@ + + @@ -110,6 +112,7 @@ + @@ -119,6 +122,7 @@ + diff --git a/client/cat3/src/clientRoutes.js b/client/cat3/src/clientRoutes.js index 538102361..267fc8ff5 100644 --- a/client/cat3/src/clientRoutes.js +++ b/client/cat3/src/clientRoutes.js @@ -74,6 +74,7 @@ function routeConfig($stateProvider, $urlRouterProvider, $httpProvider, modulePe url: "/CM/", templateUrl: "src/partials/sections/dashboard/analytics/analytics.html", controller: "analyticsCtrl as analytic", + //params:{filterView:{analytics:true}}, resolve: { auth: ["$q", function ($q) { var deferred = $q.defer(); diff --git a/client/cat3/src/main.js b/client/cat3/src/main.js index 55ec51ab8..2720b2867 100644 --- a/client/cat3/src/main.js +++ b/client/cat3/src/main.js @@ -12,7 +12,7 @@ * All modules/feature will be through * */ -var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr', +var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr','firebase', 'global.login', 'global.breadcrumb', 'authentication', @@ -28,7 +28,7 @@ var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr', 'ui.grid.resizeColumns', 'global.uiGridOptions', 'global.messages', - 'ui.grid.selection' + 'ui.grid.selection','ui.grid.cellNav' ]); angularApp.run(['$rootScope', 'auth', '$state', '$stateParams','$http','$window', diff --git a/client/cat3/src/partials/global.scss b/client/cat3/src/partials/global.scss index 74db63c13..2d8ce58b5 100644 --- a/client/cat3/src/partials/global.scss +++ b/client/cat3/src/partials/global.scss @@ -754,6 +754,10 @@ accordion .panel-heading { /* global styles for logs display across workzone ends here*/ /*ui grid css starts here*/ +.editCell .ui-grid-cell-contents { + background: #b3c4c7 !important; + cursor: pointer; +} .ui-grid { font-size: 14px; text-align: center; @@ -1452,3 +1456,9 @@ div::-webkit-scrollbar-thumb transparent 75%, transparent) } +.ui-grid-row.ui-grid-row-selected > [ui-grid-row] > .ui-grid-cell{ + background-color: #E8F1F3 !important; +} +input[type="text"].ui-grid-filter-input{ + color: #000000; +} \ No newline at end of file diff --git a/client/cat3/src/partials/globals/header/headerDashboard.html b/client/cat3/src/partials/globals/header/headerDashboard.html index 5a07f691f..8a0d8cfc9 100644 --- a/client/cat3/src/partials/globals/header/headerDashboard.html +++ b/client/cat3/src/partials/globals/header/headerDashboard.html @@ -35,7 +35,7 @@
  • - Cloud + CLOUD
  • diff --git a/client/cat3/src/partials/sections/dashboard/analytics/analytics.html b/client/cat3/src/partials/sections/dashboard/analytics/analytics.html index e8610f1b3..6c2df7210 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/analytics.html +++ b/client/cat3/src/partials/sections/dashboard/analytics/analytics.html @@ -6,10 +6,10 @@
  • - - - - - - - - +
  • +
    +
    + + Resources +
    +
    +
  • diff --git a/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html b/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html index bfef10192..ebb6c2e1d 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html +++ b/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html @@ -5,8 +5,19 @@ Instances -
    No Data Found!
    -
    + + + + + + + + +
    + +
    No Data Found!
    @@ -16,7 +27,8 @@ - + + @@ -24,7 +36,8 @@ - + + @@ -33,3 +46,17 @@
    + \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/analytics/view/discoverySyncResult.html b/client/cat3/src/partials/sections/dashboard/analytics/view/discoverySyncResult.html new file mode 100644 index 000000000..22d991b87 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/analytics/view/discoverySyncResult.html @@ -0,0 +1,14 @@ + + + \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryTagMapping.html b/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryTagMapping.html index 17680da44..d27b67904 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryTagMapping.html +++ b/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryTagMapping.html @@ -11,7 +11,7 @@
    - @@ -33,7 +33,7 @@
    + suggestions-arr="newEnt.businessGroup.tagValues">
    @@ -55,7 +55,7 @@
    - @@ -79,7 +79,7 @@
    + suggestions-arr="newEnt.project.tagValues">
    @@ -99,7 +99,7 @@
    - @@ -120,7 +120,7 @@
    + suggestions-arr="newEnt.environment.tagValues">
    @@ -135,6 +135,9 @@
    + diff --git a/client/cat3/src/partials/sections/dashboard/analytics/view/instanceManage.html b/client/cat3/src/partials/sections/dashboard/analytics/view/instanceManage.html new file mode 100644 index 000000000..0713256a5 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/analytics/view/instanceManage.html @@ -0,0 +1,108 @@ +
    +
    + + + + +
    +
    diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/audittrailCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/audittrailCtrl.js index a2dad1382..f8aa58063 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/audittrailCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/audittrailCtrl.js @@ -115,6 +115,7 @@ $scope.RefreshBotsAuditTrail = function() { $scope.botAuditTrailGridView(); + $scope.botAuditTrailSearch = ''; }; $scope.botAuditTrailGridView =function(){ diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/botChefLogCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/botChefLogCtrl.js new file mode 100644 index 000000000..f92b18c22 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/botChefLogCtrl.js @@ -0,0 +1,160 @@ +/* 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('botChefLogCtrl', ['$q', '$scope', 'workzoneServices', '$timeout', 'orchestrationSetting', 'toastr','genericServices', function ($q, $scope, workzoneServices, $timeout, orchestrationSetting, toastr,genSevs) { + /*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/' + items.taskId + '/bots-history/' + items.historyId + } + genSevs.promiseGet(param).then(function (response) { + chefLogData.createInstanceList(response); + }); + }; + chefLogData.createInstanceList = function (historyItem) { + var nodeIds =historyItem.nodeIds ? historyItem.nodeIds : historyItem.auditTrailConfig.nodeIds ; + var nodeIdWithActionLogs = []; + var requestObj = { + "instanceIds": nodeIds + }; + workzoneServices.postRetrieveDetailsForInstanceNames(requestObj).then(function (response) { + var _jobInstances = response.data; + var nodeIdsWithActionId = historyItem.nodeIdsWithActionLog ? historyItem.nodeIdsWithActionLog : historyItem.auditTrailConfig.nodeIdsWithActionLog; + for (var k = 0; k < nodeIdsWithActionId.length; k++) { + for (var l = 0; l < _jobInstances.length; l++) { + if (nodeIdsWithActionId[k].nodeId === _jobInstances[l]._id) { + nodeIdsWithActionId[k].uiNodeName = _jobInstances[l].name; + } + } + } + nodeIdWithActionLogs = nodeIdsWithActionId; + 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; + toastr.error(error); + $scope.errorMessage = ""; + }) + }; + 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 = ''; + if (chefLogData.chefHistoryItem.startedOn && chefLogData.chefHistoryItem.endedOn) { + var urlParams = ''; + urlParams = 'timestamp=' + chefLogData.chefHistoryItem.startedOn + '×tampEnded=' + chefLogData.chefHistoryItem.endedOn; + var param = { + url : "/instances/" + $scope.selectedInstance.nodeId + '/actionLogs/' + $scope.selectedInstance.actionLogId + + '/logs?' + urlParams + } + genSevs.promiseGet(param).then(function (response) { + $scope.isLogsLoading = false; + var logData = { + logs: response, + fullLogs: true + }; + $scope.logListInitial = logData.logs; + helper.scrollBottom(); + }); + + } else if (chefLogData.chefHistoryItem.startedOn && !chefLogData.chefHistoryItem.endedOn) { + var urlParams = 'timestamp=' + chefLogData.chefHistoryItem.startedOn; + var param = { + url : "/instances/" + $scope.selectedInstance.nodeId + '/actionLogs/' + $scope.selectedInstance.actionLogId + + '/logs?' + urlParams + } + genSevs.promiseGet(param).then(function (response) { + $scope.isLogsLoading = false; + helper.lastTimeStamp = helper.getlastTimeStamp(response) || chefLogData.chefHistoryItem.startedOn; + helper.logsPolling(); + var logData = { + logs: response, + fullLogs: true + }; + $scope.logListInitial = logData.logs; + helper.scrollBottom(); + }); + } + }; + init(); + return chefLogData; + } + ]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js deleted file mode 100644 index 284734545..000000000 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js +++ /dev/null @@ -1,243 +0,0 @@ -/* 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', 'toastr', function ($q, $scope, workzoneServices, $timeout, orchestrationSetting, toastr) { - /*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) { - 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; - toastr.error(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 6610422d6..1f938fed8 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js @@ -29,7 +29,13 @@ } } $scope.isChefattributesLoading = true; - if (items.botLinkedSubCategory === 'chef' && items.botConfig) { + + $scope.totalCount = 0; + $scope.countInit = function() { + return $scope.totalCount++; + } + + if (items.botLinkedSubCategory === 'chef') { $scope.chefComponentSelectorList = responseFormatter.findDataForEditValue(items.botConfig.runlist); var nodesList = responseFormatter.chefRunlistFormatter($scope.chefComponentSelectorList); $scope.chefattributes = []; @@ -102,7 +108,24 @@ $scope.executeBot=function(){ if (items.botConfig && items.botConfig.taskType === 'script') { - scriptParams = $scope.parameters; + /*for(var i = 0; i < $scope.scriptparams.length; i++){ + var scriptObj = {}; + var scriptParamList = []; + if($scope.scriptparams[i].scriptParameters.length > 0){ + for(var j = 0; j<$scope.scriptparams[i].scriptParameters.length;j++){ + scriptParamList.push($scope.scriptparams[i].scriptParameters[j].paramVal); + } + if($scope.scriptparams[i].scriptParameters.length === scriptParamList.length){ + scriptObj[$scope.scriptparams[i].scriptId] = scriptParamList; + scriptParams.push(scriptObj); + } + }else{ + scriptObj[$scope.scriptparams[i].scriptId] = []; + scriptParams.push(scriptObj); + } + }*/ + + scriptParams = $scope.scriptparams; } if (items.botConfig && items.botConfig.taskType === 'chef') { cookbookAttributes = responseFormatter.formatSelectedCookbookAttributes($scope.chefattributes); @@ -121,7 +144,7 @@ } else if (items.botConfig && items.botConfig.taskType === 'chef'){ reqBody.tagServer = $scope.tagSerSelected; if ($scope.chefAttributesFlag) { - reqBody.cookbookAttributes = $scope.cookbookAttributes; + reqBody.cookbookAttributes = cookbookAttributes; } } else if (items.botConfig && items.botConfig.taskType === 'script') { reqBody.tagServer = $scope.tagSerSelected; 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 b27d6eb34..305420cf8 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js @@ -32,7 +32,7 @@ { 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: 'Organization',field:'masterDetails.orgName',cellTooltip: true}, { name: 'Total Runs',field:'executionCount'}, { name: 'BOT History',displayName: 'BOT History',cellTemplate:'NA'+ ''}, @@ -175,6 +175,7 @@ console.log('Modal Dismissed at ' + new Date()); }); }; + $scope.botSchedule = function(bot) { $modal.open({ templateUrl: 'src/partials/sections/dashboard/bots/view/botSchedule.html', @@ -192,6 +193,7 @@ console.log('Dismiss time is ' + new Date()); }); }; + $scope.deleteBot = function(bot) { var modalOptions = { closeButtonText: 'Cancel', @@ -207,6 +209,7 @@ genSevs.promiseDelete(param).then(function (response) { if (response) { toastr.success('Successfully deleted'); + lib.summary(); if($scope.totalBotsSelected) { $scope.botLibraryGridView(); } else if($scope.runningBotsselected) { @@ -216,7 +219,6 @@ } else { $scope.botLibraryGridView(); } - lib.summary(); } }, function(data) { toastr.error('error:: ' + data.toString()); @@ -228,10 +230,22 @@ $scope.botLibraryGridView(); }); $scope.RefreshBotsLibrary = function() { + $scope.botLibrarySearch = ''; + lib.summary(); + if($scope.totalBotsSelected) { + $scope.botLibraryGridView(); + } else if($scope.runningBotsselected) { + $scope.showBotsRunning(); + } else if($scope.failedBotsselected) { + $scope.showFailedBots(); + } else { + $scope.botLibraryGridView(); + } + }; + $scope.showAllBots = function() { $scope.totalBotsSelected = true; $scope.runningBotsselected = false; $scope.failedBotsselected = false; - $scope.botLibrarySearch = ''; lib.summary(); $scope.botLibraryGridView(); }; @@ -285,44 +299,56 @@ $modalInstance.dismiss('cancel'); }; }]).controller('botScheduleCtrl',['$scope', '$rootScope', 'genericServices', 'workzoneServices', 'toastr', '$modalInstance', 'items', '$timeout', function ($scope, $rootScope, genSevs, workzoneServices, toastr, $modalInstance, items, $timeout) { + if(items.isBotScheduled === true){ + $scope._isEventSelected = true; + $scope.isScheduled = true; + }else{ + $scope._isEventSelected = false; + $scope.isScheduled = false; + } + $scope.scheduleDeatils = items; $scope.botId = items.botId; $scope.defaultSelection = function() { $scope.repeatsType = 'Minutes';//default selection. $scope.schedulerStartOn=moment(new Date()).format('MM/DD/YYYY'); $scope.schedulerEndOn=moment(new Date()).format('MM/DD/YYYY'); }; - if(items.type !== 'new'){ - if(items.chefJenkScriptTaskObj !==undefined){ - if(items.chefJenkScriptTaskObj.cronStartOn && items.chefJenkScriptTaskObj.cronEndOn) { - var newStartOn = parseInt(items.chefJenkScriptTaskObj.cronStartOn); - var newDate = new Date(newStartOn).toLocaleDateString(); - var datearray = newDate.split("/"); - var newdate = datearray[1] + '/' + datearray[0] + '/' + datearray[2]; - $scope.schedulerStartOn = newdate; - var newEndOn = parseInt(items.chefJenkScriptTaskObj.cronEndOn); - var newEndData = new Date(newEndOn).toLocaleDateString(); - var datearrayNew = newEndData.split("/"); - var newdateEnd = datearrayNew[1] + '/' + datearrayNew[0] + '/' + datearrayNew[2]; - $scope.schedulerEndOn = newdateEnd; - } else { - $scope.schedulerStartOn = items.chefJenkScriptTaskObj.cronStart; - $scope.schedulerEndOn = items.chefJenkScriptTaskObj.cronEnd; - } - - $scope.repeatBy = items.chefJenkScriptTaskObj.repeatBy || items.chefJenkScriptTaskObj.cronRepeatEvery.toString(); - $scope.repeatsType = items.chefJenkScriptTaskObj.repeats || items.chefJenkScriptTaskObj.cronFrequency; - $scope.timeEventType = items.chefJenkScriptTaskObj.startTime; - $scope.timeEventMinute = items.chefJenkScriptTaskObj.startTimeMinute; - $scope.weekOfTheDay = items.chefJenkScriptTaskObj.dayOfWeek; - $scope.currentDate = items.chefJenkScriptTaskObj.startDate; - $scope.selectedDayOfTheMonth = items.chefJenkScriptTaskObj.selectedDayOfTheMonth; - $scope.selectedMonth = items.chefJenkScriptTaskObj.monthOfYear; + $scope.selectBotCheckbox = function(){ + if($scope.isScheduled === true || $scope.isScheduled === 'true') { + $scope._isEventSelected = true; + }else{ + $scope._isEventSelected = false; + } + } + if(items.botScheduler){ + if(items.botScheduler.cronStartOn && items.botScheduler.cronEndOn) { + var newStartOn = parseInt(items.botScheduler.cronStartOn); + var newDate = new Date(newStartOn).toLocaleDateString(); + var datearray = newDate.split("/"); + var newdate = datearray[1] + '/' + datearray[0] + '/' + datearray[2]; + $scope.schedulerStartOn = newdate; + var newEndOn = parseInt(items.botScheduler.cronEndOn); + var newEndData = new Date(newEndOn).toLocaleDateString(); + var datearrayNew = newEndData.split("/"); + var newdateEnd = datearrayNew[1] + '/' + datearrayNew[0] + '/' + datearrayNew[2]; + $scope.schedulerEndOn = newdateEnd; } else { - $scope.defaultSelection(); + $scope.schedulerStartOn = items.botScheduler.cronStartOn; + $scope.schedulerEndOn = items.botScheduler.cronEndOn; } + + $scope.repeatBy = items.botScheduler.repeatBy || items.botScheduler.cronRepeatEvery.toString(); + $scope.repeatsType = items.botScheduler.repeats || items.botScheduler.cronFrequency; + $scope.timeEventType = items.botScheduler.timeEventHour || (items.botScheduler.cronHour && items.botScheduler.cronHour !==null) ? items.botScheduler.cronHour.toString() : ''; + $scope.timeEventMinute = items.botScheduler.timeEventMinute || (items.botScheduler.cronMinute && items.botScheduler.cronMinute !==null) ? items.botScheduler.cronMinute.toString() : ''; + $scope.weekOfTheDay = items.botScheduler.weekOfTheDay || (items.botScheduler.cronWeekDay && items.botScheduler.cronWeekDay !==null) ?items.botScheduler.cronWeekDay.toString(): ''; + $scope.selectedDayOfTheMonth = items.botScheduler.selectedDayOfTheMonth || (items.botScheduler.cronDate && items.botScheduler.cronDate !==null) ?items.botScheduler.cronDate.toString() : ''; + $scope.selectedMonth = items.botScheduler.selectedMonth || (items.botScheduler.cronMonth && items.botScheduler.cronMonth !==null) ? items.botScheduler.cronMonth.toString() : ''; + /*$scope.currentDate = items.botScheduler.startDate;*/ } else { $scope.defaultSelection(); } + $scope.dateChange= function () { var startDate = Date.parse($scope.schedulerStartOn); @@ -363,9 +389,17 @@ cronDate: $scope.selectedDayOfTheMonth, cronMonth: $scope.selectedMonth }; - var reqBody = { - botScheduler:$scope.eventParams, - isBotScheduled:true + var reqBody = null; + if($scope.isScheduled === true || $scope.isScheduled === 'true'){ + reqBody = { + botScheduler:$scope.eventParams, + isBotScheduled:true + } + }else{ + reqBody = { + botScheduler:{}, + isBotScheduled:false + } } var param={ url:'/bots/' + $scope.botId + '/scheduler', @@ -374,6 +408,7 @@ genSevs.promisePut(param).then(function (response) { if(response){ toastr.success('BOTs Scheduler successfully updated'); + $rootScope.$emit('BOTS_LIBRARY_REFRESH'); $modalInstance.dismiss('cancel'); } }); @@ -414,8 +449,8 @@ }; genSevs.promiseGet(param).then(function (response) { $timeout(function() { - if(response.data){ - $scope.taskHistoryChefData = response.data; + if(response.botHistory){ + $scope.taskHistoryChefData = response.botHistory; $scope.ischefTaskHistoryPageLoading = false; }else if(response){ $scope.taskHistoryChefData = response; @@ -454,8 +489,8 @@ $scope.initJenkinsGrids = function(){ $scope.taskHistoryJenkinsGridOptions.data='taskHistoryJenkinsData'; $scope.taskHistoryJenkinsGridOptions.columnDefs = [ - { name:'Job Number',field:'auditTrailConfig.jenkinsBuildNumber',cellTemplate:'{{row.entity.auditTrailConfig.jenkinsBuildNumber}}', sort:{ direction: 'desc'}, cellTooltip: true}, - { name:'Job Output',cellTemplate:'',cellTooltip: true}, + { name:'Job Number',field:'auditTrailConfig.jenkinsBuildNumber',cellTemplate:'{{row.entity.auditTrailConfig.jenkinsBuildNumber}}', 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:'startedOn',cellTemplate:'{{row.entity.startedOn | timestampToLocaleTime}}',cellTooltip: true}, @@ -474,11 +509,12 @@ }; genSevs.promiseGet(param).then(function (response) { $timeout(function() { - if(response.data){ - $scope.taskHistoryJenkinsData = response.data; + if(response.botHistory){ + $scope.taskHistoryJenkinsData = response.botHistory; $scope.isjenkinsTaskHistoryPageLoading = false; }else if(response){ $scope.taskHistoryJenkinsData = response; + console.log($scope.taskHistoryJenkinsData); $scope.isjenkinsTaskHistoryPageLoading = false; } },100); @@ -524,8 +560,8 @@ }; genSevs.promiseGet(param).then(function (response) { $timeout(function() { - if(response.data){ - $scope.taskHistoryScriptData = response.data; + if(response.botHistory){ + $scope.taskHistoryScriptData = response.botHistory; $scope.isscriptTaskHistoryPageLoading = false; }else if(response){ $scope.taskHistoryScriptData = response; @@ -574,8 +610,8 @@ }; genSevs.promiseGet(param).then(function (response) { $timeout(function() { - if(response.data){ - $scope.botHistoryBlueprintData = response.data; + if(response.botHistory){ + $scope.botHistoryBlueprintData = response.botHistory; $scope.isBlueprintBotHistoryPageLoading = false; }else if(response){ $scope.botHistoryBlueprintData = response; @@ -632,7 +668,7 @@ } $scope.historyLogs=function(hist) { - console.log(hist.auditTrailConfig.executionType); + console.log(hist); if(hist.auditTrailConfig && (hist.auditTrailConfig.executionType == 'chef') || (hist.auditTrailConfig.executionType == 'jenkins') || (hist.auditTrailConfig.executionType == 'script')) { var modalInstance = $modal.open({ animation: true, @@ -644,7 +680,7 @@ items: function() { return { taskId : hist.auditId, - historyId : hist.auditHistoryId ? hist.auditHistoryId : hist.auditTrailConfig.nodeIdsWithActionLog[0].actionLogId, + historyId : hist.auditHistoryId ? hist.auditHistoryId : hist.auditTrailConfig.nodeIdsWithActionLog[0] && hist.auditTrailConfig.nodeIdsWithActionLog[0].actionLogId, taskType:hist.auditTrailConfig.executionType }; } 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 21cd4e783..e60f7e55c 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html +++ b/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html @@ -71,11 +71,17 @@
    +