Skip to content

Commit b2c13f4

Browse files
authored
Merge branch 'topic-performance' into topic-performance
2 parents 139b4f1 + acb2b8d commit b2c13f4

17 files changed

Lines changed: 488 additions & 262 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
4.3.0 - July 16th, 2020
2+
---------------------------
3+
* Servicenow app : Generate forms automatically when BOTs are added
4+
* Servicenow app : Dynamic Service catalog items must have different approval workflows.
5+
* Create new APIs to get all the BOTs and modify the input parameter into single string data.
6+
* BOTs server configuration form in service now.
7+
* Outbound APIs in the servicenow to fetch the Catalyst BOTs.
8+
* Botengine Bitbucket Sync using new approach
9+
* Exception handling for bot execution in Botengine
10+
111
3.9.0 - March 7th , 2017
212
----------------------------
313
* BOTs Engine and New Framework

client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,17 @@
247247
if($scope.failedBotsselected)
248248
var param={
249249
inlineLoader:true,
250-
url:'/audit-trail?startdate='+ $scope.ticketsResolveStartsOn+ '&enddate='+ $scope.ticketsResolveEndsOn +'&page=' + $scope.botServiceNowLibGridOptions.paginationCurrentPage +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder + '&filterBy=actionStatus:failed'
250+
url:'/audit-trail?startdate='+ $scope.ticketsResolveStartsOn+ '&enddate='+ $scope.ticketsResolveEndsOn +'&page=' + $scope.botServiceNowLibGridOptions.paginationCurrentPage +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=' + $scope.paginationParams.sortBy +'&sortOrder=' + $scope.paginationParams.sortOrder + '&filterBy=actionStatus:failed' + '&auditForDashboard=true'
251251
};
252252
else if($scope.scheduledBotsSelected)
253253
var param={
254254
inlineLoader:true,
255-
url:'/audit-trail?startdate='+ $scope.ticketsResolveStartsOn+ '&enddate='+ $scope.ticketsResolveEndsOn +'&filterBy=actionStatus:success&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=startedOn&sortOrder=' + $scope.paginationParams.sortOrder+'&type=snow'
255+
url:'/audit-trail?startdate='+ $scope.ticketsResolveStartsOn+ '&enddate='+ $scope.ticketsResolveEndsOn +'&filterBy=actionStatus:success&page=' + $scope.paginationParams.page +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=startedOn&sortOrder=' + $scope.paginationParams.sortOrder+'&type=snow' + '&auditForDashboard=true'
256256
};
257257
else if($scope.runningBotsselected)
258258
var param={
259259
inlineLoader:true,
260-
url:'/audit-trail?startdate='+ $scope.ticketsResolveStartsOn+ '&enddate='+ $scope.ticketsResolveEndsOn +'&page=' + $scope.botServiceNowLibGridOptions.paginationCurrentPage +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=startedOn&sortOrder=' + $scope.paginationParams.sortOrder
260+
url:'/audit-trail?startdate='+ $scope.ticketsResolveStartsOn+ '&enddate='+ $scope.ticketsResolveEndsOn +'&page=' + $scope.botServiceNowLibGridOptions.paginationCurrentPage +'&pageSize=' + $scope.paginationParams.pageSize +'&sortBy=startedOn&sortOrder=' + $scope.paginationParams.sortOrder + '&auditForDashboard=true'
261261
};
262262

