You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Ash Berlin-Taylor (JIRA)" <ji...@apache.org> on 2019/04/18 17:15:00 UTC

[jira] [Commented] (AIRFLOW-4357) Tool tip offset when using RBAC

    [ https://issues.apache.org/jira/browse/AIRFLOW-4357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16821321#comment-16821321 ] 

Ash Berlin-Taylor commented on AIRFLOW-4357:
--------------------------------------------

I have a horrible hack that works but I don't like it.

{code:title=patch.diff}
diff --git a/airflow/www_rbac/static/js/base.js b/airflow/www_rbac/static/js/base.js
index f9385481..d955e2ac 100644
--- a/airflow/www_rbac/static/js/base.js
+++ b/airflow/www_rbac/static/js/base.js
@@ -72,6 +72,30 @@ function postAsForm(url, parameters) {
 window.postAsForm = postAsForm;

 $(document).ready(function () {
+
+  // This is a _HORRIBLE_ hack. This used to look like
+  // https://github.com/twbs/bootstrap/blob/v3.3.7/js/tooltip.js#L367-L372
+  // which didn't call $el.offset() on SVG. But rather than fixing it as the
+  // comment said that made it worse for us.
+  //
+  // Instead of doing this we should upgrade, but that is more work. AIRFLOW-4179
+  jQuery.fn.tooltip.Constructor.prototype.getPosition = function ($element) {
+    $element   = $element || this.$element
+
+    var el     = $element[0]
+    var isBody = el.tagName == 'BODY'
+
+    var elRect    = el.getBoundingClientRect()
+    if (elRect.width == null) {
+      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
+      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
+    }
+    var elOffset  = isBody ? { top: 0, left: 0 } : $element.offset()
+    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
+    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
+
+    return $.extend({}, elRect, scroll, outerDims, elOffset)
+  }
{code}

(Against 1.10 cos that's what I had checked out, but should work with master with just a change of filename)

> Tool tip offset when using RBAC
> -------------------------------
>
>                 Key: AIRFLOW-4357
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4357
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: webserver
>    Affects Versions: 1.10.2, 1.10.3
>         Environment: Fedora 29 with Python 3.5.6 from conda
>            Reporter: Charles Surett
>            Priority: Minor
>              Labels: rbac, web
>         Attachments: Expected Behavior.png, Issue.png, installed-packages.txt
>
>
> Tool tips are offset when the page is scrolled when using the RBAC web UI
>  
> See attached images for more details.
>  
> It seems to be related to [https://github.com/twbs/bootstrap/blob/v3.3.7/js/tooltip.js#L367-L372]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)