Skip to content

feat(python-notebook-migration): add Jupyter panel mapping highlight service#5263

Open
zyratlo wants to merge 3 commits into
apache:mainfrom
zyratlo:migration-tool-mapping-highlighting
Open

feat(python-notebook-migration): add Jupyter panel mapping highlight service#5263
zyratlo wants to merge 3 commits into
apache:mainfrom
zyratlo:migration-tool-mapping-highlighting

Conversation

@zyratlo
Copy link
Copy Markdown
Contributor

@zyratlo zyratlo commented May 28, 2026

What changes were proposed in this PR?

Introduces JupyterPanelService carrying the bidirectional cell to operator highlight orchestration, and the workflow-editor hook that calls into it on operator click.

JupyterPanelService

  • init() — subscribes to workflowMetaDataChanged() and is registered as an APP_BOOTSTRAP_LISTENER in app.module.ts so it starts on app bootstrap. On each workflow change: drops any stale mapping for the current workflow (inline
    deleteMapping("mapping_wid_" + currentWid)), then fetches the new workflow's stored notebook + mapping from the microservice, sends the notebook to JupyterLab, and pre-computes the highlight index.
  • setIframeRef(iframe) — called by the panel component (lands in PR 5) once its iframe is in the DOM.
  • onWorkflowComponentClick(cellUUID) — public entry called by the workflow-editor's operator-click handler. If the iframe is present and the cell-UUID is mapped to operators, sends a triggerCellClick postMessage to custom.js so the
    matching notebook cell scrolls into view and is highlighted.
  • precomputeHighlightMapping (private) — single-pass build of a cellUUID → { components: opId[], edges: linkId[] } index from the stored mapping + the current graph's links. Lets handleNotebookMessage do an O(1) lookup per cell click.
  • handleNotebookMessage (private) — window.addEventListener("message", ...) handler installed in the constructor. Verifies origin against notebookMigrationService.getJupyterURL() before dispatching highlightFromCell for cellClicked
    events.
  • highlightFromCell (private) — issues the actual unhighlightOperators / unhighlightLinks + highlightOperators / highlightLinks calls against WorkflowActionService.
  • fetchNotebookAndMapping (private) — POST /api/notebook-migration/fetch-notebook-and-mapping; sets the mapping cache and forwards the notebook to JupyterLab. Returns 1 if both succeeded, 0 otherwise (caught errors included).
    Currently exposed via (service as any).fetchNotebookAndMapping(...) in the spec.

Any related issues, documentation, discussions?

Closes #5053
Parent issue #4301

How was this PR tested?

New test file jupyter-panel.service.spec.ts is added alongside the main service file.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.7)

@Yicong-Huang Yicong-Huang changed the title feat(python-notebook-migration, frontend): add Jupyter panel mapping highlight service feat(python-notebook-migration): add Jupyter panel mapping highlight service May 28, 2026
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Notebook Migration] 5. Add Mapping between Notebook and Workflow

1 participant