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:
parent
d6af401dd2
commit
123ca034ee
@ -37,7 +37,10 @@ const MilestoneListRendererCore = ({
|
||||
onUpdateAutomation,
|
||||
onDeleteAutomation,
|
||||
}: MilestoneListRendererCoreProps) => {
|
||||
const status: MilestoneStatus = { type: 'not-started' };
|
||||
const status: MilestoneStatus = {
|
||||
type: 'not-started',
|
||||
progression: 'active',
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -109,7 +109,7 @@ interface IReleasePlanMilestoneProps {
|
||||
|
||||
export const ReleasePlanMilestone = ({
|
||||
milestone,
|
||||
status = { type: 'not-started' },
|
||||
status = { type: 'not-started', progression: 'active' },
|
||||
onStartMilestone,
|
||||
readonly,
|
||||
automationSection,
|
||||
|
||||
@ -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 }) => ({
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user