EDM-4070: Handle non-editable image promotions#685
Conversation
Made-with: Cursor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
Summary by CodeRabbit
WalkthroughThis PR adds edit-gating to image promotions, preventing modifications when promotions are publishing, already published, failed, or when all available export formats are already included. The change extracts format selection UI into a dedicated component, refactors the form and modal to respect edit restrictions, and unifies promotion action state in the table component. ChangesImage Promotion Edit-Gating
Sequence DiagramsequenceDiagram
participant User
participant ImageBuildDetailsTab as Tab
participant ImagePromotionModal as Modal
participant PromotionUtils as Utils
participant ImagePromotionForm as Form
User->>Tab: Click View/Edit/Delete action
activate Tab
Tab->>PromotionUtils: getPromotionEditDisabledReason(promotion, formats)
activate PromotionUtils
PromotionUtils-->>Tab: Disabled reason or undefined
deactivate PromotionUtils
Tab->>Tab: Update promotionAction state
deactivate Tab
alt Action is Edit
Tab->>Modal: Open with isEdit=true
activate Modal
Modal->>PromotionUtils: canPromotionBeEdited(promotion, formats)
activate PromotionUtils
PromotionUtils-->>Modal: true/false
deactivate PromotionUtils
Modal->>Modal: Compute canBeEdited, set header & buttons
Modal->>Form: Pass canAmendExportFormats
activate Form
Form-->>Modal: Renders editable/read-only field
deactivate Form
deactivate Modal
else Action is View
Tab->>Modal: Open with readOnly=true
activate Modal
Modal->>Modal: Set canBeEdited=false, show View header
Modal->>Form: Pass canAmendExportFormats=false
activate Form
Form-->>Modal: Renders read-only field
deactivate Form
deactivate Modal
else Action is Delete
Tab->>Modal: Open delete confirmation
Modal->>User: Confirm deletion
User->>Modal: Confirm
Modal->>Tab: On delete success, refetchPromotions()
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Image promotions cannot be edited when there are no additional formats from the ImageBuild to select.
Now, when the image promotion cannot be edited and user has the permission to edit IP, we show a disabled reason.
Besides that, there was no "View image promotion" action for viewer users to review the ImagePromotion details.
Now, that action is always avaiable.