263263
$scope.dataTransform(param);
@@ -333,6 +333,23 @@
333333
$scope.errorMessage = "No Records found";
334334
});
335335
$scope.isBotDetailsLoading = false;
336+
var param = {
337+
inlineLoader: true,
338+
url: '/git-hub'
339+
};
340+
genSevs.promiseGet(param).then(function (result) {
341+
$scope.pageLoadBot=false;
342+
for(var i=0;i<result.data.length;i++){
343+
if(result && result.data[i].isDefault == true){
344+
$scope.gitHubRepoName = result.data[i].repositoryName;
345+
}
346+
}
347+
}, function (error) {
348+
$scope.pageLoadBot=false;
349+
toastr.error(error);
350+
$scope.errorMessage = "No Records found";
351+
});
352+
$scope.isBotDetailsLoading = false;
336353
}
337354
$scope.botLibraryGridView = function () {
338355
$rootScope.onBodyLoading = false;

client/cat3/src/partials/sections/dashboard/bots/view/library.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<loading size="large" name="pageLoadBot" type="block" align="center"></loading>
33
<div id="botLibraryPage" ng-show="!pageLoadBot">
44
<div class="page-name">
5-
BOTs Library&nbsp;
6-
<!--<span class="label label-warning"><small>Time Saved: </small>{{botSummary.totalSavedTimeForBots.days ? botSummary.totalSavedTimeForBots.days:0}}d {{botSummary.totalSavedTimeForBots.hours ? botSummary.totalSavedTimeForBots.hours : 0}}h {{botSummary.totalSavedTimeForBots.minutes ? botSummary.totalSavedTimeForBots.minutes : 0}}m</span>-->
5+
BOTs Library : {{gitHubRepoName}} &nbsp;
6+
7+
<!--<span class="label label-warning"><small>Time Saved: </small>{{botSummary.totalSavedTimeForBots.days ? botSummary.totalSavedTimeForBots.days:0}}d {{botSummary.totalSavedTimeForBots.hours ? botSummary.totalSavedTimeForBots.hours : 0}}h {{botSummary.totalSavedTimeForBots.minutes ? botSummary.totalSavedTimeForBots.minutes : 0}}m</span>-->
78
<span class="pull-right">
89
<button type="button" title="Refresh" class="btn btn-xs cat-btn-update pull-right refresh-btn" ng-click="RefreshBotsLibrary();">
910
<i class="fa fa-refresh white"></i>
@@ -316,7 +317,7 @@ <h4 class="margintop-2"><small>{{statusBar}}</small></h4>
316317
ng-show="noShowForServiceNow">
317318
<div class="alert alert-info text-center no-data"
318319
ng-if="!botLibGridOptions.data.length > 0 && !isBotLibraryPageLoading">
319-
No data Available
320+
No BOTs available. Check if your BOT repository is synchronised
320321
</div>
321322
<div id="grid1"
322323
ng-show="!isCardViewActive"

client/htmls/private/ajax/Settings/githubList.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ <h5 class="widget-title widgetColor">
4040
<tbody id="githubInput">
4141
</tbody>
4242
</table>
43+
<h5 style="font-size: 12px;color: blue;">* This repository was successfully synchronised and BOTs from this repository are currently available to use.</h5>
4344
</div>
4445
</div>
4546
<!--widget main ends here-->

client/htmls/private/js/gitHubList.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,13 @@ function getGlobalGitServers() {
232232
return $tdAction;
233233
}
234234
}
235-
]
235+
],
236+
rowCallback: function(row, data, index){
237+
if(data.isDefault == true){
238+
$(row).find('td:eq(0)').css('color', 'blue');
239+
$(row).find('td:eq(0)').text('* '+data.repositoryName);
240+
}
241+
}
236242
} );
237243
};
238244

