Repository navigation
fix(opportunities): prefill Create Purchase Plan modal from multiple homogeneous commitments (closes #898) - #899
Conversation
…homogeneous commitments (closes #898) When 2+ commitments sharing the same provider/service/term/payment are selected and the user clicks "Plan from N selected", the Create Purchase Plan modal now prefills the Purchase Configuration from the shared values instead of showing defaults. The "Plan from N selected" button only enables on a homogeneous selection, so the first commitment is a valid representative. The account chip is prefilled only when every selected commitment carries the same cloud_account_id; a multi-account selection leaves it empty for the user to fill, since provider/service/term/payment homogeneity does not imply a single account. Extends the single-selection prefill from #770/#778 (QA finding 6.7).
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR extends modal prefill behavior to support multiple selected commitments. The Create Plan modal now prefills provider, service, term, and payment from any non-empty selection of homogeneous commitments, and preloads the account chip only when all commitments share the same cloud account. ChangesMulti-commitment plan prefill
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
Summary
Fixes QA finding 6.7: in Opportunities -> Plan commitments, selecting 2+ commitments that share the same Provider/Service/Term/Payment and clicking "Plan from N selected" opened the Create Purchase Plan modal showing defaults (AWS, EC2, 1 Year, No Upfront) instead of prefilling from the selection.
#770/#778 already prefilled the modal for a single selected commitment (the prefill ran only when the snapshot length was exactly 1). This PR extends that to the homogeneous multi-selection case.
Changes
frontend/src/plans.ts—openCreatePlanModalnow prefills the Purchase Configuration (provider/service/term/payment) whenever the snapshot is non-empty, using the first commitment as the representative. The "Plan from N selected" button only enables on a homogeneous selection (enforced byisHomogeneousSelectioninrecommendations.ts), so any element shares those four values.cloud_account_id; a multi-account selection leaves it empty for the user to fill, since provider/service/term/payment homogeneity does not imply a single account.Tests
frontend/src/__tests__/plans.test.ts:plans(110) andrecommendations(319) suites pass;tsc --noEmitclean.Closes #898. Relates to #770/#778.
Summary by CodeRabbit
New Features
Tests