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

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

                Author: ASF GitHub Bot
            Created on: 26/Aug/20 11:04
            Start Date: 26/Aug/20 11:04
    Worklog Time Spent: 10m 
      Work Description: prodonjs commented on a change in pull request #12626:
URL: https://github.com/apache/beam/pull/12626#discussion_r475658123



##########
File path: 
sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/src/inspector/InspectableList.tsx
##########
@@ -0,0 +1,99 @@
+// Licensed under the Apache License, Version 2.0 (the 'License'); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
+import * as React from 'react';
+
+import { CollapsibleList, SimpleListItem, ListDivider } from '@rmwc/list';
+
+import { InspectableListItem } from './InspectableListItem';
+import { InspectableViewModel } from './InspectableViewModel';
+
+import '@rmwc/list/styles';
+
+export interface IInspectableMeta {
+  name: string;
+  // The id() value of the inspectable item in the kernel.
+  inMemoryId: number;
+  type: string;
+}
+
+interface IKeyedInspectableMeta {
+  [key: string]: IInspectableMeta;
+}
+
+interface IInspectableListProps {
+  inspectableViewModel?: InspectableViewModel;
+  id: string;
+  metadata: IInspectableMeta;
+  pcolls: IKeyedInspectableMeta;
+}
+
+/**
+ * The PCollection sub list of the side list of the InteractiveInspector parent
+ * component.
+ *
+ * Each sub list only contains listing of PCollections for one pipeline.
+ *
+ * The pipeline item functions as a header of the collapsible sub list. It
+ * alters the shared inspectableViewModel of the display area on click to query
+ * and display a graph that is the DOT representation of the pipeline.
+ */
+export class InspectableList extends React.Component<
+  IInspectableListProps,
+  {}
+> {
+  constructor(props: IInspectableListProps) {
+    super(props);
+  }
+
+  render(): React.ReactNode {
+    const pcollListItems = Object.entries(this.props.pcolls).map(

Review comment:
       Just a nit, but you could probably move this and the onClick function 
out to private methods to make the logical separation a bit more readable. Or, 
since there is no state to this component, you could write it as a pure 
functional component that accepts props and returns the React node.

##########
File path: 
sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/src/inspector/InspectableView.tsx
##########
@@ -0,0 +1,128 @@
+// Licensed under the Apache License, Version 2.0 (the 'License'); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
+import * as React from 'react';
+
+import { Checkbox } from '@rmwc/checkbox';
+
+import {
+  InspectableViewModel,
+  IOptions,
+  IShowOptions
+} from './InspectableViewModel';
+import { HtmlView } from '../common/HtmlView';
+import { IHtmlProvider } from '../common/HtmlView';
+
+import '@rmwc/checkbox/styles';
+
+interface IInspectableViewProps {
+  model: InspectableViewModel;
+}
+
+interface IInspectableViewState {
+  inspectableType: string;
+  // options used in kernel messaging.
+  options: IOptions;
+}
+
+/**
+ * The display area of the InteractiveInspector parent component.
+ *
+ * The react component is composed with a top checkbox section of display
+ * options and a main HtmlView area that displays HTML from IOPub messaging of
+ * its kernel model.
+ */
+export class InspectableView extends React.Component<
+  IInspectableViewProps,
+  IInspectableViewState
+> {
+  constructor(props: IInspectableViewProps) {
+    super(props);
+    this.state = {
+      inspectableType: 'pipeline',
+      options: props.model.options
+    };
+  }
+
+  componentDidMount(): void {
+    this._updateRenderTimerId = setInterval(() => this.updateRender(), 1500);
+  }
+
+  componentWillUnmount(): void {
+    clearInterval(this._updateRenderTimerId);
+  }
+
+  updateRender(): void {
+    if (this.props.model.inspectableType === 'pcollection') {
+      this.setState({
+        inspectableType: 'pcollection',
+        options: this._buildShowOptions(this.props.model.options)
+      });
+    } else {
+      this.setState({
+        inspectableType: 'pipeline',
+        options: {}
+      });
+    }
+  }
+
+  renderOptions(): React.ReactNode {
+    if (this.props.model.inspectableType === 'pcollection') {

Review comment:
       *nit* you can reduce the nesting level for the `pcollection` case if you 
put put the inverse condition first and short-circuit the return for the empty 
span.




----------------------------------------------------------------
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: 474766)
    Time Spent: 6h 40m  (was: 6.5h)

> Apache Beam JupyterLab SidePanel
> --------------------------------
>
>                 Key: BEAM-10545
>                 URL: https://issues.apache.org/jira/browse/BEAM-10545
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-py-interactive
>            Reporter: Ning Kang
>            Assignee: Ning Kang
>            Priority: P2
>          Time Spent: 6h 40m
>  Remaining Estimate: 0h
>
> Create a JupyterLab extension to provide information and controls 
> interactively when running Apache Beam notebooks in JupyterLab.
> Design 
> [doc|https://docs.google.com/document/d/1aKK8TzSrl8WiG0K4v9xZEfLMCinuGqRlMOyb7xOhgy4/edit?usp=sharing]
> A vote has been held, and the name of the extension is selected: 
> apache-beam-jupyterlab-sidepanel



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

Reply via email to