mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
feat: remove milestone progression adding when paused (#11012)
This commit is contained in:
parent
97a20b0929
commit
d6af401dd2
@ -12,9 +12,8 @@ import { StyledActionButton } from './StyledActionButton.tsx';
|
||||
|
||||
interface MilestoneAutomationProps {
|
||||
milestone: IReleasePlanMilestone;
|
||||
milestones: IReleasePlanMilestone[];
|
||||
status: MilestoneStatus;
|
||||
isNotLastMilestone: boolean;
|
||||
nextMilestoneId: string;
|
||||
milestoneProgressionsEnabled: boolean;
|
||||
readonly: boolean | undefined;
|
||||
isProgressionFormOpen: boolean;
|
||||
@ -30,9 +29,8 @@ interface MilestoneAutomationProps {
|
||||
|
||||
export const MilestoneAutomation = ({
|
||||
milestone,
|
||||
milestones,
|
||||
status,
|
||||
isNotLastMilestone,
|
||||
nextMilestoneId,
|
||||
milestoneProgressionsEnabled,
|
||||
readonly,
|
||||
isProgressionFormOpen,
|
||||
@ -43,6 +41,13 @@ export const MilestoneAutomation = ({
|
||||
onChangeProgression,
|
||||
onDeleteProgression,
|
||||
}: MilestoneAutomationProps) => {
|
||||
const milestoneIndex = milestones.findIndex((m) => m.id === milestone.id);
|
||||
const isNotLastMilestone = milestoneIndex < milestones.length - 1;
|
||||
const nextMilestoneId = milestones[milestoneIndex + 1]?.id || '';
|
||||
const hasAnyPausedMilestone = milestones.some((milestone) =>
|
||||
Boolean(milestone.pausedAt),
|
||||
);
|
||||
|
||||
const showAutomation =
|
||||
milestoneProgressionsEnabled && isNotLastMilestone && !readonly;
|
||||
|
||||
@ -89,7 +94,7 @@ export const MilestoneAutomation = ({
|
||||
status={status}
|
||||
badge={badge}
|
||||
/>
|
||||
) : (
|
||||
) : hasAnyPausedMilestone ? null : (
|
||||
<StyledActionButton
|
||||
onClick={onOpenProgressionForm}
|
||||
color='primary'
|
||||
|
||||
@ -92,7 +92,6 @@ export const ReleasePlanMilestoneItem = ({
|
||||
|
||||
const isNotLastMilestone = index < milestones.length - 1;
|
||||
const isProgressionFormOpen = progressionFormOpenIndex === index;
|
||||
const nextMilestoneId = milestones[index + 1]?.id || '';
|
||||
const handleOpenProgressionForm = () =>
|
||||
onSetProgressionFormOpenIndex(index);
|
||||
const handleCloseProgressionForm = () =>
|
||||
@ -166,15 +165,11 @@ export const ReleasePlanMilestoneItem = ({
|
||||
const { pendingProgressionChange, effectiveTransitionCondition } =
|
||||
getPendingProgressionData(milestone, getPendingProgressionChange);
|
||||
|
||||
const shouldShowAutomation =
|
||||
isNotLastMilestone && milestoneProgressionsEnabled && !readonly;
|
||||
|
||||
const automationSection = shouldShowAutomation ? (
|
||||
const automationSection = (
|
||||
<MilestoneAutomation
|
||||
milestone={milestone}
|
||||
milestones={milestones}
|
||||
status={status}
|
||||
isNotLastMilestone={isNotLastMilestone}
|
||||
nextMilestoneId={nextMilestoneId}
|
||||
milestoneProgressionsEnabled={milestoneProgressionsEnabled}
|
||||
readonly={readonly}
|
||||
isProgressionFormOpen={isProgressionFormOpen}
|
||||
@ -185,7 +180,7 @@ export const ReleasePlanMilestoneItem = ({
|
||||
onChangeProgression={handleChangeProgression}
|
||||
onDeleteProgression={onDeleteProgression}
|
||||
/>
|
||||
) : undefined;
|
||||
);
|
||||
|
||||
return (
|
||||
<div key={milestone.id}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user