zyratlo opened a new pull request, #8912: URL: https://github.com/apache/texera/pull/8912
### What changes were proposed in this PR? > [!NOTE] > Stacked on #8911, which is stacked on #8910. Until those merge, this diff also shows their commits. This is the last of three PRs adding R support to the migration tool (#8009). It puts the R conversion from #8911 in front of users, behind the `rNotebookMigrationEnabled` flag added there. **Import modal.** An "R Code" tab appears when the R flag is on. Its upload row has a Notebook / File switch in front of the upload button, accepting `.ipynb` or `.R` / `.r`. R gets one tab rather than one per input kind so the tab bar still fits once R folders are added: they become a third option in the switch. The switch is a `FormControl`, so it keeps its value when the tab re-renders, and changing it clears the staged file the same way changing tabs does. To fit the switch, the shared upload row template gains an optional slot rendered in front of the button. The modal now passes a `language` to `requestImport`, `"r"` on this tab and `"python"` everywhere else. **Dispatch.** The dashboard routes by language first, then by extension. Each language's accepted script extension and its error messages come from one small table, so Python's messages are word for word unchanged. An `.ipynb` uploaded on the R tab whose `kernelspec.language` is set and is not R is rejected with a message pointing to the Jupyter Notebook tab, before any model call. A notebook without a kernelspec is accepted. **Assets.** A new diagram for the tab, at the same size and border as the other three. It reuses the Material Symbols icons the others use, so `frontend/LICENSE-binary` adds its path to that entry. #### Demo video https://github.com/user-attachments/assets/5b825d66-6b52-41c7-976b-28e3f5c3d574 ### Any related issues, documentation, discussions? Part of #8009 Parent-issue #4301 The plan is in https://github.com/apache/texera/discussions/8866. R notebooks open in the Jupyter panel without a kernel, since the Jupyter image has no R kernel. #8909 (#8908) makes that work: without it, the panel shows a "Kernel not found" dialog and the cells stay editable. R folders are the remaining part of #8009, so this PR does not close it. ### How was this PR tested? * `notebook-import-modal.component.spec.ts`, five new tests: the tab is hidden while the R flag is off; it shows its diagram, the "R Code" title and the switch inside the upload row; clicking File switches the accepted extensions and drops the staged notebook; the switch keeps its value across a re-render; and submit passes `"r"`. Existing assertions now expect `"python"`. * `user-workflow.component.spec.ts`, seven new tests: `.R` and `.r` convert as R scripts; R notebooks convert as R, with or without a kernelspec; a Python kernel notebook and a `.py` are rejected on the R tab; and an unreadable R file gets R wording. Coverage of both components covers every new line and branch. The dashboard's three uncovered branches predate this change. The full frontend suite passes. End to end with a live model, against a local stack with texera-rudf installed: * A Python kernel notebook on the R tab is rejected, and the modal stays open with the selection kept. * An R script converts to five Table API `RUDF` operators. Connected to the dataset and run, it reports the same accuracies as the original script in `Rscript`, and its ggplot boxplot renders through an HTML Visualizer. Clicking an operator highlights its cell in the Jupyter panel. * An R notebook converts to seven `RUDF` operators following the same rules, and the panel shows the uploaded notebook. * A Python file still converts to `PythonUDFV2` operators, unchanged. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) -- 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]
