1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00

feat: show draft automation inline in release plans

When adding automation to a milestone in change request environments, the automation now displays inline with a "Modified in draft" badge instead of just showing the "Add automation" button.

Changes:
- Fix action name check from non-existent 'createMilestoneProgression' to 'changeMilestoneProgression'
- Differentiate create vs update by checking if milestone originally has transitionCondition
- Don't reset form state when adding to draft, allowing inline display
- Show "Modified in draft" badge for both creates and updates in draft

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FredrikOseberg 2025-10-24 09:13:32 +02:00
parent 737c8648fb
commit 51ff54497e
No known key found for this signature in database
GPG Key ID: 282FD8A6D8F9BCF0
3 changed files with 10 additions and 5 deletions

View File

@ -82,16 +82,20 @@ export const MilestoneAutomation = ({
return null; return null;
} }
// When milestone has no original transitionCondition but has a pending changeMilestoneProgression, it's a create
const isOriginallyEmpty = !milestone.transitionCondition;
const hasPendingCreate = const hasPendingCreate =
pendingProgressionChange?.action === 'createMilestoneProgression'; isOriginallyEmpty &&
pendingProgressionChange?.action === 'changeMilestoneProgression';
const hasPendingChange = const hasPendingChange =
!isOriginallyEmpty &&
pendingProgressionChange?.action === 'changeMilestoneProgression'; pendingProgressionChange?.action === 'changeMilestoneProgression';
const hasPendingDelete = const hasPendingDelete =
pendingProgressionChange?.action === 'deleteMilestoneProgression'; pendingProgressionChange?.action === 'deleteMilestoneProgression';
const badge = hasPendingDelete ? ( const badge = hasPendingDelete ? (
<Badge color='error'>Deleted in draft</Badge> <Badge color='error'>Deleted in draft</Badge>
) : hasPendingChange ? ( ) : hasPendingChange || hasPendingCreate ? (
<Badge color='warning'>Modified in draft</Badge> <Badge color='warning'>Modified in draft</Badge>
) : undefined; ) : undefined;

View File

@ -97,7 +97,8 @@ export const ReleasePlanMilestoneItem = ({
sourceMilestone: milestone.id, sourceMilestone: milestone.id,
}, },
}); });
return { shouldReset: true }; handleCloseProgressionForm();
return {};
} }
try { try {

View File

@ -15,10 +15,10 @@ export const getPendingProgressionData = (
): PendingProgressionChangeResult => { ): PendingProgressionChangeResult => {
const pendingProgressionChange = getPendingProgressionChange(milestone.id); const pendingProgressionChange = getPendingProgressionChange(milestone.id);
// Determine effective transition condition (use pending create if exists) // Determine effective transition condition (use pending change if exists)
let effectiveTransitionCondition = milestone.transitionCondition; let effectiveTransitionCondition = milestone.transitionCondition;
if ( if (
pendingProgressionChange?.action === 'createMilestoneProgression' && pendingProgressionChange?.action === 'changeMilestoneProgression' &&
'transitionCondition' in pendingProgressionChange.payload && 'transitionCondition' in pendingProgressionChange.payload &&
pendingProgressionChange.payload.transitionCondition pendingProgressionChange.payload.transitionCondition
) { ) {