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