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

   ### What changes were proposed in this PR?
   
   This is a behavior-preserving refactor that extracts the "create computing 
unit" modal, previously duplicated verbatim between the workspace power button 
(`computing-unit-selection.component`) and the dashboard Computing Units page 
(`user-computing-unit.component`), into a new shared standalone component 
`ComputingUnitCreateModalComponent` under 
`frontend/src/app/common/component/computing-unit-create-modal/`. The shared 
component owns the whole form (unit type, name, CPU/memory/GPU selects, JVM 
memory slider, shared memory size, local URI), the option fetching from 
`getComputingUnitTypes()`/`getComputingUnitLimitOptions()`, validation, and the 
create call; hosts embed it with `[(visible)]` and react to `(unitCreated)` — 
the workspace host selects the newly created unit for the current workflow, and 
the dashboard host refreshes its list.
   
   Two call-site notes for reviewers: `menu.component`'s run-workflow flow used 
to seed the modal's name field by writing the host's field directly; it now 
passes the default name through a new optional parameter on 
`showAddComputeUnitModalVisible(defaultName?)`, which forwards to the embedded 
modal via `ViewChild`. And the workspace host keeps a slimmed 
`getComputingUnitLimitOptions()` subscription that only populates `gpuOptions`, 
because its metrics popover needs `showGpuSelection()` independently of the 
modal; the shared modal owns the user-visible error toast for that endpoint.
   
   Net effect: 13 files changed, ~460 lines of duplicated TS/HTML/SCSS removed, 
no user-visible behavior change.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6081
   
   ### How was this PR tested?
   
   Added a 12-case unit spec for the new component 
(`computing-unit-create-modal.component.spec.ts`) covering type/option 
defaulting, all three create-validation failures, successful create emitting 
`unitCreated`, cancel behavior, JVM-slider reconfiguration, and shared-memory 
validation, plus one new live-render test in 
`computing-unit-selection.component.spec.ts` asserting the seeded default name 
reaches the embedded modal. Ran `yarn test 
--include='**/computing-unit-create-modal.component.spec.ts' 
--include='**/computing-unit-selection.component.spec.ts' 
--include='**/user-computing-unit.component.spec.ts' 
--include='**/menu.component.spec.ts'` from `frontend/`: 4 spec files, 110 
tests, all passing. `yarn eslint` over the three touched directories and 
`prettier-eslint --list-different` over the changed files both report clean.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code, Claude Fable 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]

Reply via email to