mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
feat: read only milestone progression in cr (#10882)
This commit is contained in:
parent
25abe054a4
commit
c2ec77ba6e
@ -144,13 +144,7 @@ export const ConsolidatedProgressionChanges: FC<{
|
||||
</ChangeItemWrapper>
|
||||
<TabPanel>
|
||||
{readonly ? (
|
||||
<ReadonlyMilestoneListRenderer
|
||||
plan={modifiedPlan}
|
||||
milestonesWithAutomation={milestonesWithAutomation}
|
||||
milestonesWithDeletedAutomation={
|
||||
milestonesWithDeletedAutomation
|
||||
}
|
||||
/>
|
||||
<ReadonlyMilestoneListRenderer plan={modifiedPlan} />
|
||||
) : (
|
||||
<EditableMilestoneListRenderer
|
||||
plan={modifiedPlan}
|
||||
|
||||
@ -3,7 +3,10 @@ import type { IReleasePlan } from 'interfaces/releasePlans';
|
||||
import type { ChangeMilestoneProgressionSchema } from 'openapi';
|
||||
import { ReleasePlanMilestone } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/ReleasePlanMilestone';
|
||||
import { MilestoneAutomationSection } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneAutomationSection.tsx';
|
||||
import { MilestoneTransitionDisplay } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneTransitionDisplay.tsx';
|
||||
import {
|
||||
MilestoneTransitionDisplay,
|
||||
ReadonlyMilestoneTransitionDisplay,
|
||||
} from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneTransitionDisplay.tsx';
|
||||
import type { MilestoneStatus } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
|
||||
import { Badge } from 'component/common/Badge/Badge';
|
||||
|
||||
@ -41,9 +44,10 @@ const MilestoneListRendererCore = ({
|
||||
{plan.milestones.map((milestone, index) => {
|
||||
const isNotLastMilestone = index < plan.milestones.length - 1;
|
||||
const nextMilestoneId = plan.milestones[index + 1]?.id || '';
|
||||
const shouldShowAutomation =
|
||||
milestonesWithAutomation.has(milestone.id) ||
|
||||
milestonesWithDeletedAutomation.has(milestone.id);
|
||||
const shouldShowAutomation = readonly
|
||||
? milestone.transitionCondition !== undefined
|
||||
: milestonesWithAutomation.has(milestone.id) ||
|
||||
milestonesWithDeletedAutomation.has(milestone.id);
|
||||
|
||||
const showAutomation =
|
||||
isNotLastMilestone && shouldShowAutomation;
|
||||
@ -64,27 +68,39 @@ const MilestoneListRendererCore = ({
|
||||
const automationSection =
|
||||
showAutomation && milestone.transitionCondition ? (
|
||||
<MilestoneAutomationSection status={status}>
|
||||
<MilestoneTransitionDisplay
|
||||
intervalMinutes={
|
||||
milestone.transitionCondition
|
||||
.intervalMinutes
|
||||
}
|
||||
targetMilestoneId={nextMilestoneId}
|
||||
sourceMilestoneStartedAt={milestone.startedAt}
|
||||
onSave={async (payload) => {
|
||||
await onUpdateAutomation(
|
||||
milestone.id,
|
||||
payload,
|
||||
);
|
||||
return { shouldReset: true };
|
||||
}}
|
||||
onDelete={() =>
|
||||
onDeleteAutomation(milestone.id)
|
||||
}
|
||||
milestoneName={milestone.name}
|
||||
status={status}
|
||||
badge={badge}
|
||||
/>
|
||||
{readonly ? (
|
||||
<ReadonlyMilestoneTransitionDisplay
|
||||
intervalMinutes={
|
||||
milestone.transitionCondition
|
||||
.intervalMinutes
|
||||
}
|
||||
status={status}
|
||||
/>
|
||||
) : (
|
||||
<MilestoneTransitionDisplay
|
||||
intervalMinutes={
|
||||
milestone.transitionCondition
|
||||
.intervalMinutes
|
||||
}
|
||||
targetMilestoneId={nextMilestoneId}
|
||||
sourceMilestoneStartedAt={
|
||||
milestone.startedAt
|
||||
}
|
||||
onSave={async (payload) => {
|
||||
await onUpdateAutomation(
|
||||
milestone.id,
|
||||
payload,
|
||||
);
|
||||
return { shouldReset: true };
|
||||
}}
|
||||
onDelete={() =>
|
||||
onDeleteAutomation(milestone.id)
|
||||
}
|
||||
milestoneName={milestone.name}
|
||||
status={status}
|
||||
badge={badge}
|
||||
/>
|
||||
)}
|
||||
</MilestoneAutomationSection>
|
||||
) : undefined;
|
||||
|
||||
|
||||
@ -87,12 +87,7 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
|
||||
</ChangeItemWrapper>
|
||||
<TabPanel>
|
||||
{readonly ? (
|
||||
<ReadonlyMilestoneListRenderer
|
||||
plan={modifiedPlan}
|
||||
milestonesWithAutomation={
|
||||
new Set([sourceId].filter(Boolean))
|
||||
}
|
||||
/>
|
||||
<ReadonlyMilestoneListRenderer plan={modifiedPlan} />
|
||||
) : (
|
||||
<EditableMilestoneListRenderer
|
||||
plan={modifiedPlan}
|
||||
|
||||
@ -109,6 +109,30 @@ interface IMilestoneTransitionDisplayProps {
|
||||
badge?: ReactNode;
|
||||
}
|
||||
|
||||
export const ReadonlyMilestoneTransitionDisplay = ({
|
||||
intervalMinutes,
|
||||
status,
|
||||
}: {
|
||||
intervalMinutes: number;
|
||||
status?: MilestoneStatus;
|
||||
}) => {
|
||||
const initial = getTimeValueAndUnitFromMinutes(intervalMinutes);
|
||||
|
||||
return (
|
||||
<StyledDisplayContainer>
|
||||
<StyledContentGroup>
|
||||
<StyledIcon status={status} />
|
||||
<StyledLabel status={status}>
|
||||
Proceed to the next milestone after
|
||||
</StyledLabel>
|
||||
<span style={{ fontSize: 'inherit' }}>
|
||||
{initial.value} {initial.unit}
|
||||
</span>
|
||||
</StyledContentGroup>
|
||||
</StyledDisplayContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export const MilestoneTransitionDisplay = ({
|
||||
intervalMinutes,
|
||||
targetMilestoneId,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user