mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Making the status even smarter
Incorporating the true status for each bar
This commit is contained in:
@@ -5,7 +5,8 @@ export default ['$scope', function ($scope) {
|
|||||||
$scope[str] = {
|
$scope[str] = {
|
||||||
id: $scope.job_template.id,
|
id: $scope.job_template.id,
|
||||||
sparkArray: [],
|
sparkArray: [],
|
||||||
jobIds: {}
|
jobIds: {},
|
||||||
|
smartStatus: []
|
||||||
};
|
};
|
||||||
for(var i=0; i<recentJobs.length; i++){
|
for(var i=0; i<recentJobs.length; i++){
|
||||||
if(recentJobs[i].status==='successful'){
|
if(recentJobs[i].status==='successful'){
|
||||||
@@ -18,6 +19,7 @@ export default ['$scope', function ($scope) {
|
|||||||
$scope[str].sparkArray[i] = 0;
|
$scope[str].sparkArray[i] = 0;
|
||||||
}
|
}
|
||||||
$scope[str].jobIds[i] = recentJobs[i].id;
|
$scope[str].jobIds[i] = recentJobs[i].id;
|
||||||
|
$scope[str].smartStatus[i] = recentJobs[i].status;
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,9 @@ export default [ function() {
|
|||||||
var str = scope.job_template.id+'_smart';
|
var str = scope.job_template.id+'_smart';
|
||||||
|
|
||||||
scope[str].formatter = function(sparklines, options, point){
|
scope[str].formatter = function(sparklines, options, point){
|
||||||
var status;
|
var status = options.userOptions.tooltipValueLookups.status[point.offset];
|
||||||
if(point.value === 1){
|
//capitalize first letter
|
||||||
status = "Successful";
|
status = status.charAt(0).toUpperCase() + status.slice(1);
|
||||||
}
|
|
||||||
else if(point.value === -1){
|
|
||||||
status = "Failed";
|
|
||||||
}
|
|
||||||
else if(isNaN(point.value)){
|
|
||||||
status = "Running";
|
|
||||||
}
|
|
||||||
return "<div class=\"smart-status-tooltip\">Job ID: " +
|
return "<div class=\"smart-status-tooltip\">Job ID: " +
|
||||||
options.userOptions.tooltipValueLookups.jobs[point.offset] +
|
options.userOptions.tooltipValueLookups.jobs[point.offset] +
|
||||||
"<br>Status: <span style=\"color: " + point.color + "\">●</span>"+status+"</div>" ;
|
"<br>Status: <span style=\"color: " + point.color + "\">●</span>"+status+"</div>" ;
|
||||||
@@ -33,7 +26,8 @@ export default [ function() {
|
|||||||
tooltipFormatter: scope[str].formatter,
|
tooltipFormatter: scope[str].formatter,
|
||||||
tooltipFormat: '{{value:jobs}}',
|
tooltipFormat: '{{value:jobs}}',
|
||||||
tooltipValueLookups: {
|
tooltipValueLookups: {
|
||||||
jobs: scope[str].jobIds
|
jobs: scope[str].jobIds,
|
||||||
|
status: scope[str].smartStatus
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user