mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
refactor: remove uneccesary type
This commit is contained in:
parent
2dcd818e31
commit
3b75ad4e72
@ -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.sourceMilestone;
|
: change.payload.sourceMilestoneId;
|
||||||
|
|
||||||
if (!sourceId) return null;
|
if (!sourceId) return null;
|
||||||
|
|
||||||
|
|||||||
@ -239,7 +239,6 @@ const AddReleasePlan: FC<{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const ConsolidatedProgressionChanges: FC<{
|
const ConsolidatedProgressionChanges: FC<{
|
||||||
feature: IChangeRequestFeature;
|
feature: IChangeRequestFeature;
|
||||||
currentReleasePlan?: IReleasePlan;
|
currentReleasePlan?: IReleasePlan;
|
||||||
@ -312,8 +311,7 @@ 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)),
|
||||||
);
|
);
|
||||||
@ -321,11 +319,7 @@ const ConsolidatedProgressionChanges: FC<{
|
|||||||
const milestonesWithDeletedAutomation = new Set(
|
const milestonesWithDeletedAutomation = new Set(
|
||||||
progressionChanges
|
progressionChanges
|
||||||
.filter((change) => change.action === 'deleteMilestoneProgression')
|
.filter((change) => change.action === 'deleteMilestoneProgression')
|
||||||
.map(
|
.map((change) => change.payload.sourceMilestoneId)
|
||||||
(change) =>
|
|
||||||
change.payload.sourceMilestoneId ||
|
|
||||||
change.payload.sourceMilestone,
|
|
||||||
)
|
|
||||||
.filter((id): id is string => Boolean(id)),
|
.filter((id): id is string => Boolean(id)),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -333,8 +327,7 @@ 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;
|
||||||
|
|||||||
@ -17,7 +17,6 @@ export const useModifiedReleasePlan = (
|
|||||||
return {
|
return {
|
||||||
...basePlan,
|
...basePlan,
|
||||||
milestones: basePlan.milestones.map((milestone) => {
|
milestones: basePlan.milestones.map((milestone) => {
|
||||||
// Find if there's a progression change for this milestone
|
|
||||||
const createChange = progressionChanges.find(
|
const createChange = progressionChanges.find(
|
||||||
(change): change is IChangeRequestCreateMilestoneProgression =>
|
(change): change is IChangeRequestCreateMilestoneProgression =>
|
||||||
change.action === 'createMilestoneProgression' &&
|
change.action === 'createMilestoneProgression' &&
|
||||||
@ -26,31 +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),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check for conflicting changes (delete + create/update for same milestone)
|
|
||||||
if (deleteChange && (createChange || updateChange)) {
|
|
||||||
console.warn(
|
|
||||||
'[useModifiedReleasePlan] Conflicting changes detected for milestone:',
|
|
||||||
{
|
|
||||||
milestone: milestone.name,
|
|
||||||
hasCreate: !!createChange,
|
|
||||||
hasUpdate: !!updateChange,
|
|
||||||
hasDelete: !!deleteChange,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there's a delete change, remove the transition condition
|
|
||||||
// Delete takes precedence over create/update
|
|
||||||
if (deleteChange) {
|
if (deleteChange) {
|
||||||
return {
|
return {
|
||||||
...milestone,
|
...milestone,
|
||||||
|
|||||||
@ -304,13 +304,11 @@ 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,15 +146,10 @@ 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 ===
|
change.payload.sourceMilestoneId === sourceMilestoneId),
|
||||||
sourceMilestoneId ||
|
|
||||||
change.payload.sourceMilestone ===
|
|
||||||
sourceMilestoneId)),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (progressionChange) {
|
if (progressionChange) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user