From 58c613c5268adc9d96ec6e2602b88a9babbef140 Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Tue, 6 Dec 2016 17:47:34 +0530 Subject: [PATCH 01/11] Bots UI related changes & enhancements. --- .../bots/controller/audittrailCtrl.js | 4 +- .../bots/controller/botScheduleCtrl.js | 99 +++++++++++ .../bots/controller/editParamsCtrl.js | 2 +- .../dashboard/bots/controller/libraryCtrl.js | 10 +- .../sections/dashboard/bots/view/botInfo.html | 17 +- .../dashboard/bots/view/botSchedule.html | 155 ++++++++++++++++++ .../dashboard/bots/view/editParams.html | 15 +- .../design/view/blueprintCreate.html | 4 +- .../orchestration/popups/newTask.html | 2 +- .../popups/orchestrationHistoryCtrl.js | 27 ++- 10 files changed, 301 insertions(+), 34 deletions(-) create mode 100644 client/cat3/src/partials/sections/dashboard/bots/controller/botScheduleCtrl.js create mode 100644 client/cat3/src/partials/sections/dashboard/bots/view/botSchedule.html 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 3ea895ba0..fa65efd2d 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/audittrailCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/audittrailCtrl.js @@ -10,7 +10,7 @@ angular.module('dashboard.bots') .controller('audittrailCtrl',['$scope', '$rootScope', '$state', 'genericServices', 'confirmbox', 'workzoneServices', 'toastr', 'workzoneUIUtils', '$modal', function ($scope, $rootScope, $state, genSevs, confirmbox, workzoneServices, toastr, workzoneUIUtils, $modal) { - var treeNames = ['Bots','Audit Trail']; + var treeNames = ['BOTs','Audit Trail']; $rootScope.$emit('treeNameUpdate', treeNames); var audit=this; audit.gridOptions={ @@ -30,7 +30,7 @@ 'row.entity.taskType'+ 'row.entity.auditTrailConfig.executionType'+ 'row.entity.botType',cellTooltip: true}, - { name: 'BOT Name',displayName: 'BOT Name',field:'auditTrailConfig.name'}, + { name: 'BOT Name',displayName: 'BOT Name',field:'auditTrailConfig.name',cellTooltip: true}, { name: 'Status',field:'status', cellTemplate:'' + '' + diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/botScheduleCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/botScheduleCtrl.js new file mode 100644 index 000000000..b440bfbb2 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/botScheduleCtrl.js @@ -0,0 +1,99 @@ +/* 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, + * Oct 2016 + */ + +(function (angular) { + "use strict"; + angular.module('library',[]) + .controller('botScheduleCtrl',['$scope', '$rootScope', 'genericServices', 'workzoneServices', 'toastr', '$modalInstance', 'items', '$timeout', function ($scope, $rootScope, genSevs, workzoneServices, toastr, $modalInstance, items, $timeout) { + console.log(items); + $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; + } else { + $scope.defaultSelection(); + } + } else { + $scope.defaultSelection(); + } + + $scope.dateChange= function () { + var startDate = Date.parse($scope.schedulerStartOn); + var endDate = Date.parse($scope.schedulerEndOn); + if(startDate > endDate){ + $scope.validDateRange=true; + } else { + $scope.validDateRange=false; + } + + }; + + $scope.repeatCount = function(max, step) { + step = step || 1; + var input = []; + for (var i = 1; i <= max; i += step) { + input.push(i); + } + return input; + }; + $scope.isDaySelected = { + flag:true + } + + $scope.daysOfWeek = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]; + + $scope.monthOfYear = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + $scope.ok=function(){ + $scope.eventParams = { + repeats: $scope.repeatsType, + repeatBy: $scope.repeatBy, + cronStart: $scope.schedulerStartOn, + cronEnd: $scope.schedulerEndOn, + startTime: $scope.timeEventType, + startTimeMinute: $scope.timeEventMinute, + dayOfWeek: $scope.weekOfTheDay, + selectedDayOfTheMonth: $scope.selectedDayOfTheMonth, + monthOfYear: $scope.selectedMonth + }; + $modalInstance.close($scope.eventParams); + }; + + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; +}]); +})(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 29be3d631..4120bac26 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/editParamsCtrl.js @@ -69,7 +69,7 @@ } $scope.jenkinsparams = items.taskConfig.parameterized; - $scope.scriptparams = items.taskConfig.scriptDetails; + $scope.scriptparams = items.taskConfig.scriptDetails[0]; $scope.parameters=['']; var cookbookAttributes = []; var scriptParams = []; 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 2ffd2c656..bb222c0b2 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js @@ -9,7 +9,7 @@ "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) { - var treeNames = ['Bots','Library']; + var treeNames = ['BOTs','Library']; $rootScope.$emit('treeNameUpdate', treeNames); var lib=this; $scope.totalBotsSelected = true; @@ -25,10 +25,10 @@ 'row.entity.taskType'+ 'row.entity.taskType'+ 'row.entity.botType',cellTooltip: true}, - { name: 'BOT Type',displayName: 'BOT Type',field:'botType'}, - { name: 'BOT Name',displayName: 'BOT Name',field:'name'}, - { name: 'Category',field:'botCategory'}, - { name: 'description',field:'shortDesc'}, + { 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'+ ''}, 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 b16ae05ce..a82e48010 100644 --- a/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html +++ b/client/cat3/src/partials/sections/dashboard/bots/view/botInfo.html @@ -22,12 +22,23 @@