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 @@ -51,9 +51,7 @@
keyboard: false,
resolve: {
items: function() {
return {
hist
};
return hist
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
"use strict";
angular.module('library.bots',[])
.controller('botLogsCtrl',['$scope', '$rootScope', '$http', 'genericServices', 'workzoneServices', 'toastr', '$modalInstance', 'items', '$timeout', function ($scope, $rootScope, $http, genSevs, workzoneServices, toastr, $modalInstance, items, $timeout) {
$scope.actionId = items.hist.actionLogId;
$scope.botName = items.hist.name;
$scope.nodeIds = items.hist.auditTrailConfig.nodeIds;
$scope.taskType = items.hist.auditTrailConfig.executionType;
$scope.nodeIdsWithActionLog = items.hist.auditTrailConfig.nodeIdsWithActionLog;
$scope.botName = items.auditTrailConfig.name;
$scope.nodeIds = items.auditTrailConfig.nodeIds;
$scope.taskType = items.auditTrailConfig.executionType;
$scope.nodeIdsWithActionLog = items.auditTrailConfig.nodeIdsWithActionLog;
$scope.isBotLogsLoading = true;
if($scope.taskType === 'jenkins') {
$scope.jenkinsActionLogId = items.actionLogId;
$scope.jenkinsBuildNumber = items.auditTrailConfig.jenkinsBuildNumber;
}
var helper = {
scrollBottom : function () {
$timeout(function () {
Expand All @@ -24,6 +27,9 @@
},
stopPolling: function () {
$timeout.cancel();
},
formatLogs: function(str) {
return str.replace(/\r?\n/g, "<br />");
}
};
$scope.instanceChange =function(){
Expand All @@ -35,35 +41,40 @@
});
};

var nodeIds = $scope.nodeIds;
var requestObj = {
"instanceIds": nodeIds
};
var bluePrintJob = false;
workzoneServices.postRetrieveDetailsForInstanceNames(requestObj).then(function (response) {
var _jobInstances = response.data;
//if blueprint job, use blueprintExecutionResults
for (var k = 0; k < $scope.nodeIdsWithActionLog.length; k++) {
for (var l = 0; l < _jobInstances.length; l++) {
if ($scope.nodeIdsWithActionLog[k].nodeId === _jobInstances[l]._id) {
$scope.nodeIdsWithActionLog[k].uiNodeName = _jobInstances[l].name;
console.log($scope.nodeIdsWithActionLog[k].uiNodeName);
}
}
var nodeIds = $scope.nodeIds;
var requestObj = {
"instanceIds": nodeIds
};
var bluePrintJob = false;
workzoneServices.postRetrieveDetailsForInstanceNames(requestObj).then(function (response) {
var _jobInstances = response.data;
for (var k = 0; k < $scope.nodeIdsWithActionLog.length; k++) {
for (var l = 0; l < _jobInstances.length; l++) {
if ($scope.nodeIdsWithActionLog[k].nodeId === _jobInstances[l]._id) {
$scope.nodeIdsWithActionLog[k].uiNodeName = _jobInstances[l].name;
console.log($scope.nodeIdsWithActionLog[k].uiNodeName);
}
$scope.selectedInstance = $scope.nodeIdsWithActionLog[0];
$scope.instanceChange();
/*chefLogData.chefHistoryItem = historyItem; //saved as we need timestamps from the historyItem
chefLogData.nodeIdsWithActionLog = nodeIdWithActionLogs; //this can now be used to show instance dropdown
if (chefLogData.nodeIdsWithActionLog[0]) {
$scope.isInstanceListLoading = false;
selectFirstInstance(chefLogData.nodeIdsWithActionLog[0]);
}*/
},
function (error) {
$scope.isBotLogsLoading = false;
console.log(error);
}
}
$scope.selectedInstance = $scope.nodeIdsWithActionLog[0];
$scope.instanceChange();
},
function (error) {
$scope.isBotLogsLoading = false;
console.log(error);
});
if($scope.taskType === 'jenkins') {
var url = '/jenkins/' + $scope.jenkinsActionLogId + '/jobs/testmail/builds/' + $scope.jenkinsBuildNumber + '/output';
$http.get(url).then(function (result) {
if (result.data) {
$scope.jenkinsLogs = helper.formatLogs(result.data.output);
$scope.isBotLogsLoading = false;
} else {
$scope.jenkinsLogs = helper.formatLogs(result.output);
$scope.isBotLogsLoading = false;
}
});
}

$scope.cancel = function() {
$modalInstance.dismiss('cancel');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h4 class="modal-title">
<div class="logsArea">
<loading size="large" name="isBotLogsLoading" align="center" type="block"></loading>
<div ng-show="!isBotLogsLoading">
<div ng-show="(taskType !== 'jenkins')">
<div ng-show="taskType !== 'jenkins'">
<div id="selectInstanceFromDropdown">
<label class="col-md-3 col-sm-3 col-xs-4 text-padding control-label margintop8">Select Instance<sup class="red">*</sup>
</label>
Expand All @@ -24,12 +24,11 @@ <h4 class="modal-title">
<span class="logInfo"> {{log.log}} </span>
</div>
</div>
</div>
<div ng-show="taskType === 'jenkins'">
<div class="rowSpacing col-lg-12 col-sm-12 {{log.err ? 'logErrorMsg':'logMsg'}}" ng-repeat="log in botLogs">
<span class="timeStamp"> {{log.timestamp | timestampToLocaleTime}} </span>
<span class="logInfo"> {{log.log}} </span>
</div>
<div ng-show="taskType === 'jenkins'">
<div class="rowSpacing col-lg-12 col-sm-12">
<p ng-bind-html="jenkinsLogs"></p>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h3 id="totalProviders">{{botSummary.totalNoOfBots}}</h3>
<div class="col-md-4ths infrastructureClass" data-text="Total Number of Providers">
<div class="small-box bg-aqua">
<div class="inner">
<h3 id="totalProviders">{{botSummary.totalNoOfSuccessBots}}</h3>
<h3 id="totalProviders">{{botSummary.totalNoOfRunningBots}}</h3>
<p>Total <br>Number of BOTs running</p>
</div>
<div class="icon">
Expand Down