Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@
items: function() {
return {
taskId : hist.auditId,
historyId : hist._id,
historyId : hist.auditHistoryId ? hist.auditHistoryId : hist.auditTrailConfig.nodeIdsWithActionLog[0].actionLogId,
taskType:hist.auditTrailConfig.executionType
};
}
Expand Down Expand Up @@ -731,22 +731,40 @@
$scope.cancel= function() {
$modalInstance.dismiss('cancel');
};
}]).controller('confirmBotRunCtrl', ['$scope', '$modalInstance', 'items', 'genericServices','toastr', function ($scope, $modalInstance, items, genSevs, toastr) {
}]).controller('confirmBotRunCtrl', ['$scope', '$modalInstance', 'items', 'genericServices','toastr','$modal', function ($scope, $modalInstance, items, genSevs, toastr,$modal) {
console.log(items);
$scope.botId = items.botId;
$scope.isJobRunExecuting = false;
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
var helper = {
botLogModal: function(id,historyId,taskType) {
$modal.open({
animation: true,
templateUrl: 'src/partials/sections/dashboard/bots/view/botExecutionLogs.html',
controller: 'botExecutionLogsCtrl as botExecLogCtrl',
backdrop: 'static',
keyboard: false,
resolve: {
items: function() {
return {
taskId: id,
historyId: historyId,
taskType: taskType
};
}
}
});
}
};
$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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
};
pbList.launchInstance = $scope.launchInstance =function($event,pb){
$event.stopPropagation();
gencSers.lunchBlueprint(pb);
gencSers.launchBlueprint(pb);
};
pbList.selectCard = function (cardObj){
pbList[cardObj._id] = !pbList[cardObj._id];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
angular.module('workzone.blueprint')
.controller('blueprintLaunchCtrl', ['$scope', '$rootScope', '$modalInstance', 'bpItem', 'workzoneServices', 'workzoneEnvironment', 'instanceLogs', function($scope, $rootScope, $modalInstance, bpItem, workzoneServices, workzoneEnvironment, instanceLogs) {
console.log(bpItem);
if(bpItem.bp.blueprintType) {
if(bpItem.bp.blueprintType || bpItem.bp.botLinkedSubCategory) {
$scope.isBPLogsLoading = true;
$scope.isNewInstanceLogsPromise = false;
var helper = {
Expand Down Expand Up @@ -44,9 +44,9 @@
}
else{
isSuccess = true;
if (bpItem.bp.blueprintType === 'aws_cf') {
if (bpItem.bp.blueprintType === 'aws_cf' || bpItem.bp.botLinkedSubCategory === 'aws_cf') {
msgStr = 'Stack Id : ' + $scope.launchResponse.stackId + '. You can view your stack in cloudformation tab';
} else if (bpItem.bp.blueprintType === 'azure_arm') {
} else if (bpItem.bp.blueprintType === 'azure_arm' || bpItem.bp.botLinkedSubCategory === 'azure_arm') {
msgStr = 'Deployment Id : ' + $scope.launchResponse.armId + '. You can view your deployment in ARM tab';
} else {
msgStr = 'Instance Id : ';
Expand Down Expand Up @@ -80,12 +80,16 @@
versionsList = bpItem.bp.blueprintConfig.infraManagerData.versionsList;
versionOptional = versionsList[versionsList.length-1].ver;
}
}else{
versionOptional = bpItem.bp.version ? bpItem.bp.version : 1;
}
var selectedVersionBpId = bpItem.bp.selectedVersionBpId;
var monitorId = bpItem.monitorId;
if(bpItem && bpItem.bp && bpItem.bp.selectedVersionBpId){
selectedVersionBpId = bpItem.bp.selectedVersionBpId;
} else {
} else if(bpItem.bp.botType){
selectedVersionBpId = bpItem.bp.botId;
} else{
selectedVersionBpId = bpItem.bp._id;
}
var lEnv=null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
angular.forEach(envData,function(val){
var orgID,bgID,projID;
if(items.organizationId === undefined) {
orgID = (items.orgId)?items.orgId:items.organization.id;
bgID = (items.bgId)?items.bgId:items.businessGroup.id;
projID = (items.projectId)?items.projectId:items.project.id;
orgID = (items.orgId)?items.orgId:items.masterDetails.orgId;
bgID = (items.bgId)?items.bgId:items.masterDetails.bgId;
projID = (items.projectId)?items.projectId:items.masterDetails.projectId;
$scope.getMonitorList(orgID);
} else {
orgID = items.organizationId;
Expand Down Expand Up @@ -76,7 +76,7 @@
$modalInstance.dismiss('cancel');
};
$scope.launchBP = function() {
if(items.orgId === undefined){
if(items.orgId === undefined && items.botType === undefined){
var compBlue={
"blueprintId": (items.id)?items.id:items._id,
"environmentId": $scope.envSeleted
Expand All @@ -88,13 +88,14 @@
toastr.error(data.message, 'Error');
});
} else {
if(items.blueprintType === "aws_cf") {
if(items.blueprintType === "aws_cf" || items.botLinkedSubCategory === "aws_cf") {
$scope.showCFTInputs = true;
}else if(items.blueprintType === "azure_arm") {
}else if(items.blueprintType === "azure_arm" || items.botLinkedSubCategory === "azure_arm") {
$scope.showARMInputs = true;
}else if(items.domainNameCheck === true || items.domainNameCheck === "true") {
$scope.showBlueprintInputs = true;
}else {
console.log("Durgesh");
launchHelper.launch();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"use strict";
angular.module('workzone.instance')
.controller('instanceLogsCtrl', ['$scope', '$rootScope', '$modalInstance', 'items', 'workzoneServices', 'instanceSetting', 'instanceLogs', function($scope, $rootScope , $modalInstance, items, workzoneServices, instanceSetting, instanceLogs) {
console.log(items);
console.log("Durgesh");
$scope.instanceName = items.name;
$scope.isInstanceLogsLoading = true;
angular.extend($scope, {
Expand Down
12 changes: 4 additions & 8 deletions server/app/model/blueprint/blueprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,32 +288,28 @@ BlueprintSchema.methods.launch = function (opts, callback) {
message: "Failed to get env name from env id"
}, null);
return;
}
;
};
if (!envName) {
callback({
"message": "Unable to find environment name from environment id"
});
return;
}
;
};
configmgmtDao.getChefServerDetails(infraManager.infraManagerId, function (err, chefDetails) {
if (err) {
logger.error("Failed to getChefServerDetails", err);
callback({
message: "Failed to getChefServerDetails"
}, null);
return;
}
;
};
if (!chefDetails) {
logger.error("No CHef Server Detailed available.", err);
callback({
message: "No Chef Server Detailed available"
}, null);
return;
}
;
};
var chef = new Chef({
userChefRepoLocation: chefDetails.chefRepoLocation,
chefUserName: chefDetails.loginname,
Expand Down
7 changes: 6 additions & 1 deletion server/app/model/bots/bots.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ var BotsSchema = new Schema ({
type: Number,
default: 1
},
domainNameCheck: {
type: Boolean,
default: false
}
});
BotsSchema.plugin(mongoosePaginate);

Expand Down Expand Up @@ -298,7 +302,8 @@ BotsSchema.statics.updateBotsExecutionCount = function updateBotsExecutionCount(

BotsSchema.statics.getScheduledBots = function getScheduledBots(callback) {
Bots.find({
isBotScheduled: true
isBotScheduled: true,
isDeleted:false
}, function (err, bots) {
if (err) {
logger.error(err);
Expand Down
2 changes: 1 addition & 1 deletion server/app/model/classes/tasks/taskTypeChef.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ chefTaskSchema.methods.execute = function(userName, baseUrl, choiceParam, appDat
});
});

} else if (tagServer) {
} else if (tagServer !== 'undefined' && tagServer !== null) {
logger.debug('in tagServer',tagServer);
instancesDao.getInstancesByTagServer(tagServer, function(err, instances) {
if (err) {
Expand Down
6 changes: 1 addition & 5 deletions server/app/model/classes/tasks/taskTypeScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ scriptTaskSchema.methods.execute = function(userName, baseUrl, choiceParam, nexu
var sudoFlag = this.isSudo;
var scriptDetails = this.scriptDetails;
var instanceResultList = [];

function getInstances(instanceIds, tagServer, callback) {
if (tagServer) {
if (tagServer !== 'undefined' && tagServer !== null) {
logger.debug('in tagServer', tagServer);
instancesDao.getInstancesByTagServer(tagServer, function (err, instances) {
if (err) {
Expand All @@ -83,7 +82,6 @@ scriptTaskSchema.methods.execute = function(userName, baseUrl, choiceParam, nexu
});

} else {

if (!(instanceIds && instanceIds.length)) {
if (typeof onExecute === 'function') {
onExecute({
Expand All @@ -104,8 +102,6 @@ scriptTaskSchema.methods.execute = function(userName, baseUrl, choiceParam, nexu
});
}
}


getInstances(instanceIds, self.botTagServer, function (err, instances) {
if (err) {
logger.error(err);
Expand Down
1 change: 0 additions & 1 deletion server/app/routes/v1.0/routes_authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var aws = require('aws-sdk');
module.exports.setRoutes = function(app) {
app.post('/auth/createldapUser', function(req, res) {
if (req.body) {

LDAPUser.getLdapUser(function(err, ldapData) {
if (err) {
logger.error("Failed to get ldap-user: ", err);
Expand Down
6 changes: 4 additions & 2 deletions server/app/routes/v1.0/routes_d4dMasters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2736,8 +2736,7 @@ module.exports.setRoutes = function (app, sessionVerification) {
logger.error('Hit getting setting wizard error', err);
res.send(500);
return;
}
if (settingWizards.currentStep && settingWizards.currentStep.name === 'User Configuration') {
}else if (settingWizards.currentStep && settingWizards.currentStep.name === 'User Configuration') {
var settingWizardSteps = appConfig.settingWizardSteps;
settingWizards.currentStep.nestedSteps[1].isCompleted = true;
settingWizards.currentStep.isCompleted = true;
Expand All @@ -2753,6 +2752,9 @@ module.exports.setRoutes = function (app, sessionVerification) {
res.send(200);
return;
});
}else{
res.send(200);
return;
}
})
}
Expand Down
16 changes: 11 additions & 5 deletions server/app/services/auditTrailService.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ auditTrailService.getBOTsSummary = function getBOTsSummary(callback){
totalNoOfSuccessBots: function(callback){
var query={
auditType:'BOTs',
actionStatus:'success'
actionStatus:'success',
isDeleted:false
};
auditTrail.getAuditTrails(query,function(err,data){
if(err){
Expand All @@ -200,7 +201,8 @@ auditTrailService.getBOTsSummary = function getBOTsSummary(callback){
totalNoOfRunningBots: function(callback){
var query={
auditType:'BOTs',
actionStatus:'running'
actionStatus:'running',
isDeleted:false
};
auditTrail.getAuditTrails(query,function(err,data){
if(err){
Expand All @@ -213,7 +215,9 @@ auditTrailService.getBOTsSummary = function getBOTsSummary(callback){
},
totalSavedTimeForBots: function(callback){
var query={
auditType:'BOTs'
auditType:'BOTs',
actionStatus:'success',
isDeleted:false
};
auditTrail.getAuditTrails(query,function(err,botAuditTrail){
if(err){
Expand Down Expand Up @@ -241,7 +245,8 @@ auditTrailService.getBOTsSummary = function getBOTsSummary(callback){
totalNoOfFailedBots: function(callback){
var query={
auditType:'BOTs',
actionStatus:'failed'
actionStatus:'failed',
isDeleted:false
};
auditTrail.getAuditTrails(query,function(err,data){
if(err){
Expand All @@ -267,7 +272,8 @@ auditTrailService.getBOTsSummary = function getBOTsSummary(callback){
auditTrailService.getBotsAuditTrailHistory = function getBotsAuditTrailHistory(botId,callback){
var query={
auditType:'BOTs',
auditId:botId
auditId:botId,
isDeleted:false
};
auditTrail.getAuditTrails(query,function(err,data){
if(err){
Expand Down
26 changes: 23 additions & 3 deletions server/app/services/botsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var bots = require('_pr/model/bots/bots.js');
var async = require("async");
var apiUtil = require('_pr/lib/utils/apiUtil.js');
var taskService = require('_pr/services/taskService.js');
var tasks = require('_pr/model/classes/tasks/tasks.js');
var auditTrailService = require('_pr/services/auditTrailService.js');
var blueprintService = require('_pr/services/blueprintService.js');
var auditTrail = require('_pr/model/audit-trail/audit-trail.js');
Expand Down Expand Up @@ -50,6 +51,8 @@ botsService.createOrUpdateBots = function createOrUpdateBots(botsDetail,linkedCa
botLinkedCategory: linkedCategory,
botLinkedSubCategory:linkedSubCategory,
manualExecutionTime:botsDetail.manualExecutionTime,
version:botsDetail.version,
domainNameCheck:botsDetail.domainNameCheck,
createdOn: new Date().getTime()
};
bots.getBotsById(botsDetail._id,function(err,data){
Expand Down Expand Up @@ -103,6 +106,23 @@ botsService.updateBotsScheduler = function updateBotsScheduler(botId,botObj,call
if (botsData[0].isBotScheduled === true) {
var catalystSync = require('_pr/cronjobs/catalyst-scheduler/catalystScheduler.js');
catalystSync.executeScheduledBots();
if(botsData[0].botLinkedCategory === 'Task'){
tasks.getTaskById(botId,function(err,task){
if(err){
logger.error("Error in fetching Task details",err);
}else if(task.isTaskScheduled === true){
tasks.updateTaskScheduler(botId,function(err,updateData){
if(err){
logger.error("Error in Updating Task details",err);
}
});
if(task.cronJobId && task.cronJobId !== null){
var cronTab = require('node-crontab');
cronTab.cancelJob(task.cronJobId);
}
}
});
}
} else if (botsData[0].cronJobId && botsData[0].cronJobId !== null) {
var cronTab = require('node-crontab');
cronTab.cancelJob(botsData[0].cronJobId);
Expand Down Expand Up @@ -279,9 +299,9 @@ botsService.executeBots = function executeBots(botId,reqBody,callback){
function(bots,next){
if(bots.length > 0){
if(bots[0].botLinkedCategory === 'Task'){
taskService.executeTask(botId,reqBody.userName ? reqBody.userName : 'system',reqBody.hostProtocol ? reqBody.hostProtocol : '',
reqBody.choiceParam ? reqBody.choiceParam : '',reqBody.appData ? reqBody.appData : '',reqBody.paramOptions ? reqBody.paramOptions : '',
reqBody.tagServer ? reqBody.tagServer : '', callback);
taskService.executeTask(botId,reqBody.userName ? reqBody.userName : 'system',reqBody.hostProtocol ? reqBody.hostProtocol : 'undefined',
reqBody.choiceParam ? reqBody.choiceParam : 'undefined',reqBody.appData ? reqBody.appData : 'undefined',reqBody.paramOptions ? reqBody.paramOptions : 'undefined',
reqBody.tagServer ? reqBody.tagServer : 'undefined', callback);
}else{
blueprintService.launch(botId,reqBody,callback)
}
Expand Down
5 changes: 4 additions & 1 deletion server/app/services/settingsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ settingsService.updateProjectData = function updateProjectData(enviornment,callb
};

settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callback){
if(id === '1'){
if(orgId === null || orgId === ''){
callback(null,orgId);
return;
}else if(id === '1'){
settingWizard.removeSettingWizardByOrgId(orgId,function(err,data){
if(err){
callback(err,null);
Expand Down
3 changes: 2 additions & 1 deletion server/app/services/taskService.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ taskService.getAllServiceDeliveryTask = function getAllServiceDeliveryTask(query
var query = {
auditType: 'BOTs',
actionStatus: queryObj.actionStatus,
auditCategory: 'Task'
auditCategory: 'Task',
isDeleted:false
};
var taskIds = [];
async.waterfall([
Expand Down