mirror of
https://github.com/ansible/awx.git
synced 2026-04-04 09:45:06 -02:30
Vertically center smart status icons if they are all of one type
This commit is contained in:
@@ -31,6 +31,12 @@
|
|||||||
.pulsate();
|
.pulsate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.SmartStatus-vertCenter{
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.SmartStatus-tooltip{
|
.SmartStatus-tooltip{
|
||||||
text-align: left;
|
text-align: left;
|
||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ export default ['$scope', '$filter',
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
|
var singleJobStatus = true;
|
||||||
|
var firstJobStatus;
|
||||||
var recentJobs = $scope.jobs;
|
var recentJobs = $scope.jobs;
|
||||||
var sparkData =
|
var sparkData =
|
||||||
_.sortBy(recentJobs.map(function(job) {
|
_.sortBy(recentJobs.map(function(job) {
|
||||||
@@ -34,9 +36,27 @@ export default ['$scope', '$filter',
|
|||||||
data.finished = $filter('longDate')(job.finished) || job.status+"";
|
data.finished = $filter('longDate')(job.finished) || job.status+"";
|
||||||
data.status_tip = "JOB ID: " + data.jobId + "<br>STATUS: " + data.smartStatus + "<br>FINISHED: " + data.finished;
|
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;
|
return data;
|
||||||
}), "sortDate").reverse();
|
}), "sortDate").reverse();
|
||||||
|
|
||||||
|
$scope.singleJobStatus = singleJobStatus;
|
||||||
|
|
||||||
$scope.sparkArray = sparkData;
|
$scope.sparkArray = sparkData;
|
||||||
}
|
}
|
||||||
$scope.$watchCollection('jobs', function(){
|
$scope.$watchCollection('jobs', function(){
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
DashboardList-status"
|
DashboardList-status"
|
||||||
ng-class="{'SmartStatus--success icon-job-successful': job.value === 1,
|
ng-class="{'SmartStatus--success icon-job-successful': job.value === 1,
|
||||||
'SmartStatus--failed 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>
|
</i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user