mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
adding click event for spark lines
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import smartStatusController from 'tower/smart-status/smart-status.controller.js';
|
||||
export default [ function() {
|
||||
export default [ '$location', function($location) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
link: function (scope){ //}, element ){ //}, attr) {
|
||||
link: function (scope){
|
||||
var str = scope.job_template.id+'_spark';
|
||||
scope[str].formatter = function(sparklines, options, point){
|
||||
return "<div class=\"smart-status-tooltip\"><span style=\"color: " + point.color + "\">●</span>" +
|
||||
options.userOptions.tooltipValueLookups.jobs[point.offset] + "</div>";
|
||||
"Job id: " +
|
||||
options.userOptions.tooltipValueLookups.jobs[point.offset] + "</div>" ;
|
||||
};
|
||||
|
||||
$('aw-smart-status:eq('+scope.$index+')').sparkline(scope[str].sparkArray, {
|
||||
type: 'tristate',
|
||||
width: '4em',
|
||||
height: '2em',
|
||||
barWidth: 5,
|
||||
barWidth: 7,
|
||||
barSpacing: 2,
|
||||
zeroBarColor: 'grey',
|
||||
posBarColor: '#00aa00', //@green on ansible-ui
|
||||
negBarColor: '#aa0000', //@red
|
||||
tooltipFormatter: scope[str].formatter,
|
||||
tooltipFormat: '{{value:jobs}}',
|
||||
tooltipValueLookups: {
|
||||
@@ -27,8 +31,16 @@ export default [ function() {
|
||||
// })
|
||||
}
|
||||
});
|
||||
|
||||
$('aw-smart-status:eq('+scope.$index+')').bind('sparklineClick', function(ev) {
|
||||
var sparkline = ev.sparklines[0],
|
||||
job = sparkline.getCurrentRegionFields(),
|
||||
id;
|
||||
id = sparkline.options.userOptions.tooltipValueLookups.jobs[job.offset];
|
||||
location.href = '/#/jobs/' + id;
|
||||
});
|
||||
|
||||
},
|
||||
// templateUrl: 'static/js/smart-status/smart-status.partial.html',
|
||||
controller: smartStatusController
|
||||
};
|
||||
}];
|
||||
|
||||
@@ -186,9 +186,10 @@ a:focus {
|
||||
}
|
||||
|
||||
.smart-status-tooltip{
|
||||
font-size: 20px;
|
||||
font-size: 14px;
|
||||
background-color: black;
|
||||
span {
|
||||
padding: 20px;
|
||||
padding: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user