zyratlo opened a new pull request, #5263:
URL: https://github.com/apache/texera/pull/5263
### 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)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]