Skip to content

feat(python-notebook-migration, frontend): add AI-generate-workflow modal, panel host, and LLM loading spinner#5273

Open
zyratlo wants to merge 1 commit into
apache:mainfrom
zyratlo:migration-tool-modal
Open

feat(python-notebook-migration, frontend): add AI-generate-workflow modal, panel host, and LLM loading spinner#5273
zyratlo wants to merge 1 commit into
apache:mainfrom
zyratlo:migration-tool-modal

Conversation

@zyratlo
Copy link
Copy Markdown
Contributor

@zyratlo zyratlo commented May 28, 2026

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)

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label May 28, 2026
@codecov-commenter
Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Notebook Migration] 2. Add Notebook Upload Modal

2 participants