From 1b05c8fb57e304a21049055c920beb3ffc05102a Mon Sep 17 00:00:00 2001 From: Thomas Cook Date: Tue, 16 Jan 2024 18:02:28 -0600 Subject: [PATCH] fix: #539 - databricks login link and timer switch to javascript to handle async better --- graphistry/pygraphistry.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/graphistry/pygraphistry.py b/graphistry/pygraphistry.py index f91d061dd..7c56874f0 100644 --- a/graphistry/pygraphistry.py +++ b/graphistry/pygraphistry.py @@ -282,14 +282,34 @@ def _handle_auth_url(auth_url, sso_timeout, sso_opt_into_type): """ if in_ipython() or in_databricks() or sso_opt_into_type == 'display': # If run in notebook, just display the HTML - # from IPython.core.display import HTML from IPython.display import display, HTML - display(HTML(f'old: Login SSO')) - display(Markdown(f'[new: Login SSO]({auth_url})')) - print("Please click the above URL to open browser to login") - print(f"If you cannot see the URL, please open browser, browse to this URL: {auth_url}") - print("Please close browser tab after SSO login to back to notebook") - # return HTML(make_iframe(auth_url, 20, extra_html=extra_html, override_html_style=override_html_style)) + + # this function was required due to bug where databricks notebooks do not display the html link while a timer is running + def display_link_and_timer(auth_url, sso_timeout): + html_content = f""" + Graphistry SSO Login

+
Timer starts...
+ + + """ + display(HTML(html_content)) + + display_link_and_timer(auth_url, sso_timeout) + elif sso_opt_into_type == 'browser': print("Please minimize browser after your SSO login and go back to pygraphistry")