ashb commented on a change in pull request #8269: [AIRFLOW-4357] Fix SVG
tooltip positioning with custom scripting
URL: https://github.com/apache/airflow/pull/8269#discussion_r408004596
##########
File path: airflow/www/templates/airflow/dags.html
##########
@@ -554,5 +552,33 @@ <h2>DAGs</h2>
$(".loading-task-stats").remove();
$(".loading-dag-stats").remove();
}
+
+ function showSvgTooltip(text, offsetTop, offsetLeft) {
+ var tip = $('#svg-tooltip');
+ tip.children('.tooltip-inner').text(text);
+ var centeringOffset = tip.width() / 2;
+ tip.css({
+ "display": "block",
+ "left": offsetLeft + 12.5 - centeringOffset + 'px',// 12.5 == half of
circle width
+ "top": offsetTop - 25 + 'px'// 25 == position above circle
+ });
+ }
+
+ function hideSvgTooltip() {
+ $('#svg-tooltip').css('display', 'none');
+ }
+
+ $(window).on('load', function() {
+ $('body').on('mouseover', '.has-svg-tooltip', function(e) {
+ var elem = e.target;
+ var text = elem.getAttribute('title');
+ var circ = document.getElementById(elem.id).getBoundingClientRect();
Review comment:
Isn't `document.getElementById(elem.id)` just `elem`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services