feat(python-notebook-migration): add Jupyter panel mapping highlight service#5263
Open
zyratlo wants to merge 3 commits into
Open
feat(python-notebook-migration): add Jupyter panel mapping highlight service#5263zyratlo wants to merge 3 commits into
zyratlo wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Introduces
JupyterPanelServicecarrying the bidirectional cell to operator highlight orchestration, and the workflow-editor hook that calls into it on operator click.JupyterPanelServiceinit()— subscribes toworkflowMetaDataChanged()and is registered as anAPP_BOOTSTRAP_LISTENERinapp.module.tsso it starts on app bootstrap. On each workflow change: drops any stale mapping for the current workflow (inlinedeleteMapping("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 atriggerCellClickpostMessage tocustom.jsso thematching notebook cell scrolls into view and is highlighted.
precomputeHighlightMapping(private) — single-pass build of acellUUID → { components: opId[], edges: linkId[] }index from the stored mapping + the current graph's links. LetshandleNotebookMessagedo an O(1) lookup per cell click.handleNotebookMessage(private) —window.addEventListener("message", ...)handler installed in the constructor. Verifies origin againstnotebookMigrationService.getJupyterURL()before dispatchinghighlightFromCellforcellClickedevents.
highlightFromCell(private) — issues the actualunhighlightOperators/unhighlightLinks+highlightOperators/highlightLinkscalls againstWorkflowActionService.fetchNotebookAndMapping(private) —POST /api/notebook-migration/fetch-notebook-and-mapping; sets the mapping cache and forwards the notebook to JupyterLab. Returns1if both succeeded,0otherwise (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.tsis 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)