1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Making the status even smarter

Incorporating the true status for each bar
This commit is contained in:
Jared Tabor 2015-03-10 12:04:14 -04:00
parent 9295ac78fd
commit 7c9b6f5269
2 changed files with 8 additions and 12 deletions

View File

@ -5,7 +5,8 @@ export default ['$scope', function ($scope) {
$scope[str] = {
id: $scope.job_template.id,
sparkArray: [],
jobIds: {}
jobIds: {},
smartStatus: []
};
for(var i=0; i<recentJobs.length; i++){
if(recentJobs[i].status==='successful'){
@ -18,6 +19,7 @@ export default ['$scope', function ($scope) {
$scope[str].sparkArray[i] = 0;
}
$scope[str].jobIds[i] = recentJobs[i].id;
$scope[str].smartStatus[i] = recentJobs[i].status;
}
}];

View File

@ -6,16 +6,9 @@ export default [ function() {
var str = scope.job_template.id+'_smart';
scope[str].formatter = function(sparklines, options, point){
var status;
if(point.value === 1){
status = "Successful";
}
else if(point.value === -1){
status = "Failed";
}
else if(isNaN(point.value)){
status = "Running";
}
var status = options.userOptions.tooltipValueLookups.status[point.offset];
//capitalize first letter
status = status.charAt(0).toUpperCase() + status.slice(1);
return "<div class=\"smart-status-tooltip\">Job ID: " +
options.userOptions.tooltipValueLookups.jobs[point.offset] +
"<br>Status: <span style=\"color: " + point.color + "\">&#9679;</span>"+status+"</div>" ;
@ -33,7 +26,8 @@ export default [ function() {
tooltipFormatter: scope[str].formatter,
tooltipFormat: '{{value:jobs}}',
tooltipValueLookups: {
jobs: scope[str].jobIds
jobs: scope[str].jobIds,
status: scope[str].smartStatus
}
});