Vertically center smart status icons if they are all of one type

This commit is contained in:
Michael Abashian 2016-07-27 13:30:12 -04:00
parent 7c16c8c6e7
commit 3e5244821f
3 changed files with 28 additions and 1 deletions

View File

@ -31,6 +31,12 @@
.pulsate();
}
.SmartStatus-vertCenter{
margin-top: 10px;
margin-bottom: 10px;
padding: 0px;
}
.SmartStatus-tooltip{
text-align: left;
max-width: 250px;

View File

@ -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 + "<br>STATUS: " + data.smartStatus + "<br>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(){

View File

@ -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}">
</i>
</a>
</div>