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