1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

feat: hide milestone progression on paused state (#10998)

This commit is contained in:
Jaanus Sellin 2025-11-19 12:41:18 +02:00 committed by GitHub
parent d3981baf2c
commit 35680f87eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 2 deletions

View File

@ -54,13 +54,12 @@ export const MilestoneAutomation = ({
pendingProgressionChange?.action === 'changeMilestoneProgression';
const hasPendingDelete =
pendingProgressionChange?.action === 'deleteMilestoneProgression';
const isPaused = Boolean(milestone.pausedAt);
const badge = hasPendingDelete ? (
<Badge color='error'>Deleted in draft</Badge>
) : hasPendingChange ? (
<Badge color='warning'>Modified in draft</Badge>
) : isPaused ? (
) : status?.type === 'paused' ? (
<Badge color='error' icon={<WarningAmber fontSize='small' />}>
Paused
</Badge>

View File

@ -10,6 +10,7 @@ describe('getMilestoneProgressionInfo', () => {
30,
startedAt,
'en-US',
undefined,
currentTime,
);
expect(res).toBeTruthy();
@ -22,9 +23,22 @@ describe('getMilestoneProgressionInfo', () => {
120,
startedAt,
'en-US',
undefined,
currentTime,
);
expect(res).toBeTruthy();
expect(res as string).toMatch(/^Will proceed at .* \(in .*\)\.$/);
});
it('returns null when milestone is paused', () => {
const startedAt = '2025-10-31T14:00:00.000Z';
const res = getMilestoneProgressionInfo(
120,
startedAt,
'en-US',
{ type: 'paused' },
currentTime,
);
expect(res).toBeNull();
});
});

View File

@ -1,16 +1,22 @@
import { addMinutes, differenceInMinutes, formatDistance } from 'date-fns';
import { formatDateYMDHM } from 'utils/formatDate.ts';
import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
export const getMilestoneProgressionInfo = (
intervalMinutes: number,
sourceMilestoneStartedAt: string | null | undefined,
locale: string,
status?: MilestoneStatus,
currentTime: Date = new Date(),
): string | null => {
if (!sourceMilestoneStartedAt) {
return null;
}
if (status?.type === 'paused') {
return null;
}
const startDate = new Date(sourceMilestoneStartedAt);
const elapsedMinutes = differenceInMinutes(currentTime, startDate);
const proceedDate = addMinutes(startDate, intervalMinutes);

View File

@ -16,5 +16,6 @@ export const useMilestoneProgressionInfo = (
intervalMinutes,
sourceMilestoneStartedAt,
locationSettings.locale,
status,
);
};