diff --git a/awx/ui/client/src/smart-status/smart-status.block.less b/awx/ui/client/src/smart-status/smart-status.block.less index 0757529d45..afcafa951a 100644 --- a/awx/ui/client/src/smart-status/smart-status.block.less +++ b/awx/ui/client/src/smart-status/smart-status.block.less @@ -31,6 +31,12 @@ .pulsate(); } +.SmartStatus-vertCenter{ + margin-top: 10px; + margin-bottom: 10px; + padding: 0px; +} + .SmartStatus-tooltip{ text-align: left; max-width: 250px; diff --git a/awx/ui/client/src/smart-status/smart-status.controller.js b/awx/ui/client/src/smart-status/smart-status.controller.js index ff18ba9300..f1b8a541b9 100644 --- a/awx/ui/client/src/smart-status/smart-status.controller.js +++ b/awx/ui/client/src/smart-status/smart-status.controller.js @@ -12,6 +12,8 @@ export default ['$scope', '$filter', } function init(){ + var singleJobStatus = true; + var firstJobStatus; var recentJobs = $scope.jobs; var sparkData = _.sortBy(recentJobs.map(function(job) { @@ -34,9 +36,27 @@ export default ['$scope', '$filter', data.finished = $filter('longDate')(job.finished) || job.status+""; data.status_tip = "JOB ID: " + data.jobId + "
STATUS: " + data.smartStatus + "
FINISHED: " + data.finished; + // If we've already determined that there are both failed and successful jobs OR if the current job in the loop is + // pending/waiting/running then we don't worry about checking for a single job status + if(singleJobStatus && (isFailureState(job.status) || job.status === "successful")) { + if(firstJobStatus) { + // We've already been through at least once and have a first job status + if(!(isFailureState(firstJobStatus) && isFailureState(job.status) || firstJobStatus === job.status)) { + // We have a different status in the array + singleJobStatus = false; + } + } + else { + // We haven't set a first job status yet so go ahead set it + firstJobStatus = job.status; + } + } + return data; }), "sortDate").reverse(); + $scope.singleJobStatus = singleJobStatus; + $scope.sparkArray = sparkData; } $scope.$watchCollection('jobs', function(){ diff --git a/awx/ui/client/src/smart-status/smart-status.partial.html b/awx/ui/client/src/smart-status/smart-status.partial.html index e8fa03bc56..1e61aefe9e 100644 --- a/awx/ui/client/src/smart-status/smart-status.partial.html +++ b/awx/ui/client/src/smart-status/smart-status.partial.html @@ -13,7 +13,8 @@ DashboardList-status" ng-class="{'SmartStatus--success icon-job-successful': job.value === 1, 'SmartStatus--failed icon-job-successful': job.value === -1, - 'SmartStatus--running icon-job-successful': job.value === 0}"> + 'SmartStatus--running icon-job-successful': job.value === 0, + 'SmartStatus-vertCenter': singleJobStatus}">