mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
fix: switch to new change milestone endpoint
This commit is contained in:
parent
bf2c421944
commit
c00c0f1105
@ -29,18 +29,6 @@ type ProgressionChange =
|
||||
| IChangeRequestChangeMilestoneProgression
|
||||
| IChangeRequestDeleteMilestoneProgression;
|
||||
|
||||
const getFirstChangeWithSnapshot = (
|
||||
progressionChanges: ProgressionChange[],
|
||||
) => {
|
||||
return (
|
||||
progressionChanges.find(
|
||||
(change) =>
|
||||
change.payload?.snapshot &&
|
||||
change.action === 'changeMilestoneProgression',
|
||||
) || progressionChanges.find((change) => change.payload?.snapshot)
|
||||
);
|
||||
};
|
||||
|
||||
const getMilestonesWithAutomation = (
|
||||
progressionChanges: ProgressionChange[],
|
||||
): Set<string> => {
|
||||
@ -109,10 +97,7 @@ export const ConsolidatedProgressionChanges: FC<{
|
||||
|
||||
if (progressionChanges.length === 0) return null;
|
||||
|
||||
const firstChangeWithSnapshot =
|
||||
getFirstChangeWithSnapshot(progressionChanges);
|
||||
const basePlan =
|
||||
firstChangeWithSnapshot?.payload?.snapshot || currentReleasePlan;
|
||||
const basePlan = currentReleasePlan;
|
||||
|
||||
if (!basePlan) {
|
||||
return null;
|
||||
|
||||
@ -39,7 +39,7 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
|
||||
onUpdateChangeRequestSubmit,
|
||||
onDeleteChangeRequestSubmit,
|
||||
}) => {
|
||||
const basePlan = change.payload.snapshot || currentReleasePlan;
|
||||
const basePlan = currentReleasePlan;
|
||||
if (!basePlan) return null;
|
||||
|
||||
const sourceId = change.payload.sourceMilestone;
|
||||
@ -83,7 +83,9 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
|
||||
<MilestoneListRenderer
|
||||
plan={modifiedPlan}
|
||||
changeRequestState={changeRequestState}
|
||||
milestonesWithAutomation={new Set([sourceId])}
|
||||
milestonesWithAutomation={
|
||||
new Set([sourceId].filter(Boolean))
|
||||
}
|
||||
onUpdateAutomation={onUpdateChangeRequestSubmit}
|
||||
onDeleteAutomation={onDeleteChangeRequestSubmit}
|
||||
/>
|
||||
|
||||
@ -23,8 +23,7 @@ export const applyProgressionChanges = (
|
||||
const deleteChange = progressionChanges.find(
|
||||
(change): change is IChangeRequestDeleteMilestoneProgression =>
|
||||
change.action === 'deleteMilestoneProgression' &&
|
||||
(change.payload.sourceMilestoneId === milestone.id ||
|
||||
change.payload.sourceMilestone === milestone.id),
|
||||
change.payload.sourceMilestone === milestone.id,
|
||||
);
|
||||
|
||||
if (deleteChange) {
|
||||
|
||||
@ -2,10 +2,7 @@ import type { IFeatureVariant } from 'interfaces/featureToggle';
|
||||
import type { ISegment } from 'interfaces/segment';
|
||||
import type { IFeatureStrategy } from '../../interfaces/strategy.js';
|
||||
import type { IUser } from '../../interfaces/user.js';
|
||||
import type {
|
||||
SetStrategySortOrderSchema,
|
||||
ChangeMilestoneProgressionSchema,
|
||||
} from 'openapi';
|
||||
import type { SetStrategySortOrderSchema } from 'openapi';
|
||||
import type { IReleasePlan } from 'interfaces/releasePlans';
|
||||
|
||||
type BaseChangeRequest = {
|
||||
@ -287,15 +284,14 @@ type ChangeRequestStartMilestone = {
|
||||
snapshot?: IReleasePlan;
|
||||
};
|
||||
|
||||
type ChangeRequestChangeMilestoneProgression =
|
||||
ChangeMilestoneProgressionSchema & {
|
||||
snapshot?: IReleasePlan;
|
||||
};
|
||||
type ChangeRequestChangeMilestoneProgression = {
|
||||
sourceMilestone: string;
|
||||
targetMilestone: string;
|
||||
transitionCondition: { intervalMinutes: number };
|
||||
};
|
||||
|
||||
type ChangeRequestDeleteMilestoneProgression = {
|
||||
sourceMilestoneId?: string;
|
||||
sourceMilestone?: string; // Backward compatibility for existing change requests
|
||||
snapshot?: IReleasePlan;
|
||||
sourceMilestone: string;
|
||||
};
|
||||
|
||||
export type ChangeRequestAddStrategy = Pick<
|
||||
|
||||
@ -22,8 +22,7 @@ export interface IChangeSchema {
|
||||
| 'addReleasePlan'
|
||||
| 'deleteReleasePlan'
|
||||
| 'startMilestone'
|
||||
| 'createMilestoneProgression'
|
||||
| 'updateMilestoneProgression'
|
||||
| 'changeMilestoneProgression'
|
||||
| 'deleteMilestoneProgression';
|
||||
payload: string | boolean | object | number | undefined;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user