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

   ### What changes were proposed in this PR?
   Introduces the user-facing entry point for the Python-notebook to 
Texera-workflow migration tool: an "AI Generate Workflow from Python Notebook" 
modal in the workspace menu, a workspace-level loading overlay with an 
elapsed-time stopwatch that shows while the LLM is converting, and the 
`<texera-jupyter-notebook-panel>` host that places the iframe panel landed in 
`migration-tool-jupyter-panel` into the workspace.
   
   **`menu.component.{ts,html}`**
     - Adds a `public get pythonNotebookMigrationEnabled(): boolean` getter on 
`MenuComponent` that returns `config.env.pythonNotebookMigrationEnabled`
     - Adds an `@Output() setWaitingForLLM = new EventEmitter<boolean>()` that 
the workspace component consumes to gate the loading overlay.
     - Adds `importForm: FormGroup` (`description`, `file` with required 
validator, `model`, `apiKey`) and a `ViewChild` reference to 
`#importNotebookModal`.
     - `openImportNotebookModal()` opens an `NzModalService` modal; loads the 
model dropdown via `notebookMigrationService.getAvailableModels()`.
     - `beforeUpload(file)` patches the chosen file into the form without 
triggering an auto-upload.
     - `onClickImportNotebook(file, model, apiKey)` is the main action.
         - Validates the `.ipynb` extension
         - emits `setWaitingForLLM(true)`
         - reads the file
         - tags every code cell with a UUID in `metadata.uuid`
         - calls `sendNotebookToJupyter(...)` (so the user can see the notebook 
in the embedded JupyterLab
         - calls `sendToAIGenerateWorkflow(...)`
             - persists the result via 
`workflowPersistService.persistWorkflow(...)`
         - calls `notebookMigrationService.storeNotebookAndMapping(...)` to 
persist the mapping in Postgres
         - reloads the workflow via `workflowActionService.reloadWorkflow(...)`
         - opens the iframe panel via 
`jupyterPanelService.openPanel("JupyterNotebookPanel")`
         - Emits `setWaitingForLLM(false)` in `finally`.
     - HTML
         - adds the AI Generate button (gated on 
`*ngIf="pythonNotebookMigrationEnabled"`)
         - adds the modal template `#importNotebookModal` popup diagram image
   
     **`workspace.component.{ts,html,scss}` — panel host + loading overlay:**
     - TS adds `isWaitingForLLM: boolean`, `timerInterval`, `startTime`, the 
`onWaitingForLLMChanged(isWaiting)` handler bound to the menu's output, 
`startTimer` / `stopTimer` / `updateElapsedTime` helpers, and a 
`formattedElapsedTime` getter that returns `mm:ss`.
     - HTML adds the `<texera-jupyter-notebook-panel>` host (which subscribes 
to the visibility surface added in `migration-tool-panel-controls` to know when 
to render) and the loading overlay (`*ngIf="isWaitingForLLM"`)
   
     **Image asset:**
     - `frontend/src/assets/notebook_migration_tool/tool_popup_diagram.png`
         - diagram embedded at the top of the modal that walks the user through 
what the tool does.
   
   
   ### Any related issues, documentation, discussions?
   Closes #4427 
   Parent issue #4301 
   
   
   ### How was this PR tested?
   Manual end-to-end on a branch where all the dep PRs were merged: enabled the 
flag, opened the workspace menu, clicked AI Generate Workflow, picked a sample 
`.ipynb`, picked a LiteLLM model, entered an API key, and watched the spinner 
tick up while the conversion ran. After ~30s the workflow appeared in the 
editor with `PythonUDFV2` operators in place, the panel auto-opened with the 
notebook visible in the embedded JupyterLab, and clicking an operator scrolled 
the corresponding notebook cell into view. Clicking a cell highlighted its 
corresponding operators.
   
   ### 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]

Reply via email to