[ 
https://issues.apache.org/jira/browse/BEAM-7923?focusedWorklogId=413572&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-413572
 ]

ASF GitHub Bot logged work on BEAM-7923:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 31/Mar/20 22:30
            Start Date: 31/Mar/20 22:30
    Worklog Time Spent: 10m 
      Work Description: KevinGG commented on pull request #11276: [BEAM-7923] 
An indicator of progress in notebooks
URL: https://github.com/apache/beam/pull/11276#discussion_r401251743
 
 

 ##########
 File path: sdks/python/apache_beam/runners/interactive/utils.py
 ##########
 @@ -142,3 +142,61 @@ def obfuscate(*inputs):
   str_inputs = [str(input) for input in inputs]
   merged_inputs = '_'.join(str_inputs)
   return hashlib.md5(merged_inputs.encode('utf-8')).hexdigest()
+
+
+class ProgressIndicator(object):
+  """An indicator visualizing code execution in progress."""
+  spinner_template = """
+            <link rel="stylesheet" 
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"; 
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
 crossorigin="anonymous">
+            <div id="{id}" class="spinner-border text-info" role="status">
+            </div>"""
+  spinner_removal_template = """
+            $("#{id}").remove();"""
+
+  def __init__(self, enter_text, exit_text):
+    # type: (str, str) -> None
+
+    self._id = 'progress_indicator_{}'.format(obfuscate(id(self)))
 
 Review comment:
   `obfuscate` is defined within the same module.
   It's a way to disguise your backend logic from the frontend, basically a 
hash. It's common to see obfuscation in Javascripts.
   Here we obfuscates the id of a python object in kernel and use it as part of 
the id of a Javascript div.
   Here is some additional reading about obfuscate: 
https://medium.com/nodesimplified/obfuscation-what-is-obfuscation-in-javascript-why-obfuscation-is-used-f6a5f5bcf022
   
   We also make this hexadigest so that the final id is always usable by jQuery 
and plain JavaScript as valid selectors.
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 413572)
    Time Spent: 13h 40m  (was: 13.5h)

> Interactive Beam
> ----------------
>
>                 Key: BEAM-7923
>                 URL: https://issues.apache.org/jira/browse/BEAM-7923
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-py-interactive
>            Reporter: Ning Kang
>            Assignee: Ning Kang
>            Priority: Major
>          Time Spent: 13h 40m
>  Remaining Estimate: 0h
>
> This is the top level ticket for all efforts leveraging [interactive 
> Beam|[https://github.com/apache/beam/tree/master/sdks/python/apache_beam/runners/interactive]]
> As the development goes, blocking tickets will be added to this one.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to