zyratlo opened a new pull request, #7392:
URL: https://github.com/apache/texera/pull/7392

   ### What changes were proposed in this PR?
   
   Adds a second entry point for the Python notebook to Texera workflow 
migration tool. Until now the only way to start a conversion was the "AI 
generate workflow" button in the workspace toolbar, which requires a workflow 
already open on the canvas. This PR adds an equivalent button on the workflow 
dashboard so a user can start the flow without opening a workflow first. It 
reuses the existing import modal (#7314) and the existing generation pipeline 
(#5273) rather than duplicating them.
   
   **Dashboard button (`user-workflow.component.{ts,html}`)**
   - A new icon button in the workflows toolbar
   - `openAiGenerateModal()` opens the same `NotebookImportModalComponent` used 
by the canvas menu
   - `startAiGeneratedWorkflow(file, model)` validates the `.ipynb` extension, 
creates a new empty workflow, records the selected file and model for the 
workspace to pick up, and navigates to the new workflow.
   
   **Handoff and workspace trigger (`notebook-migration.service.ts`, 
`menu.component.ts`)**
   - The dashboard has no canvas to run the generation on, so generation is 
deferred to the workspace. `NotebookMigrationService` gains a one time handoff 
slot (`setPendingGeneration` / `consumePendingGeneration`) keyed by the new 
workflow's wid.
   - The workspace menu consumes the slot in its existing workflow modifiable 
subscription: once the freshly created workflow is loaded and editable, it runs 
the same `onClickImportNotebook(file, model)` pipeline the toolbar button uses
   
   **Import modal (`notebook-import-modal.component.{ts,html}`)**
   - The "generating overwrites your current workflow" warning is specific to 
the canvas flow, where a workflow is already open. `NotebookImportModalData` 
gains an optional `showOverwriteWarning` flag. It defaults to shown when unset 
(canvas behavior unchanged) and the dashboard sets it false, since the 
dashboard always creates a new workflow and has nothing to overwrite.
   
   **Behavior note**
   - The dashboard creates the new workflow before generation runs, because a 
wid is required to open the workspace (routing only exposes `workflow/:id`). If 
generation then fails, an empty "Untitled workflow" remains saved, which 
differs from the canvas flow where an already open workflow is overwritten.
   
   #### Demo
   
   
   
https://github.com/user-attachments/assets/1f315e7e-0ffc-426e-9f5b-eb868385473f
   
   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 unit specs:
   - `notebook-migration.service.spec.ts`
   - `menu.component.spec.ts`
   - `notebook-import-modal.component.spec.ts`
   - `user-workflow.component.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]

Reply via email to