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

feat: split milestone paused with progression paused (#11015)

This commit is contained in:
Jaanus Sellin 2025-11-24 12:15:31 +02:00 committed by GitHub
parent d6af401dd2
commit 123ca034ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 33 additions and 14 deletions

View File

@ -37,7 +37,10 @@ const MilestoneListRendererCore = ({
onUpdateAutomation,
onDeleteAutomation,
}: MilestoneListRendererCoreProps) => {
const status: MilestoneStatus = { type: 'not-started' };
const status: MilestoneStatus = {
type: 'not-started',
progression: 'active',
};
return (
<>

View File

@ -109,7 +109,7 @@ interface IReleasePlanMilestoneProps {
export const ReleasePlanMilestone = ({
milestone,
status = { type: 'not-started' },
status = { type: 'not-started', progression: 'active' },
onStartMilestone,
readonly,
automationSection,

View File

@ -4,11 +4,17 @@ import PauseCircleIcon from '@mui/icons-material/PauseCircle';
import TripOriginIcon from '@mui/icons-material/TripOrigin';
import { useUiFlag } from 'hooks/useUiFlag';
export type MilestoneProgressionStatus = 'paused' | 'active';
export type MilestoneStatus =
| { type: 'not-started'; scheduledAt?: Date }
| { type: 'active' }
| { type: 'paused' }
| { type: 'completed' };
| {
type: 'not-started';
scheduledAt?: Date;
progression: MilestoneProgressionStatus;
}
| { type: 'active'; progression: MilestoneProgressionStatus }
| { type: 'paused'; progression: MilestoneProgressionStatus }
| { type: 'completed'; progression: MilestoneProgressionStatus };
const BaseStatusButton = styled('button')<{ disabled?: boolean }>(
({ theme, disabled }) => ({

View File

@ -64,7 +64,7 @@ export const MilestoneAutomation = ({
<Badge color='error'>Deleted in draft</Badge>
) : hasPendingChange ? (
<Badge color='warning'>Modified in draft</Badge>
) : status?.type === 'paused' ? (
) : status?.progression === 'paused' ? (
<Badge color='error' icon={<WarningAmber fontSize='small' />}>
Paused
</Badge>

View File

@ -1,5 +1,8 @@
import type { IReleasePlanMilestone } from 'interfaces/releasePlans';
import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
import type {
MilestoneStatus,
MilestoneProgressionStatus,
} from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
import { calculateMilestoneStartTime } from '../utils/calculateMilestoneStartTime.js';
export const calculateMilestoneStatus = (
@ -10,16 +13,18 @@ export const calculateMilestoneStatus = (
environmentIsDisabled: boolean | undefined,
allMilestones: IReleasePlanMilestone[],
): MilestoneStatus => {
if (milestone.pausedAt) {
return { type: 'paused' };
}
const progression: MilestoneProgressionStatus = milestone.pausedAt
? 'paused'
: 'active';
if (milestone.id === activeMilestoneId) {
return environmentIsDisabled ? { type: 'paused' } : { type: 'active' };
return environmentIsDisabled
? { type: 'paused', progression }
: { type: 'active', progression };
}
if (index < activeIndex) {
return { type: 'completed' };
return { type: 'completed', progression };
}
const scheduledAt = calculateMilestoneStartTime(
@ -31,5 +36,6 @@ export const calculateMilestoneStatus = (
return {
type: 'not-started',
scheduledAt: scheduledAt || undefined,
progression,
};
};

View File

@ -8,7 +8,11 @@ export const useMilestoneProgressionInfo = (
status?: MilestoneStatus,
) => {
const { locationSettings } = useLocationSettings();
if (!status || status.type !== 'active') {
if (
!status ||
status.type !== 'active' ||
status.progression === 'paused'
) {
return null;
}