@@ -460,15 +466,30 @@ $('#gitCloneImport').submit(function(){
460466
$('#gitTable tbody').on( 'click', 'button.syncGitRepo', function(){
461467
$('#gitHubListLoader').show();
462468
var $this = $(this);
469+
var updateData = {
470+
"orgId":$this.parents('tr').attr('orgId'),
471+
"repositoryName":$this.parents('tr').attr('githubName'),
472+
"repositoryOwner":$this.parents('tr').attr('repositoryOwner'),
473+
"repositoryType":$this.parents('tr').attr('repositoryType'),
474+
"isDefault":"true"
475+
}
463476
$.ajax({
464477
url: '../git-hub/' + $this.parents('tr').attr('githubId') + '/sync',
465478
method: 'GET',
466479
success: function(data) {
467480
toastr.success('Successfully cloned.');
481+
$.ajax({
482+
url: '../git-hub/'+ $this.parents('tr').attr('githubId'),
483+
async:false,
484+
method: 'PUT',
485+
data: updateData,
486+
success: function(data) {
487+
getGlobalGitServers();
488+
}
489+
});
468490
$('#gitHubListLoader').hide();
469491
},
470492
error: function(jxhr) {
471-
console.log(jxhr);
472493
var msg = "Unable to Fetch GitRepo please try again later";
473494
if (jxhr.responseJSON && jxhr.responseJSON.message) {
474495
msg = jxhr.responseJSON.message;

server/app/app.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,23 @@ const dboptions = {
4444
host: process.env.DB_HOST || appConfig.db.host,
4545
port: process.env.DB_PORT || appConfig.db.port,
4646
dbName: process.env.DB_NAME || appConfig.db.dbName,
47-
ssl: process.env.DB_SSL || appConfig.db.ssl,
48-
enable_ssl: process.env.ENABLE_SSL || appConfig.db.enable_ssl,
49-
enable_auth: process.env.ENABLE_AUTH || appConfig.db.enable_auth,
47+
ssl: process.env.DB_SSL === 'true' || appConfig.db.ssl,
48+
enable_ssl: process.env.ENABLE_SSL === 'true' || appConfig.db.enable_ssl,
49+
enable_auth: process.env.ENABLE_AUTH === 'true' || appConfig.db.enable_auth,
5050
ssl_config:{
5151
"CAFile": process.env.CAFILE || appConfig.db.ssl_config.CAFile,
5252
"PEMFile": process.env.PEMFILE || appConfig.db.ssl_config.PEMFile
5353
},
5454
auth_config:{
55-
"username":process.env.USERNAME || appConfig.db.auth_config.username,
56-
"password":process.env.PASSWORD || appConfig.db.auth_config.password,
55+
"username":process.env.username || appConfig.db.auth_config.username,
56+
"password":process.env.password || appConfig.db.auth_config.password,
5757
"authenticated":process.env.authenticated || appConfig.db.auth_config.authenticated
5858
}
5959
};
6060

6161
// Initialise the mongodb connections along with that mongoose ORM would be configure
6262
const mongoDbConnect = require('_pr/lib/mongodb');
63+
6364
mongoDbConnect(dboptions, function (err) {
6465
if (err) {
6566
logger.error("Unable to connect to mongo db >>" + err);
@@ -86,7 +87,6 @@ logger.debug('Logger Initialized');
8687

8788

8889
LDAPUser.getLdapUser(function(err, ldapData) {
89-
console.log(JSON.stringify(ldapData))
9090
if (err) {
9191
logger.error("Failed to get ldap-user: ", err);
9292
return;

server/app/engine/bots/scriptExecutor.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ scriptExecutor.execute = function execute(botsDetails,auditTrail,userName,execut
8383
botID: botDetails.id,
8484
user: userName,
8585
date: startHour,
86+
gitHubId: botDetails.gitHubId
8687
}, { $inc: { "failedCount": 1, "runningCount": -1} }, function (err, data) {
8788
if(err) logger.error(JSON.stringify(err))
8889
else logger.info("Running count of bot ", botDetails[0].name, "incremented successfully")
@@ -259,6 +260,7 @@ function executeScriptOnLocal(botsScriptDetails,auditTrail,userName,botHostDetai
259260
botID: botsScriptDetails.id,
260261
user: userName,
261262
date: startHour,
263+
gitHubId: botsScriptDetails.gitHubId
262264
}, { $inc: { "failedCount": 1, "runningCount": -1} }, function (err, data) {
263265
if(err) logger.error(JSON.stringify(err))
264266
else logger.info("Running count of bot ", botDetails[0].name, "incremented successfully")
@@ -321,6 +323,7 @@ function executeScriptOnLocal(botsScriptDetails,auditTrail,userName,botHostDetai
321323
botID: botsScriptDetails.id,
322324
user: userName,
323325
date: startHour,
326+
gitHubId: botsScriptDetails.gitHubId
324327
}, { $inc: { "failedCount": 1, "runningCount": -1} }, function (err, data) {
325328
if(err) logger.error(JSON.stringify(err))
326329
else logger.info("Running count of bot ", botsScriptDetails[0].name, "incremented successfully")
@@ -473,6 +476,7 @@ function executeScriptOnRemote(instance,botDetails,actionLogId,auditTrailId,user
473476
botID: botDetails.id,
474477
user: userName,
475478
date: startHour,
479+
gitHubId: botDetails.gitHubId
476480
}, { $inc: { "failedCount": 1, "runningCount": -1} }, function (err, data) {
477481
if(err) logger.error(JSON.stringify(err))
478482
else logger.info("Running count of bot ", botDetails[0].name, "incremented successfully")
@@ -548,6 +552,7 @@ function executeScriptOnRemote(instance,botDetails,actionLogId,auditTrailId,user
548552
botID: botDetails.id,
549553
user: userName,
550554
date: startHour,
555+
gitHubId: botDetails.gitHubId
551556
}, { $inc: { "failedCount": 1, "runningCount": -1} }, function (err, data) {
552557
if(err) logger.error(JSON.stringify(err))
553558
else logger.info("Running count of bot ", botDetails[0].name, "incremented successfully")

server/app/model/audit-trail/base-audit-trail.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ var AuditTrailSchema = function AuditTrail() {
125125
isDeleted: {
126126
type: Boolean,
127127
default:false
128+
},
129+
gitHubId: {
130+
type: String,
131+
required:true
128132
}
129133
});
130134
};

server/app/model/audit-trail/bot-audit-trail-summary.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ var BotAuditTrailSummarySchema= new Schema ({
5050
type: Number,
5151
default: 0
5252
},
53+
gitHubId: {
54+
type: String,
55+
required: true
56+
}
5357
})
5458

5559
BotAuditTrailSummarySchema.index({ user: 1, botID: 1, date:1}, { unique: true });

server/app/model/file-upload/file-upload.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ const dboptions = {
1010
host: process.env.DB_HOST || appConfig.db.host,
1111
port: process.env.DB_PORT || appConfig.db.port,
1212
dbName: process.env.DB_NAME || appConfig.db.dbName,
13-
ssl: process.env.DB_SSL || appConfig.db.ssl,
14-
enable_ssl: process.env.ENABLE_SSL || appConfig.db.enable_ssl,
15-
enable_auth: process.env.ENABLE_AUTH || appConfig.db.enable_auth,
13+
ssl: process.env.DB_SSL === 'true' || appConfig.db.ssl,
14+
enable_ssl: (process.env.ENABLE_SSL === 'true') || appConfig.db.enable_ssl,
15+
enable_auth: process.env.ENABLE_AUTH === 'true' || appConfig.db.enable_auth,
1616
ssl_config:{
1717
"CAFile": process.env.CAFILE || appConfig.db.ssl_config.CAFile,
1818
"PEMFile": process.env.PEMFILE || appConfig.db.ssl_config.PEMFile
1919
},
2020
auth_config:{
21-
"username":process.env.USERNAME || appConfig.db.auth_config.username,
22-
"password":process.env.PASSWORD || appConfig.db.auth_config.password,
21+
"username":process.env.username || appConfig.db.auth_config.username,
22+
"password":process.env.password || appConfig.db.auth_config.password,
2323
"authenticated":process.env.authenticated || appConfig.db.auth_config.authenticated
2424
}
2525
};
@@ -37,12 +37,19 @@ if(dboptions.enable_ssl){
3737
mongoOptions.sslKey = key;
3838
mongoOptions.sslCert = cert;
3939
}
40-
logger.info(connectionString);
40+
41+
if(dboptions.enable_auth){
42+
connectionString = 'mongodb://'+dboptions.auth_config.username+':'+dboptions.auth_config.password+'@' + dboptions.host + ':' + dboptions.port + '/' + dboptions.dbName + '?ssl=' + dboptions.enable_ssl+'&authSource=admin';
43+
}
44+
45+
logger.info("Connecting to mongodb in file upload.");
4146
mongoDbClient.connect(connectionString, {server : mongoOptions}, function (err, db) {
4247
if (err) {
43-
throw "unable to connect to mongodb"
48+
logger.error(err);
49+
throw "unable to connect to mongodb";
4450
return;
4551
}else{
52+
logger.info("Mongodb connected successfully in file upload.");
4653
gfs = Grid(db, mongoDbClient);
4754
}
4855

0 commit comments

Comments
 (0)