',cellTooltip: true},
{ name: 'BOT Name',displayName: 'BOT Name',field:'auditTrailConfig.name',cellTooltip: true},
{ name: 'Status',field:'status',
- cellTemplate:'
' +
- '
' +
- '
',
+ cellTemplate:'
' +
+ '
' +
+ '
',
cellTooltip: true},
{ name: 'Org',field:'masterDetails.orgName'},
{ name: 'BU',field:'masterDetails.bgName'},
@@ -42,12 +44,67 @@
{ name: 'Env',field:'masterDetails.envName'},
{ name: 'User',field:'user'},
{ name: 'Logs',cellTemplate: ''}
- ],
- data:[]
+ ]
+ $scope.botAuditTrailGridOptions.data=[];
+ angular.extend($scope.botAuditTrailGridOptions,botAuditTrailUIGridDefaults.gridOption);
};
+ $scope.initGrids();
+
var gridBottomSpace = 40;
$scope.gridHeight = workzoneUIUtils.makeTabScrollable('botAuditTrailPage') - gridBottomSpace;
+ //for server side(external) pagination.
+ angular.extend($scope.botAuditTrailGridOptions,botAuditTrailUIGridDefaults.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.botAuditTrailGridView();
+ }
+ });
+ //Pagination for page and pageSize
+ gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
+ $scope.paginationParams.page = newPage;
+ $scope.paginationParams.pageSize = pageSize;
+ $scope.botAuditTrailGridView();
+ });
+ },
+ });
+ /*angular.extend($scope.botAuditTrailGridOptions,botAuditTrailUIGridDefaults.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.botAuditTrailGridView();
+ }
+ });
+ //Pagination for page and pageSize
+ gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
+ console.log(newPage);
+ $scope.paginationParams.page = newPage;
+ $scope.paginationParams.pageSize = pageSize;
+ $scope.botAuditTrailGridView();
+ });
+ },
+ });*/
+ /*$scope.setFirstPageView = function(){
+ $scope.botAuditTrailGridOptions.paginationCurrentPage = $scope.paginationParams.page = 1;
+ };
+ $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.init();
+ }
+ };
+ $scope.setPaginationDefaults();*/
+
$scope.botAuditTrailLogs=function(hist) {
var modalInstance = $modal.open({
animation: true,
@@ -69,20 +126,26 @@
};
$scope.RefreshBotsAuditTrail = function() {
- audit.init();
+ $scope.botAuditTrailGridView();
};
- audit.init =function(){
- audit.gridOptions.data=[];
+ $scope.botAuditTrailGridView =function(){
+ $scope.botAuditTrailGridOptions.data=[];
var param={
- url:'/audit-trail?filterBy=auditType:BOTs'
+ url:'/audit-trail?filterBy=auditType:BOTs&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder
};
genSevs.promiseGet(param).then(function (response) {
- angular.forEach(response,function () {
- audit.gridOptions.data=response.auditTrails;
- });
+ $timeout(function() {
+ $scope.botAuditTrailGridOptions.data=response.auditTrails;
+ $scope.botAuditTrailGridOptions.totalItems = response.metaData.totalRecords;
+ }, 100);
+ $scope.isBotAuditTrailPageLoading = false;
+ }, function(error) {
+ $scope.isBotAuditTrailPageLoading = false;
+ console.log(error);
+ $scope.errorMessage = "No Records found";
});
};
- audit.init();
+ $scope.botAuditTrailGridView();
}]);
})(angular);
\ No newline at end of file
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 01283672c..475cf7f27 100644
--- a/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js
+++ b/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js
@@ -8,174 +8,174 @@
(function (angular) {
"use strict";
angular.module('library.params', [])
- .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) {
- $scope.taggingServerList=topSer.data;
- });
- $scope.chefAttributesFlag = false;
- $scope.scriptParamsFlag = false;
- if(items.botConfig && items.botConfig.runlist && items.botConfig.runlist.length) {
- $scope.chefAttributesFlag = true;
+ .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) {
+ $scope.taggingServerList=topSer.data;
+ });
+ $scope.chefAttributesFlag = false;
+ $scope.scriptParamsFlag = false;
+ if(items.botConfig && items.botConfig.runlist && items.botConfig.runlist.length) {
+ $scope.chefAttributesFlag = true;
+ }
+ if(items.botLinkedSubCategory === 'script' && items.botConfig) {
+ for (var i=0; i
'+
+ .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;
+ var botLibraryUIGridDefaults = uiGridOptionsService.options();
+ $scope.paginationParams = botLibraryUIGridDefaults.pagination;
+ $scope.paginationParams=[];
+ $scope.paginationParams.page = 1;
+ $scope.paginationParams.pageSize = 10;
+ $scope.paginationParams.sortBy = 'createdOn';
+ $scope.paginationParams.sortOrder = 'desc';
+
+ $scope.initGrids = function(){
+ $scope.botLibGridOptions={};
+ $scope.botLibGridOptions.columnDefs= [
+ { name:'Task Type', field:'botLinkedSubCategory' ,cellTemplate:'
'+
'
'+
'
'+
'
',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 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:
+ { 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();
}
- ]
- $scope.botLibGridOptions.data=[];
- angular.extend($scope.botLibGridOptions,botLibraryUIGridDefaults.gridOption);
+ });
+ //Pagination for page and pageSize
+ gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
+ $scope.paginationParams.page = newPage;
+ $scope.paginationParams.pageSize = pageSize;
+ $scope.botLibraryGridView();
+ });
+ },
+ });
+ $scope.setFirstPageView = function(){
+ $scope.botLibGridOptions.paginationCurrentPage = $scope.paginationParams.page = 1;
+ };
+ $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=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder
};
- $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();
- });
- },
+ 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.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=[];
+ };
+ $scope.botLibraryGridView();
+ $scope.searchBotNameCategory = function() {
+ $scope.searchString = $scope.botLibrarySearch;
+ lib.gridOptions=[];
+ if($scope.totalBotsSelected) {
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();
- $scope.searchBotNameCategory = function() {
- $scope.searchString = $scope.botLibrarySearch;
- console.log($scope.searchString);
- lib.gridOptions=[];
+ url:'/bots?page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder+'&search=' + $scope.searchString
+ }
+ } else if($scope.runningBotsselected) {
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";
- });
- };
- var gridBottomSpace = 190;
- $scope.gridHeight = workzoneUIUtils.makeTabScrollable('botLibraryPage') - gridBottomSpace;
- $scope.launchInstance = function(launch){
- console.log(launch.botLinkedCategory);
- /*if(launch.launcType === 'task'){
- genSevs.executeTask(launch);
- } else if(launch.launcType === 'bp') {
- genSevs.launchBlueprint(launch);
- }*/
- if(launch.botLinkedCategory === 'Task'){
- genSevs.executeTask(launch);
- } else if(launch.botLinkedCategory === 'Blueprint') {
- genSevs.launchBlueprint(launch);
+ url:'/bots?actionStatus=running&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder+'&search=' + $scope.searchString
+ }
+ } else if($scope.failedBotsselected) {
+ var param={
+ url:'/bots?actionStatus=failed&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder+'&search=' + $scope.searchString
}
};
- /*$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;
- }
+ 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";
+ });
+ };
+ var gridBottomSpace = 225;
+ $scope.gridHeight = workzoneUIUtils.makeTabScrollable('botLibraryPage') - gridBottomSpace;
+ $scope.launchInstance = function(launch){
+ console.log(launch.botLinkedCategory);
+ /*if(launch.launcType === 'task'){
+ genSevs.executeTask(launch);
+ } else if(launch.launcType === 'bp') {
+ genSevs.launchBlueprint(launch);
+ }*/
+ if(launch.botLinkedCategory === 'Task'){
+ genSevs.executeTask(launch);
+ } else if(launch.botLinkedCategory === 'Blueprint') {
+ genSevs.launchBlueprint(launch);
+ }
+ };
+ /*$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({
- animation: true,
- templateUrl: 'src/partials/sections/dashboard/bots/view/botInfo.html',
- controller: 'botInfoCtrl',
- backdrop : 'static',
- 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({
+ animation: true,
+ templateUrl: 'src/partials/sections/dashboard/bots/view/botInfo.html',
+ controller: 'botInfoCtrl',
+ backdrop : 'static',
+ keyboard: false,
+ resolve: {
+ items: function() {
+ return bot;
}
- });
- modalInstance.result.then(function(selectedItem) {
- $scope.selected = selectedItem;
- }, function() {
- console.log('Modal Dismissed at ' + new Date());
- });
- };
- $scope.botSchedule = function(bot) {
- $modal.open({
- templateUrl: 'src/partials/sections/dashboard/bots/view/botSchedule.html',
- controller: 'botScheduleCtrl',
- backdrop: 'static',
- 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) {
+ genSevs.newTask(bot);
+ var modalInstance = $modal.open({
+ animation: true,
+ templateUrl: 'src/partials/sections/dashboard/workzone/popups/newTask.html',
+ controller: 'newTaskCtrl',
+ backdrop : 'static',
+ size: 'lg',
+ keyboard: false,
+ resolve: {
+ items: function() {
+ return bot;
}
- }).result.then(function (chefEventDetails) {
- $scope.isEventAvailable = true;
- $scope.chefJenkScriptTaskObj = chefEventDetails;
- var startTimeMinute,startTimeHour,dayOfWeek,selectedDayOfTheMonth,selectedMonth;
- startTimeMinute = $scope.chefJenkScriptTaskObj.startTimeMinute;
- startTimeHour = $scope.chefJenkScriptTaskObj.startTime;
- dayOfWeek = $scope.chefJenkScriptTaskObj.dayOfWeek;
- selectedDayOfTheMonth = $scope.chefJenkScriptTaskObj.selectedDayOfTheMonth;
- selectedMonth = $scope.chefJenkScriptTaskObj.monthOfYear;
- $scope.type = 'edit';
- $scope._isEventSelected = true;
-
- $scope.repeatPattern = 'Repeat Every -' + $scope.chefJenkScriptTaskObj.repeats;
- $scope.cronDetails = {
- cronStartOn : $scope.chefJenkScriptTaskObj.cronStart,
- cronEndOn : $scope.chefJenkScriptTaskObj.cronEnd,
- cronRepeatEvery : $scope.chefJenkScriptTaskObj.repeatBy,
- cronFrequency: $scope.chefJenkScriptTaskObj.repeats,
- cronTime: typeof startTimeHour !=='undefined'? startTimeHour : new Date().getHours() + ':' + typeof startTimeMinute !=='undefined'? startTimeMinute:new Date().getMinutes(),
- cronDays: $scope.chefJenkScriptTaskObj.dayOfWeek,
- cronMonth: $scope.chefJenkScriptTaskObj.monthOfYear
+ }
+ });
+ modalInstance.result.then(function(selectedItem) {
+ $scope.selected = selectedItem;
+ }, function() {
+ console.log('Modal Dismissed at ' + new Date());
+ });
+ };*/
+ $scope.botSchedule = function(bot) {
+ $modal.open({
+ templateUrl: 'src/partials/sections/dashboard/bots/view/botSchedule.html',
+ controller: 'botScheduleCtrl',
+ backdrop: 'static',
+ keyboard: false,
+ resolve: {
+ items: function () {
+ return bot
}
- }, function () {
- console.log('Dismiss time is ' + new Date());
- });
- };
- $scope.deleteBot = function(bot) {
- 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:'/bots/' + bot.botId
- };
- genSevs.promiseDelete(param).then(function (response) {
- if (response) {
- toastr.success('Successfully deleted');
- if($scope.totalBotsSelected) {
- $scope.botLibraryGridView();
- } else if($scope.runningBotsselected) {
- $scope.showBotsRunning();
- } else if($scope.failedBotsselected) {
- $scope.showFailedBots();
- } else {
- $scope.botLibraryGridView();
- }
- lib.summary();
- }
- }, function(data) {
- toastr.error('error:: ' + data.toString());
- });
- });
- };
- $rootScope.$on('BOTS_LIBRARY_REFRESH', function() {
- lib.summary();
- $scope.botLibraryGridView();
+ }
+ }).result.then(function (chefEventDetails) {
+ $scope.isEventAvailable = true;
+ $scope.chefJenkScriptTaskObj = chefEventDetails;
+ var startTimeMinute,startTimeHour,dayOfWeek,selectedDayOfTheMonth,selectedMonth;
+ startTimeMinute = $scope.chefJenkScriptTaskObj.startTimeMinute;
+ startTimeHour = $scope.chefJenkScriptTaskObj.startTime;
+ dayOfWeek = $scope.chefJenkScriptTaskObj.dayOfWeek;
+ selectedDayOfTheMonth = $scope.chefJenkScriptTaskObj.selectedDayOfTheMonth;
+ selectedMonth = $scope.chefJenkScriptTaskObj.monthOfYear;
+ $scope.type = 'edit';
+ $scope._isEventSelected = true;
+
+ $scope.repeatPattern = 'Repeat Every -' + $scope.chefJenkScriptTaskObj.repeats;
+ $scope.cronDetails = {
+ cronStartOn : $scope.chefJenkScriptTaskObj.cronStart,
+ cronEndOn : $scope.chefJenkScriptTaskObj.cronEnd,
+ cronRepeatEvery : $scope.chefJenkScriptTaskObj.repeatBy,
+ cronFrequency: $scope.chefJenkScriptTaskObj.repeats,
+ cronTime: typeof startTimeHour !=='undefined'? startTimeHour : new Date().getHours() + ':' + typeof startTimeMinute !=='undefined'? startTimeMinute:new Date().getMinutes(),
+ cronDays: $scope.chefJenkScriptTaskObj.dayOfWeek,
+ cronMonth: $scope.chefJenkScriptTaskObj.monthOfYear
+ }
+ }, function () {
+ console.log('Dismiss time is ' + new Date());
});
- $scope.RefreshBotsLibrary = function() {
- $scope.totalBotsSelected = true;
- $scope.runningBotsselected = false;
- $scope.failedBotsselected = false;
- lib.summary();
- $scope.botLibraryGridView();
- };
- $scope.showBotsRunning = function() {
- $scope.runningBotsselected = true;
- $scope.totalBotsSelected = false;
- $scope.failedBotsselected = false;
- lib.gridOptions.data=[];
- var param={
- url:'/bots?actionStatus=running&page=1&pageSize=10&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder
- };
- genSevs.promiseGet(param).then(function (result) {
- $timeout(function() {
- $scope.botLibGridOptions.totalItems = result.metaData.totalRecords;
- $scope.botLibGridOptions.data=result.bots;
- }, 100);
- });
- lib.summary();
+ };
+ $scope.deleteBot = function(bot) {
+ var modalOptions = {
+ closeButtonText: 'Cancel',
+ actionButtonText: 'Delete',
+ actionButtonStyle: 'cat-btn-delete',
+ headerText: 'Delete Bot',
+ bodyText: 'Are you sure you want to delete this bots?'
};
- $scope.showFailedBots = function() {
- $scope.failedBotsselected = true;
- $scope.runningBotsselected = false;
- $scope.totalBotsSelected = false;
- lib.gridOptions.data=[];
+ confirmbox.showModal({}, modalOptions).then(function() {
var param={
- url:'/bots?actionStatus=failed&page=1&pageSize=10&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder
+ url:'/bots/' + bot.botId
};
- genSevs.promiseGet(param).then(function (result) {
- $timeout(function() {
- $scope.botLibGridOptions.totalItems = result.metaData.totalRecords;
- $scope.botLibGridOptions.data=result.bots;
- }, 100);
+ genSevs.promiseDelete(param).then(function (response) {
+ if (response) {
+ toastr.success('Successfully deleted');
+ if($scope.totalBotsSelected) {
+ $scope.botLibraryGridView();
+ } else if($scope.runningBotsselected) {
+ $scope.showBotsRunning();
+ } else if($scope.failedBotsselected) {
+ $scope.showFailedBots();
+ } else {
+ $scope.botLibraryGridView();
+ }
+ lib.summary();
+ }
+ }, function(data) {
+ toastr.error('error:: ' + data.toString());
});
- lib.summary();
+ });
+ };
+ $rootScope.$on('BOTS_LIBRARY_REFRESH', function() {
+ lib.summary();
+ $scope.botLibraryGridView();
+ });
+ $scope.RefreshBotsLibrary = function() {
+ $scope.totalBotsSelected = true;
+ $scope.runningBotsselected = false;
+ $scope.failedBotsselected = false;
+ $scope.botLibrarySearch = '';
+ lib.summary();
+ $scope.botLibraryGridView();
+ };
+ $scope.showBotsRunning = function() {
+ $scope.runningBotsselected = true;
+ $scope.totalBotsSelected = false;
+ $scope.failedBotsselected = false;
+ lib.gridOptions.data=[];
+ var param={
+ url:'/bots?actionStatus=running&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder
};
- lib.summary = function() {
- $scope.botSummary=[];
- var param={
- url:'/audit-trail/bots-summary'
- };
- genSevs.promiseGet(param).then(function (response) {
- $scope.botSummary = response;
- $scope.totalSavedTimeForBots = parseInt($scope.botSummary.totalSavedTimeForBots);
- });
+ genSevs.promiseGet(param).then(function (result) {
+ $timeout(function() {
+ $scope.botLibGridOptions.totalItems = result.metaData.totalRecords;
+ $scope.botLibGridOptions.data=result.bots;
+ }, 100);
+ });
+ lib.summary();
+ };
+ $scope.showFailedBots = function() {
+ $scope.failedBotsselected = true;
+ $scope.runningBotsselected = false;
+ $scope.totalBotsSelected = false;
+ lib.gridOptions.data=[];
+ var param={
+ url:'/bots?actionStatus=failed&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder
};
+ genSevs.promiseGet(param).then(function (result) {
+ $timeout(function() {
+ $scope.botLibGridOptions.totalItems = result.metaData.totalRecords;
+ $scope.botLibGridOptions.data=result.bots;
+ }, 100);
+ });
lib.summary();
- }]).controller('botInfoCtrl',['$scope', 'items', '$modalInstance', function ($scope, items, $modalInstance) {
+ };
+ lib.summary = function() {
+ $scope.botSummary=[];
+ var param={
+ url:'/audit-trail/bots-summary'
+ };
+ genSevs.promiseGet(param).then(function (response) {
+ $scope.botSummary = response;
+ $scope.totalSavedTimeForBots = parseInt($scope.botSummary.totalSavedTimeForBots);
+ });
+ };
+ lib.summary();
+ }]).controller('botInfoCtrl',['$scope', 'items', '$modalInstance', function ($scope, items, $modalInstance) {
$scope.botInfo = items;
console.log(items);
@@ -321,15 +354,15 @@
var newdate = datearray[1] + '/' + datearray[0] + '/' + datearray[2];
$scope.schedulerStartOn = newdate;
var newEndOn = parseInt(items.chefJenkScriptTaskObj.cronEndOn);
- var newEndData = new Date(newEndOn).toLocaleDateString();
+ 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.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;
@@ -666,7 +699,7 @@
items: function() {
return {
taskId : hist.auditId,
- historyId : hist.auditHistoryId,
+ historyId : hist._id,
taskType:hist.auditTrailConfig.executionType
};
}
@@ -698,5 +731,33 @@
$scope.cancel= function() {
$modalInstance.dismiss('cancel');
};
- }]);
+ }]).controller('confirmBotRunCtrl', ['$scope', '$modalInstance', 'items', 'genericServices','toastr', function ($scope, $modalInstance, items, genSevs, toastr) {
+ console.log(items);
+ $scope.botId = items.botId;
+ $scope.isJobRunExecuting = false;
+ $scope.cancel = function () {
+ $modalInstance.dismiss('cancel');
+ };
+ $scope.runJob = function () {
+ $scope.isJobRunExecuting = true;
+ var param={
+ url:'/bots/' + items.botId + '/execute'
+ };
+ genSevs.promisePost(param).then(function (response) {
+ console.log(response);
+ $modalInstance.close(response.data);
+ $rootScope.$emit('BOTS_LIBRARY_REFRESH');
+ helper.botLogModal(items.botId, response.historyId, response.taskType);
+ },
+ function (error) {
+ error = error.responseText || error;
+ if (error.message) {
+ toastr.error(error.message);
+ } else {
+ toastr.error(error);
+ }
+ });
+ };
+ }
+ ]);
})(angular);
\ No newline at end of file
diff --git a/client/cat3/src/partials/sections/dashboard/bots/view/audittrail.html b/client/cat3/src/partials/sections/dashboard/bots/view/audittrail.html
index 9941d03e9..1a3d347e0 100644
--- a/client/cat3/src/partials/sections/dashboard/bots/view/audittrail.html
+++ b/client/cat3/src/partials/sections/dashboard/bots/view/audittrail.html
@@ -9,8 +9,10 @@
-
-