From ff69f9461e1090f79344e3f68baa2c8770d71db6 Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Wed, 21 Dec 2016 16:49:00 +0530 Subject: [PATCH] Resolved QA issues related to BOTS. --- .../bots/controller/audittrailCtrl.js | 1 + .../dashboard/bots/controller/chefLogCtrl.js | 6 +- .../dashboard/bots/controller/libraryCtrl.js | 59 ++++++++++--------- .../sections/dashboard/bots/view/botInfo.html | 30 ++++++++-- 4 files changed, 59 insertions(+), 37 deletions(-) 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/chefLogCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js index 2fbcaf590..e3b75f9a4 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/chefLogCtrl.js @@ -8,7 +8,7 @@ (function (angular) { "use strict"; angular.module('dashboard.bots') - .controller('chefLogCtrl', ['$q', '$scope', 'workzoneServices', '$timeout', 'orchestrationSetting', 'toastr','items', function ($q, $scope, workzoneServices, $timeout, orchestrationSetting, toastr,items) { + .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; @@ -232,11 +232,11 @@ }; init(); // on task change event in the parent controller - $scope.$on('parentChangeCompTask', function (event, args) { + /*$scope.$on('parentChangeCompTask', function (event, args) { items = args; resetAll(); init(); - }); + });*/ return chefLogData; } ]); 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..7430e17fc 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', @@ -285,44 +287,43 @@ $modalInstance.dismiss('cancel'); }; }]).controller('botScheduleCtrl',['$scope', '$rootScope', 'genericServices', 'workzoneServices', 'toastr', '$modalInstance', 'items', '$timeout', function ($scope, $rootScope, genSevs, workzoneServices, toastr, $modalInstance, items, $timeout) { + $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; + + 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); @@ -374,6 +375,7 @@ genSevs.promisePut(param).then(function (response) { if(response){ toastr.success('BOTs Scheduler successfully updated'); + $rootScope.$emit('BOTS_LIBRARY_REFRESH'); $modalInstance.dismiss('cancel'); } }); @@ -479,6 +481,7 @@ $scope.isjenkinsTaskHistoryPageLoading = false; }else if(response){ $scope.taskHistoryJenkinsData = response; + console.log($scope.taskHistoryJenkinsData); $scope.isjenkinsTaskHistoryPageLoading = false; } },100); 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 @@