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

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

                Author: ASF GitHub Bot
            Created on: 03/Mar/20 22:50
            Start Date: 03/Mar/20 22:50
    Worklog Time Spent: 10m 
      Work Description: KevinGG commented on pull request #11020: [BEAM-7926] 
Update Data Visualization
URL: https://github.com/apache/beam/pull/11020#discussion_r387315589
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/interactive/interactive_environment.py
 ##########
 @@ -43,6 +43,55 @@
 
 _LOGGER = logging.getLogger(__name__)
 
+# By `format(customized_script=xxx)`, the given `customized_script` is
+# guaranteed to be executed within access to a jquery with datatable plugin
+# configured which is useful so that any `customized_script` is resilient to
+# browser refresh. Inside `customized_script`, use `$` as jQuery.
+_JQUERY_WITH_DATATABLE_TEMPLATE = """
+        if (typeof window.jquery341 == 'undefined') {{
+          var jqueryScript = document.createElement('script');
+          jqueryScript.src = 
'https://code.jquery.com/jquery-3.4.1.slim.min.js';
+          jqueryScript.type = 'text/javascript';
+          jqueryScript.onload = function() {{
+            var datatableScript = document.createElement('script');
+            datatableScript.src = 
'https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js';
+            datatableScript.type = 'text/javascript';
+            datatableScript.onload = function() {{
+              window.jquery341 = jQuery.noConflict(true);
+              window.jquery341(document).ready(function($){{
+                {customized_script}
+              }});
+            }}
+            document.head.appendChild(datatableScript);
+          }};
+          document.head.appendChild(jqueryScript);
+        }} else {{
+          window.jquery341(document).ready(function($){{
+            {customized_script}
+          }});
+        }}"""
+
+_HTML_IMPORT_TEMPLATE = """
 
 Review comment:
   This uses something called `HTML import` where static HTML will be imported 
and embedded into current HTML.
   Here the HTML we desire is facets-jupyter.html.
   
   This feature is not supported by chrome anymore, thus requires the 
webcomponents JS lib.
   Similar to the jQuery template, we check if `HTML import` is supported by 
the browser, if so, import HTMLs else setup webcomponents and chain the `HTML 
import` to the end of `onload`.
   Note, we import HTMLs in the head for several reasons:
   1. In a notebook, DOM changes all the time. Keeping imported HTMLs in head 
makes sure all dependency HTMLs available all the time.
   2. `HTML import` only happens once per page load. There is no way to recover 
an imported HTML if you delete it from DOM unless you refresh the page.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 397100)
    Time Spent: 51.5h  (was: 51h 20m)

> Show PCollection with Interactive Beam in a data-centric user flow
> ------------------------------------------------------------------
>
>                 Key: BEAM-7926
>                 URL: https://issues.apache.org/jira/browse/BEAM-7926
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-py-interactive
>            Reporter: Ning Kang
>            Assignee: Ning Kang
>            Priority: Major
>          Time Spent: 51.5h
>  Remaining Estimate: 0h
>
> Support auto plotting / charting of materialized data of a given PCollection 
> with Interactive Beam.
> Say an Interactive Beam pipeline defined as
>  
> {code:java}
> p = beam.Pipeline(InteractiveRunner())
> pcoll = p | 'Transform' >> transform()
> pcoll2 = ...
> pcoll3 = ...{code}
> The use can call a single function and get auto-magical charting of the data.
> e.g.,
> {code:java}
> show(pcoll, pcoll2)
> {code}
> Throughout the process, a pipeline fragment is built to include only 
> transforms necessary to produce the desired pcolls (pcoll and pcoll2) and 
> execute that fragment.
> This makes the Interactive Beam user flow data-centric.
>  
> Detailed 
> [design|https://docs.google.com/document/d/1DYWrT6GL_qDCXhRMoxpjinlVAfHeVilK5Mtf8gO6zxQ/edit#heading=h.v6k2o3roarzz].



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

Reply via email to