mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
fix: revert to working version
This commit is contained in:
parent
3b75ad4e72
commit
8e612e47f4
@ -54,7 +54,7 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
|
|||||||
|
|
||||||
const sourceId = isCreate
|
const sourceId = isCreate
|
||||||
? change.payload.sourceMilestone
|
? change.payload.sourceMilestone
|
||||||
: change.payload.sourceMilestoneId;
|
: change.payload.sourceMilestoneId || change.payload.sourceMilestone;
|
||||||
|
|
||||||
if (!sourceId) return null;
|
if (!sourceId) return null;
|
||||||
|
|
||||||
|
|||||||
@ -239,6 +239,7 @@ const AddReleasePlan: FC<{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const ConsolidatedProgressionChanges: FC<{
|
const ConsolidatedProgressionChanges: FC<{
|
||||||
feature: IChangeRequestFeature;
|
feature: IChangeRequestFeature;
|
||||||
currentReleasePlan?: IReleasePlan;
|
currentReleasePlan?: IReleasePlan;
|
||||||
@ -311,7 +312,8 @@ const ConsolidatedProgressionChanges: FC<{
|
|||||||
.map((change) =>
|
.map((change) =>
|
||||||
change.action === 'createMilestoneProgression'
|
change.action === 'createMilestoneProgression'
|
||||||
? change.payload.sourceMilestone
|
? change.payload.sourceMilestone
|
||||||
: change.payload.sourceMilestoneId,
|
: change.payload.sourceMilestoneId ||
|
||||||
|
change.payload.sourceMilestone,
|
||||||
)
|
)
|
||||||
.filter((id): id is string => Boolean(id)),
|
.filter((id): id is string => Boolean(id)),
|
||||||
);
|
);
|
||||||
@ -319,7 +321,11 @@ const ConsolidatedProgressionChanges: FC<{
|
|||||||
const milestonesWithDeletedAutomation = new Set(
|
const milestonesWithDeletedAutomation = new Set(
|
||||||
progressionChanges
|
progressionChanges
|
||||||
.filter((change) => change.action === 'deleteMilestoneProgression')
|
.filter((change) => change.action === 'deleteMilestoneProgression')
|
||||||
.map((change) => change.payload.sourceMilestoneId)
|
.map(
|
||||||
|
(change) =>
|
||||||
|
change.payload.sourceMilestoneId ||
|
||||||
|
change.payload.sourceMilestone,
|
||||||
|
)
|
||||||
.filter((id): id is string => Boolean(id)),
|
.filter((id): id is string => Boolean(id)),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -327,7 +333,8 @@ const ConsolidatedProgressionChanges: FC<{
|
|||||||
const sourceId =
|
const sourceId =
|
||||||
change.action === 'createMilestoneProgression'
|
change.action === 'createMilestoneProgression'
|
||||||
? change.payload.sourceMilestone
|
? change.payload.sourceMilestone
|
||||||
: change.payload.sourceMilestoneId;
|
: change.payload.sourceMilestoneId ||
|
||||||
|
change.payload.sourceMilestone;
|
||||||
const sourceName =
|
const sourceName =
|
||||||
basePlan.milestones.find((milestone) => milestone.id === sourceId)
|
basePlan.milestones.find((milestone) => milestone.id === sourceId)
|
||||||
?.name || sourceId;
|
?.name || sourceId;
|
||||||
|
|||||||
@ -0,0 +1,53 @@
|
|||||||
|
import type { IReleasePlan } from 'interfaces/releasePlans';
|
||||||
|
import type {
|
||||||
|
IChangeRequestCreateMilestoneProgression,
|
||||||
|
IChangeRequestUpdateMilestoneProgression,
|
||||||
|
IChangeRequestDeleteMilestoneProgression,
|
||||||
|
} from 'component/changeRequest/changeRequest.types';
|
||||||
|
|
||||||
|
type ProgressionChange =
|
||||||
|
| IChangeRequestCreateMilestoneProgression
|
||||||
|
| IChangeRequestUpdateMilestoneProgression
|
||||||
|
| IChangeRequestDeleteMilestoneProgression;
|
||||||
|
|
||||||
|
export const applyProgressionChanges = (
|
||||||
|
basePlan: IReleasePlan,
|
||||||
|
progressionChanges: ProgressionChange[],
|
||||||
|
): IReleasePlan => {
|
||||||
|
return {
|
||||||
|
...basePlan,
|
||||||
|
milestones: basePlan.milestones.map((milestone) => {
|
||||||
|
const createChange = progressionChanges.find(
|
||||||
|
(change): change is IChangeRequestCreateMilestoneProgression =>
|
||||||
|
change.action === 'createMilestoneProgression' &&
|
||||||
|
change.payload.sourceMilestone === milestone.id,
|
||||||
|
);
|
||||||
|
const updateChange = progressionChanges.find(
|
||||||
|
(change): change is IChangeRequestUpdateMilestoneProgression =>
|
||||||
|
change.action === 'updateMilestoneProgression' &&
|
||||||
|
change.payload.sourceMilestoneId === milestone.id,
|
||||||
|
);
|
||||||
|
const deleteChange = progressionChanges.find(
|
||||||
|
(change): change is IChangeRequestDeleteMilestoneProgression =>
|
||||||
|
change.action === 'deleteMilestoneProgression' &&
|
||||||
|
change.payload.sourceMilestoneId === milestone.id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteChange) {
|
||||||
|
return {
|
||||||
|
...milestone,
|
||||||
|
transitionCondition: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const change = updateChange || createChange;
|
||||||
|
if (change) {
|
||||||
|
return {
|
||||||
|
...milestone,
|
||||||
|
transitionCondition: change.payload.transitionCondition,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return milestone;
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -25,12 +25,14 @@ export const useModifiedReleasePlan = (
|
|||||||
const updateChange = progressionChanges.find(
|
const updateChange = progressionChanges.find(
|
||||||
(change): change is IChangeRequestUpdateMilestoneProgression =>
|
(change): change is IChangeRequestUpdateMilestoneProgression =>
|
||||||
change.action === 'updateMilestoneProgression' &&
|
change.action === 'updateMilestoneProgression' &&
|
||||||
change.payload.sourceMilestoneId === milestone.id,
|
(change.payload.sourceMilestoneId === milestone.id ||
|
||||||
|
change.payload.sourceMilestone === milestone.id),
|
||||||
);
|
);
|
||||||
const deleteChange = progressionChanges.find(
|
const deleteChange = progressionChanges.find(
|
||||||
(change): change is IChangeRequestDeleteMilestoneProgression =>
|
(change): change is IChangeRequestDeleteMilestoneProgression =>
|
||||||
change.action === 'deleteMilestoneProgression' &&
|
change.action === 'deleteMilestoneProgression' &&
|
||||||
change.payload.sourceMilestoneId === milestone.id,
|
(change.payload.sourceMilestoneId === milestone.id ||
|
||||||
|
change.payload.sourceMilestone === milestone.id),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (deleteChange) {
|
if (deleteChange) {
|
||||||
|
|||||||
@ -304,11 +304,13 @@ type ChangeRequestCreateMilestoneProgression =
|
|||||||
type ChangeRequestUpdateMilestoneProgression =
|
type ChangeRequestUpdateMilestoneProgression =
|
||||||
UpdateMilestoneProgressionSchema & {
|
UpdateMilestoneProgressionSchema & {
|
||||||
sourceMilestoneId?: string;
|
sourceMilestoneId?: string;
|
||||||
|
sourceMilestone?: string; // Backward compatibility for existing change requests
|
||||||
snapshot?: IReleasePlan;
|
snapshot?: IReleasePlan;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ChangeRequestDeleteMilestoneProgression = {
|
type ChangeRequestDeleteMilestoneProgression = {
|
||||||
sourceMilestoneId?: string;
|
sourceMilestoneId?: string;
|
||||||
|
sourceMilestone?: string; // Backward compatibility for existing change requests
|
||||||
snapshot?: IReleasePlan;
|
snapshot?: IReleasePlan;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -146,10 +146,15 @@ export const ReleasePlan = ({
|
|||||||
const progressionChange = featureInChangeRequest.changes.find(
|
const progressionChange = featureInChangeRequest.changes.find(
|
||||||
(change: any) =>
|
(change: any) =>
|
||||||
(change.action === 'updateMilestoneProgression' &&
|
(change.action === 'updateMilestoneProgression' &&
|
||||||
change.payload.sourceMilestoneId ===
|
(change.payload.sourceMilestoneId ===
|
||||||
sourceMilestoneId) ||
|
sourceMilestoneId ||
|
||||||
|
change.payload.sourceMilestone ===
|
||||||
|
sourceMilestoneId)) ||
|
||||||
(change.action === 'deleteMilestoneProgression' &&
|
(change.action === 'deleteMilestoneProgression' &&
|
||||||
change.payload.sourceMilestoneId === sourceMilestoneId),
|
(change.payload.sourceMilestoneId ===
|
||||||
|
sourceMilestoneId ||
|
||||||
|
change.payload.sourceMilestone ===
|
||||||
|
sourceMilestoneId)),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (progressionChange) {
|
if (progressionChange) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user