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,
|
onUpdateAutomation,
|
||||||
onDeleteAutomation,
|
onDeleteAutomation,
|
||||||
}: MilestoneListRendererCoreProps) => {
|
}: MilestoneListRendererCoreProps) => {
|
||||||
const status: MilestoneStatus = { type: 'not-started' };
|
const status: MilestoneStatus = {
|
||||||
|
type: 'not-started',
|
||||||
|
progression: 'active',
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -109,7 +109,7 @@ interface IReleasePlanMilestoneProps {
|
|||||||
|
|
||||||
export const ReleasePlanMilestone = ({
|
export const ReleasePlanMilestone = ({
|
||||||
milestone,
|
milestone,
|
||||||
status = { type: 'not-started' },
|
status = { type: 'not-started', progression: 'active' },
|
||||||
onStartMilestone,
|
onStartMilestone,
|
||||||
readonly,
|
readonly,
|
||||||
automationSection,
|
automationSection,
|
||||||
|
|||||||
@ -4,11 +4,17 @@ import PauseCircleIcon from '@mui/icons-material/PauseCircle';
|
|||||||
import TripOriginIcon from '@mui/icons-material/TripOrigin';
|
import TripOriginIcon from '@mui/icons-material/TripOrigin';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
|
|
||||||
|
export type MilestoneProgressionStatus = 'paused' | 'active';
|
||||||
|
|
||||||
export type MilestoneStatus =
|
export type MilestoneStatus =
|
||||||
| { type: 'not-started'; scheduledAt?: Date }
|
| {
|
||||||
| { type: 'active' }
|
type: 'not-started';
|
||||||
| { type: 'paused' }
|
scheduledAt?: Date;
|
||||||
| { type: 'completed' };
|
progression: MilestoneProgressionStatus;
|
||||||
|
}
|
||||||
|
| { type: 'active'; progression: MilestoneProgressionStatus }
|
||||||
|
| { type: 'paused'; progression: MilestoneProgressionStatus }
|
||||||
|
| { type: 'completed'; progression: MilestoneProgressionStatus };
|
||||||
|
|
||||||
const BaseStatusButton = styled('button')<{ disabled?: boolean }>(
|
const BaseStatusButton = styled('button')<{ disabled?: boolean }>(
|
||||||
({ theme, disabled }) => ({
|
({ theme, disabled }) => ({
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export const MilestoneAutomation = ({
|
|||||||
<Badge color='error'>Deleted in draft</Badge>
|
<Badge color='error'>Deleted in draft</Badge>
|
||||||
) : hasPendingChange ? (
|
) : hasPendingChange ? (
|
||||||
<Badge color='warning'>Modified in draft</Badge>
|
<Badge color='warning'>Modified in draft</Badge>
|
||||||
) : status?.type === 'paused' ? (
|
) : status?.progression === 'paused' ? (
|
||||||
<Badge color='error' icon={<WarningAmber fontSize='small' />}>
|
<Badge color='error' icon={<WarningAmber fontSize='small' />}>
|
||||||
Paused
|
Paused
|
||||||
</Badge>
|
</Badge>
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import type { IReleasePlanMilestone } from 'interfaces/releasePlans';
|
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';
|
import { calculateMilestoneStartTime } from '../utils/calculateMilestoneStartTime.js';
|
||||||
|
|
||||||
export const calculateMilestoneStatus = (
|
export const calculateMilestoneStatus = (
|
||||||
@ -10,16 +13,18 @@ export const calculateMilestoneStatus = (
|
|||||||
environmentIsDisabled: boolean | undefined,
|
environmentIsDisabled: boolean | undefined,
|
||||||
allMilestones: IReleasePlanMilestone[],
|
allMilestones: IReleasePlanMilestone[],
|
||||||
): MilestoneStatus => {
|
): MilestoneStatus => {
|
||||||
if (milestone.pausedAt) {
|
const progression: MilestoneProgressionStatus = milestone.pausedAt
|
||||||
return { type: 'paused' };
|
? 'paused'
|
||||||
}
|
: 'active';
|
||||||
|
|
||||||
if (milestone.id === activeMilestoneId) {
|
if (milestone.id === activeMilestoneId) {
|
||||||
return environmentIsDisabled ? { type: 'paused' } : { type: 'active' };
|
return environmentIsDisabled
|
||||||
|
? { type: 'paused', progression }
|
||||||
|
: { type: 'active', progression };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < activeIndex) {
|
if (index < activeIndex) {
|
||||||
return { type: 'completed' };
|
return { type: 'completed', progression };
|
||||||
}
|
}
|
||||||
|
|
||||||
const scheduledAt = calculateMilestoneStartTime(
|
const scheduledAt = calculateMilestoneStartTime(
|
||||||
@ -31,5 +36,6 @@ export const calculateMilestoneStatus = (
|
|||||||
return {
|
return {
|
||||||
type: 'not-started',
|
type: 'not-started',
|
||||||
scheduledAt: scheduledAt || undefined,
|
scheduledAt: scheduledAt || undefined,
|
||||||
|
progression,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,7 +8,11 @@ export const useMilestoneProgressionInfo = (
|
|||||||
status?: MilestoneStatus,
|
status?: MilestoneStatus,
|
||||||
) => {
|
) => {
|
||||||
const { locationSettings } = useLocationSettings();
|
const { locationSettings } = useLocationSettings();
|
||||||
if (!status || status.type !== 'active') {
|
if (
|
||||||
|
!status ||
|
||||||
|
status.type !== 'active' ||
|
||||||
|
status.progression === 'paused'
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user