zyratlo opened a new pull request, #7601:
URL: https://github.com/apache/texera/pull/7601
### What changes were proposed in this PR?
Adds an "AI generate workflow" entry point on the workflow dashboard for the
Python notebook to Texera workflow migration tool. A user can upload a Jupyter
notebook (`.ipynb`) and get a generated Texera workflow without opening a
workflow first.
**Dashboard button (`user-workflow.component.{ts,html}`)**
- A new `robot` icon button in the workflows toolbar, styled like the
existing "Upload ZIP/JSON" button and gated on `pythonNotebookMigrationEnabled`
with a non read-only access level.
- `openAiGenerateModal()` opens the same `NotebookImportModalComponent` used
elsewhere, with no footer and centered.
- `generateWorkflowFromNotebook(file, model)` runs the pipeline in stages,
each with its own error toast: validate the `.ipynb` extension,
`parseAndTagNotebook(file)` to read and uuid-tag the cells,
`sendToAIGenerateWorkflow(notebook, model)` to call the LLM, then
`createWorkflow(...)` to persist the result. After the workflow exists, it
best-effort adds it to the current project, stores the notebook and cell
mapping, and navigates to the new workflow with `?autolayout=1`. Once the
workflow is created the flow never re-runs generation and never orphans the
workflow.
**Import modal (`notebook-import-modal.component.{ts,html,scss}`)**
- The modal keeps the diagram at the top and holds the form plus a solid
absolute loading overlay, so it does not resize or re-center when it swaps to
the loading view.
- The loading view shows a spinner, a "Generating your workflow" message,
and an elapsed-time stopwatch computed from a wall-clock start time so a
backgrounded tab cannot undercount.
- While generation runs the modal is locked: it is not closable,
mask-closable, or keyboard-dismissable, so a user cannot interrupt an in-flight
generation.
**Workspace auto-layout (`workspace.component.ts`)**
- On load the workspace reads `?autolayout=1`, renders the workflow
synchronously so the operators exist, runs auto-layout once, and then strips
the query param. The Jupyter notebook panel opens on its own through the
wid-driven `JupyterPanelService`. No generation code lives in the workspace.
**Shared mapping key (`notebook-migration.service.ts`,
`jupyter-panel.service.ts`)**
- `notebookMappingKey(wid)` is now the single source of truth for the cache
key shared by the dashboard store step and the Jupyter panel lookup.
**Behavior note**
- A wid is required to open the workspace, so the workflow is created before
navigation. If navigation is later blocked, the workflow is still saved and
reachable from the dashboard. This is intentional so a completed generation is
never lost.
#### Demo
https://github.com/user-attachments/assets/b42098fb-d240-440a-becb-1674ec81bc7c
Note: a mock LLM API was used in this demo so that we don't need to wait for
real-time generation. This does not affect any functionality for this PR.
### Any related issues, documentation, discussions?
Closes #7360
Parent issue #4301
### How was this PR tested?
Added and updated unit specs, with full line and branch coverage on the
changed code:
- `user-workflow.component.spec.ts`
- `notebook-import-modal.component.spec.ts`
- `workspace.component.spec.ts`
- `notebook-migration.service.spec.ts`
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
--
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]