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:
parent
d3981baf2c
commit
35680f87eb
@ -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>
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -16,5 +16,6 @@ export const useMilestoneProgressionInfo = (
|
||||
intervalMinutes,
|
||||
sourceMilestoneStartedAt,
|
||||
locationSettings.locale,
|
||||
status,
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user