1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00

refactor: update/create progression to change progression (#10843)

This commit is contained in:
Mateusz Kwasniewski 2025-10-22 15:40:30 +02:00 committed by GitHub
parent 866441a1b6
commit 0919b7b925
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
61 changed files with 310 additions and 611 deletions

View File

@ -2,8 +2,7 @@ import type { FC } from 'react';
import { styled } from '@mui/material';
import type {
ChangeRequestState,
IChangeRequestCreateMilestoneProgression,
IChangeRequestUpdateMilestoneProgression,
IChangeRequestChangeMilestoneProgression,
IChangeRequestDeleteMilestoneProgression,
IChangeRequestFeature,
} from 'component/changeRequest/changeRequest.types';
@ -15,7 +14,7 @@ import {
ChangeItemWrapper,
Deleted,
} from './Change.styles.tsx';
import type { UpdateMilestoneProgressionSchema } from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { MilestoneListRenderer } from './MilestoneListRenderer.tsx';
import { applyProgressionChanges } from './applyProgressionChanges.js';
import { EventDiff } from 'component/events/EventDiff/EventDiff';
@ -27,33 +26,15 @@ const StyledTabs = styled(Tabs)(({ theme }) => ({
}));
type ProgressionChange =
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression
| IChangeRequestChangeMilestoneProgression
| IChangeRequestDeleteMilestoneProgression;
const getFirstChangeWithSnapshot = (
progressionChanges: ProgressionChange[],
) => {
return (
progressionChanges.find(
(change) =>
change.payload?.snapshot &&
(change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression'),
) || progressionChanges.find((change) => change.payload?.snapshot)
);
};
const getMilestonesWithAutomation = (
progressionChanges: ProgressionChange[],
): Set<string> => {
return new Set(
progressionChanges
.filter(
(change) =>
change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression',
)
.filter((change) => change.action === 'changeMilestoneProgression')
.map((change) => change.payload.sourceMilestone)
.filter((id): id is string => Boolean(id)),
);
@ -80,11 +61,9 @@ const getChangeDescriptions = (
basePlan.milestones.find((milestone) => milestone.id === sourceId)
?.name || sourceId;
const action =
change.action === 'createMilestoneProgression'
? 'Adding'
: change.action === 'deleteMilestoneProgression'
? 'Deleting'
: 'Updating';
change.action === 'changeMilestoneProgression'
? 'Changing'
: 'Deleting';
return `${action} automation for ${sourceName}`;
});
};
@ -95,7 +74,7 @@ export const ConsolidatedProgressionChanges: FC<{
changeRequestState: ChangeRequestState;
onUpdateChangeRequestSubmit?: (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
payload: ChangeMilestoneProgressionSchema,
) => Promise<void>;
onDeleteChangeRequestSubmit?: (sourceMilestoneId: string) => Promise<void>;
}> = ({
@ -110,20 +89,15 @@ export const ConsolidatedProgressionChanges: FC<{
(
change,
): change is
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression
| IChangeRequestChangeMilestoneProgression
| IChangeRequestDeleteMilestoneProgression =>
change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression' ||
change.action === 'changeMilestoneProgression' ||
change.action === 'deleteMilestoneProgression',
);
if (progressionChanges.length === 0) return null;
const firstChangeWithSnapshot =
getFirstChangeWithSnapshot(progressionChanges);
const basePlan =
firstChangeWithSnapshot?.payload?.snapshot || currentReleasePlan;
const basePlan = currentReleasePlan;
if (!basePlan) {
return null;

View File

@ -207,8 +207,7 @@ export const FeatureChange: FC<{
{(change.action === 'addReleasePlan' ||
change.action === 'deleteReleasePlan' ||
change.action === 'startMilestone' ||
change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression' ||
change.action === 'changeMilestoneProgression' ||
change.action === 'deleteMilestoneProgression') && (
<ReleasePlanChange
actions={actions}

View File

@ -1,6 +1,6 @@
import { styled } from '@mui/material';
import type { IReleasePlan } from 'interfaces/releasePlans';
import type { UpdateMilestoneProgressionSchema } from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import type { ChangeRequestState } from 'component/changeRequest/changeRequest.types';
import { ReleasePlanMilestone } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/ReleasePlanMilestone';
import { MilestoneAutomationSection } from 'component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneAutomationSection.tsx';
@ -22,7 +22,7 @@ interface MilestoneListRendererProps {
milestonesWithDeletedAutomation?: Set<string>;
onUpdateAutomation?: (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
payload: ChangeMilestoneProgressionSchema,
) => Promise<void>;
onDeleteAutomation?: (sourceMilestoneId: string) => void;
}
@ -44,6 +44,7 @@ export const MilestoneListRenderer = ({
<>
{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);
@ -67,6 +68,7 @@ export const MilestoneListRenderer = ({
milestone.transitionCondition
.intervalMinutes
}
targetMilestoneId={nextMilestoneId}
onSave={async (payload) => {
await onUpdateAutomation?.(
milestone.id,

View File

@ -2,19 +2,13 @@ import type { FC, ReactNode } from 'react';
import { Typography } from '@mui/material';
import type {
ChangeRequestState,
IChangeRequestCreateMilestoneProgression,
IChangeRequestUpdateMilestoneProgression,
IChangeRequestChangeMilestoneProgression,
} from 'component/changeRequest/changeRequest.types';
import type { IReleasePlan } from 'interfaces/releasePlans';
import type { UpdateMilestoneProgressionSchema } from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { EventDiff } from 'component/events/EventDiff/EventDiff';
import { Tab, TabList, TabPanel, Tabs } from './ChangeTabComponents.tsx';
import {
Action,
Added,
ChangeItemInfo,
ChangeItemWrapper,
} from './Change.styles.tsx';
import { Action, ChangeItemInfo, ChangeItemWrapper } from './Change.styles.tsx';
import { styled } from '@mui/material';
import { MilestoneListRenderer } from './MilestoneListRenderer.tsx';
import { applyProgressionChanges } from './applyProgressionChanges.ts';
@ -26,15 +20,13 @@ const StyledTabs = styled(Tabs)(({ theme }) => ({
}));
interface ProgressionChangeProps {
change:
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression;
change: IChangeRequestChangeMilestoneProgression;
currentReleasePlan?: IReleasePlan;
actions?: ReactNode;
changeRequestState: ChangeRequestState;
onUpdateChangeRequestSubmit?: (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
payload: ChangeMilestoneProgressionSchema,
) => Promise<void>;
onDeleteChangeRequestSubmit?: (sourceMilestoneId: string) => void;
}
@ -47,12 +39,10 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
onUpdateChangeRequestSubmit,
onDeleteChangeRequestSubmit,
}) => {
const basePlan = change.payload.snapshot || currentReleasePlan;
const basePlan = currentReleasePlan;
if (!basePlan) return null;
const isCreate = change.action === 'createMilestoneProgression';
const sourceId = change.payload.sourceMilestone;
if (!sourceId) return null;
const sourceMilestone = basePlan.milestones.find(
@ -60,11 +50,10 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
);
const sourceMilestoneName = sourceMilestone?.name || sourceId;
const targetMilestoneName = isCreate
? basePlan.milestones.find(
(milestone) => milestone.id === change.payload.targetMilestone,
)?.name || change.payload.targetMilestone
: undefined;
const targetMilestoneName =
basePlan.milestones.find(
(milestone) => milestone.id === change.payload.targetMilestone,
)?.name || change.payload.targetMilestone;
const modifiedPlan = applyProgressionChanges(basePlan, [change]);
@ -77,21 +66,10 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
<StyledTabs>
<ChangeItemWrapper>
<ChangeItemInfo>
{isCreate ? (
<>
<Added>Adding automation to release plan</Added>
<Typography component='span'>
{sourceMilestoneName} {targetMilestoneName}
</Typography>
</>
) : (
<>
<Action>Updating automation in release plan</Action>
<Typography component='span'>
{sourceMilestoneName}
</Typography>
</>
)}
<Action>Changing automation in release plan</Action>
<Typography component='span'>
{sourceMilestoneName} {targetMilestoneName}
</Typography>
</ChangeItemInfo>
<div>
<TabList>
@ -105,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}
/>

View File

@ -5,8 +5,7 @@ import type {
IChangeRequestAddReleasePlan,
IChangeRequestDeleteReleasePlan,
IChangeRequestStartMilestone,
IChangeRequestCreateMilestoneProgression,
IChangeRequestUpdateMilestoneProgression,
IChangeRequestChangeMilestoneProgression,
IChangeRequestDeleteMilestoneProgression,
} from 'component/changeRequest/changeRequest.types';
import { useReleasePlanPreview } from 'hooks/useReleasePlanPreview';
@ -27,7 +26,7 @@ import {
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
import useToast from 'hooks/useToast';
import type { UpdateMilestoneProgressionSchema } from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { ProgressionChange } from './ProgressionChange.tsx';
import { ConsolidatedProgressionChanges } from './ConsolidatedProgressionChanges.tsx';
@ -245,8 +244,7 @@ export const ReleasePlanChange: FC<{
| IChangeRequestAddReleasePlan
| IChangeRequestDeleteReleasePlan
| IChangeRequestStartMilestone
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression
| IChangeRequestChangeMilestoneProgression
| IChangeRequestDeleteMilestoneProgression;
environmentName: string;
featureName: string;
@ -277,11 +275,11 @@ export const ReleasePlanChange: FC<{
const handleUpdateChangeRequestSubmit = async (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
payload: ChangeMilestoneProgressionSchema,
) => {
await addChange(projectId, environmentName, {
feature: featureName,
action: 'updateMilestoneProgression',
action: 'changeMilestoneProgression',
payload: {
sourceMilestone: sourceMilestoneId,
...payload,
@ -321,19 +319,16 @@ export const ReleasePlanChange: FC<{
// check if we should consolidate with other progression changes
if (
feature &&
(change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression' ||
(change.action === 'changeMilestoneProgression' ||
change.action === 'deleteMilestoneProgression')
) {
const progressionChanges = feature.changes.filter(
(
change,
): change is
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression
| IChangeRequestChangeMilestoneProgression
| IChangeRequestDeleteMilestoneProgression =>
change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression' ||
change.action === 'changeMilestoneProgression' ||
change.action === 'deleteMilestoneProgression',
);
@ -383,8 +378,7 @@ export const ReleasePlanChange: FC<{
actions={actions}
/>
)}
{(change.action === 'createMilestoneProgression' ||
change.action === 'updateMilestoneProgression') && (
{change.action === 'changeMilestoneProgression' && (
<ProgressionChange
change={change}
currentReleasePlan={currentReleasePlan}

View File

@ -1,13 +1,11 @@
import type { IReleasePlan } from 'interfaces/releasePlans';
import type {
IChangeRequestCreateMilestoneProgression,
IChangeRequestUpdateMilestoneProgression,
IChangeRequestChangeMilestoneProgression,
IChangeRequestDeleteMilestoneProgression,
} from 'component/changeRequest/changeRequest.types';
type ProgressionChange =
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression
| IChangeRequestChangeMilestoneProgression
| IChangeRequestDeleteMilestoneProgression;
export const applyProgressionChanges = (
@ -17,14 +15,9 @@ export const applyProgressionChanges = (
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' &&
const changeProgression = progressionChanges.find(
(change): change is IChangeRequestChangeMilestoneProgression =>
change.action === 'changeMilestoneProgression' &&
change.payload.sourceMilestone === milestone.id,
);
const deleteChange = progressionChanges.find(
@ -40,11 +33,11 @@ export const applyProgressionChanges = (
};
}
const change = updateChange || createChange;
if (change) {
if (changeProgression) {
return {
...milestone,
transitionCondition: change.payload.transitionCondition,
transitionCondition:
changeProgression.payload.transitionCondition,
};
}
return milestone;

View File

@ -2,11 +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,
CreateMilestoneProgressionSchema,
UpdateMilestoneProgressionSchema,
} from 'openapi';
import type { SetStrategySortOrderSchema } from 'openapi';
import type { IReleasePlan } from 'interfaces/releasePlans';
type BaseChangeRequest = {
@ -136,8 +132,7 @@ type ChangeRequestPayload =
| ChangeRequestAddReleasePlan
| ChangeRequestDeleteReleasePlan
| ChangeRequestStartMilestone
| ChangeRequestCreateMilestoneProgression
| ChangeRequestUpdateMilestoneProgression
| ChangeRequestChangeMilestoneProgression
| ChangeRequestDeleteMilestoneProgression;
export interface IChangeRequestAddStrategy extends IChangeRequestChangeBase {
@ -195,16 +190,10 @@ export interface IChangeRequestStartMilestone extends IChangeRequestChangeBase {
payload: ChangeRequestStartMilestone;
}
export interface IChangeRequestCreateMilestoneProgression
export interface IChangeRequestChangeMilestoneProgression
extends IChangeRequestChangeBase {
action: 'createMilestoneProgression';
payload: ChangeRequestCreateMilestoneProgression;
}
export interface IChangeRequestUpdateMilestoneProgression
extends IChangeRequestChangeBase {
action: 'updateMilestoneProgression';
payload: ChangeRequestUpdateMilestoneProgression;
action: 'changeMilestoneProgression';
payload: ChangeRequestChangeMilestoneProgression;
}
export interface IChangeRequestDeleteMilestoneProgression
@ -261,8 +250,7 @@ export type IFeatureChange =
| IChangeRequestAddReleasePlan
| IChangeRequestDeleteReleasePlan
| IChangeRequestStartMilestone
| IChangeRequestCreateMilestoneProgression
| IChangeRequestUpdateMilestoneProgression
| IChangeRequestChangeMilestoneProgression
| IChangeRequestDeleteMilestoneProgression;
export type ISegmentChange =
@ -296,22 +284,14 @@ type ChangeRequestStartMilestone = {
snapshot?: IReleasePlan;
};
type ChangeRequestCreateMilestoneProgression =
CreateMilestoneProgressionSchema & {
snapshot?: IReleasePlan;
};
type ChangeRequestUpdateMilestoneProgression =
UpdateMilestoneProgressionSchema & {
sourceMilestoneId?: string;
sourceMilestone?: string; // Backward compatibility for existing change requests
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<
@ -352,6 +332,5 @@ export type ChangeRequestAction =
| 'addReleasePlan'
| 'deleteReleasePlan'
| 'startMilestone'
| 'createMilestoneProgression'
| 'updateMilestoneProgression'
| 'changeMilestoneProgression'
| 'deleteMilestoneProgression';

View File

@ -4,10 +4,7 @@ import type {
IReleasePlan,
IReleasePlanMilestone,
} from 'interfaces/releasePlans';
import type {
CreateMilestoneProgressionSchema,
UpdateMilestoneProgressionSchema,
} from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { getTimeValueAndUnitFromMinutes } from '../hooks/useMilestoneProgressionForm.js';
const StyledBoldSpan = styled('span')(({ theme }) => ({
@ -24,13 +21,8 @@ type ChangeRequestAction =
milestone: IReleasePlanMilestone;
}
| {
type: 'createMilestoneProgression';
payload: CreateMilestoneProgressionSchema;
}
| {
type: 'updateMilestoneProgression';
sourceMilestoneId: string;
payload: UpdateMilestoneProgressionSchema;
type: 'changeMilestoneProgression';
payload: ChangeMilestoneProgressionSchema;
}
| {
type: 'deleteMilestoneProgression';
@ -91,7 +83,7 @@ export const ReleasePlanChangeRequestDialog = ({
</p>
);
case 'createMilestoneProgression': {
case 'changeMilestoneProgression': {
const sourceMilestone = releasePlan.milestones.find(
(milestone) =>
milestone.id === action.payload.sourceMilestone,
@ -108,7 +100,7 @@ export const ReleasePlanChangeRequestDialog = ({
return (
<p>
Create automation to proceed from{' '}
Configure automation to proceed from{' '}
<StyledBoldSpan>{sourceMilestone?.name}</StyledBoldSpan>{' '}
to{' '}
<StyledBoldSpan>{targetMilestone?.name}</StyledBoldSpan>{' '}
@ -118,27 +110,6 @@ export const ReleasePlanChangeRequestDialog = ({
);
}
case 'updateMilestoneProgression': {
const milestone = releasePlan.milestones.find(
(milestone) => milestone.id === action.sourceMilestoneId,
);
const { value, unit } = getTimeValueAndUnitFromMinutes(
action.payload.transitionCondition.intervalMinutes,
);
const timeInterval = `${value} ${unit}`;
return (
<p>
Update automation for{' '}
<StyledBoldSpan>{milestone?.name}</StyledBoldSpan> to
proceed after{' '}
<StyledBoldSpan>{timeInterval}</StyledBoldSpan> in{' '}
{environmentId}
</p>
);
}
case 'deleteMilestoneProgression': {
const milestone = releasePlan.milestones.find(
(milestone) => milestone.id === action.sourceMilestoneId,

View File

@ -2,7 +2,7 @@ import { Button, styled } from '@mui/material';
import BoltIcon from '@mui/icons-material/Bolt';
import { useMilestoneProgressionForm } from '../hooks/useMilestoneProgressionForm.js';
import { MilestoneProgressionTimeInput } from './MilestoneProgressionTimeInput.tsx';
import type { CreateMilestoneProgressionSchema } from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
const StyledFormContainer = styled('div')(({ theme }) => ({
display: 'flex',
@ -55,7 +55,9 @@ const StyledErrorMessage = styled('span')(({ theme }) => ({
interface IMilestoneProgressionFormProps {
sourceMilestoneId: string;
targetMilestoneId: string;
onSubmit: (payload: CreateMilestoneProgressionSchema) => Promise<void>;
onSubmit: (
payload: ChangeMilestoneProgressionSchema,
) => Promise<{ shouldReset?: boolean }>;
onCancel: () => void;
}

View File

@ -22,10 +22,7 @@ import { Truncator } from 'component/common/Truncator/Truncator';
import { useUiFlag } from 'hooks/useUiFlag';
import { useMilestoneProgressionsApi } from 'hooks/api/actions/useMilestoneProgressionsApi/useMilestoneProgressionsApi';
import { DeleteProgressionDialog } from './DeleteProgressionDialog.tsx';
import type {
CreateMilestoneProgressionSchema,
UpdateMilestoneProgressionSchema,
} from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { ReleasePlanMilestoneItem } from './ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx';
const StyledContainer = styled('div')(({ theme }) => ({
@ -111,13 +108,8 @@ export const ReleasePlan = ({
| { type: 'removeReleasePlan'; environmentActive: boolean }
| { type: 'startMilestone'; milestone: IReleasePlanMilestone }
| {
type: 'createMilestoneProgression';
payload: CreateMilestoneProgressionSchema;
}
| {
type: 'updateMilestoneProgression';
sourceMilestoneId: string;
payload: UpdateMilestoneProgressionSchema;
type: 'changeMilestoneProgression';
payload: ChangeMilestoneProgressionSchema;
}
| {
type: 'deleteMilestoneProgression';
@ -201,25 +193,14 @@ export const ReleasePlan = ({
});
break;
case 'createMilestoneProgression':
case 'changeMilestoneProgression':
await addChange(projectId, environment, {
feature: featureName,
action: 'createMilestoneProgression',
action: 'changeMilestoneProgression',
payload: changeRequestAction.payload,
});
break;
case 'updateMilestoneProgression':
await addChange(projectId, environment, {
feature: featureName,
action: 'updateMilestoneProgression',
payload: {
sourceMilestone: changeRequestAction.sourceMilestoneId,
...changeRequestAction.payload,
},
});
break;
case 'deleteMilestoneProgression':
await addChange(projectId, environment, {
feature: featureName,
@ -314,18 +295,10 @@ export const ReleasePlan = ({
});
};
const handleAddToChangeRequest = (
action:
| {
type: 'createMilestoneProgression';
payload: CreateMilestoneProgressionSchema;
}
| {
type: 'updateMilestoneProgression';
sourceMilestoneId: string;
payload: UpdateMilestoneProgressionSchema;
},
) => {
const handleAddToChangeRequest = (action: {
type: 'changeMilestoneProgression';
payload: ChangeMilestoneProgressionSchema;
}) => {
setChangeRequestAction(action);
};

View File

@ -7,7 +7,7 @@ import {
useMilestoneProgressionForm,
getTimeValueAndUnitFromMinutes,
} from '../hooks/useMilestoneProgressionForm.js';
import type { UpdateMilestoneProgressionSchema } from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import type { ReactNode } from 'react';
import { useEffect } from 'react';
@ -58,8 +58,9 @@ const StyledButtonGroup = styled('div')(({ theme }) => ({
interface IMilestoneTransitionDisplayProps {
intervalMinutes: number;
targetMilestoneId: string;
onSave: (
payload: UpdateMilestoneProgressionSchema,
payload: ChangeMilestoneProgressionSchema,
) => Promise<{ shouldReset?: boolean }>;
onDelete: () => void;
milestoneName: string;
@ -69,6 +70,7 @@ interface IMilestoneTransitionDisplayProps {
export const MilestoneTransitionDisplay = ({
intervalMinutes,
targetMilestoneId,
onSave,
onDelete,
milestoneName,
@ -97,7 +99,8 @@ export const MilestoneTransitionDisplay = ({
const handleSave = async () => {
if (!hasChanged) return;
const payload: UpdateMilestoneProgressionSchema = {
const payload: ChangeMilestoneProgressionSchema = {
targetMilestone: targetMilestoneId,
transitionCondition: {
intervalMinutes: currentIntervalMinutes,
},

View File

@ -2,10 +2,7 @@ import Add from '@mui/icons-material/Add';
import { Button, styled } from '@mui/material';
import { Badge } from 'component/common/Badge/Badge';
import type { IReleasePlanMilestone } from 'interfaces/releasePlans';
import type {
CreateMilestoneProgressionSchema,
UpdateMilestoneProgressionSchema,
} from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { MilestoneAutomationSection } from '../ReleasePlanMilestone/MilestoneAutomationSection.tsx';
import { MilestoneTransitionDisplay } from '../ReleasePlanMilestone/MilestoneTransitionDisplay.tsx';
import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
@ -57,11 +54,8 @@ interface MilestoneAutomationProps {
pendingProgressionChange: PendingProgressionChange | null;
onOpenProgressionForm: () => void;
onCloseProgressionForm: () => void;
onCreateProgression: (
payload: CreateMilestoneProgressionSchema,
) => Promise<void>;
onUpdateProgression: (
payload: UpdateMilestoneProgressionSchema,
onChangeProgression: (
payload: ChangeMilestoneProgressionSchema,
) => Promise<{ shouldReset?: boolean }>;
onDeleteProgression: (milestone: IReleasePlanMilestone) => void;
}
@ -78,8 +72,7 @@ export const MilestoneAutomation = ({
pendingProgressionChange,
onOpenProgressionForm,
onCloseProgressionForm,
onCreateProgression,
onUpdateProgression,
onChangeProgression,
onDeleteProgression,
}: MilestoneAutomationProps) => {
const showAutomation =
@ -108,7 +101,7 @@ export const MilestoneAutomation = ({
<MilestoneProgressionForm
sourceMilestoneId={milestone.id}
targetMilestoneId={nextMilestoneId}
onSubmit={onCreateProgression}
onSubmit={onChangeProgression}
onCancel={onCloseProgressionForm}
/>
) : effectiveTransitionCondition ? (
@ -116,7 +109,8 @@ export const MilestoneAutomation = ({
intervalMinutes={
effectiveTransitionCondition.intervalMinutes
}
onSave={onUpdateProgression}
targetMilestoneId={nextMilestoneId}
onSave={onChangeProgression}
onDelete={() => onDeleteProgression(milestone)}
milestoneName={milestone.name}
status={status}

View File

@ -1,10 +1,7 @@
import { styled } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import type { IReleasePlanMilestone } from 'interfaces/releasePlans';
import type {
CreateMilestoneProgressionSchema,
UpdateMilestoneProgressionSchema,
} from 'openapi';
import type { ChangeMilestoneProgressionSchema } from 'openapi';
import { ReleasePlanMilestone } from '../ReleasePlanMilestone/ReleasePlanMilestone.tsx';
import { useMilestoneProgressionsApi } from 'hooks/api/actions/useMilestoneProgressionsApi/useMilestoneProgressionsApi';
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
@ -44,18 +41,10 @@ export interface IReleasePlanMilestoneItemProps {
onSetProgressionFormOpenIndex: (index: number | null) => void;
onStartMilestone?: (milestone: IReleasePlanMilestone) => void;
onDeleteProgression: (milestone: IReleasePlanMilestone) => void;
onAddToChangeRequest: (
action:
| {
type: 'createMilestoneProgression';
payload: CreateMilestoneProgressionSchema;
}
| {
type: 'updateMilestoneProgression';
sourceMilestoneId: string;
payload: UpdateMilestoneProgressionSchema;
},
) => void;
onAddToChangeRequest: (action: {
type: 'changeMilestoneProgression';
payload: ChangeMilestoneProgressionSchema;
}) => void;
getPendingProgressionChange: (
sourceMilestoneId: string,
) => PendingProgressionChange | null;
@ -85,8 +74,7 @@ export const ReleasePlanMilestoneItem = ({
featureName,
onUpdate,
}: IReleasePlanMilestoneItemProps) => {
const { createMilestoneProgression, updateMilestoneProgression } =
useMilestoneProgressionsApi();
const { changeMilestoneProgression } = useMilestoneProgressionsApi();
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
const { setToastData, setToastApiError } = useToast();
@ -98,50 +86,22 @@ export const ReleasePlanMilestoneItem = ({
const handleCloseProgressionForm = () =>
onSetProgressionFormOpenIndex(null);
const handleCreateProgression = async (
payload: CreateMilestoneProgressionSchema,
) => {
if (isChangeRequestConfigured(environment)) {
onAddToChangeRequest({
type: 'createMilestoneProgression',
payload,
});
handleCloseProgressionForm();
return;
}
try {
await createMilestoneProgression(
projectId,
environment,
featureName,
payload,
);
setToastData({
type: 'success',
text: 'Automation configured successfully',
});
handleCloseProgressionForm();
await onUpdate();
} catch (error: unknown) {
setToastApiError(formatUnknownError(error));
}
};
const handleUpdateProgression = async (
payload: UpdateMilestoneProgressionSchema,
const handleChangeProgression = async (
payload: ChangeMilestoneProgressionSchema,
): Promise<{ shouldReset?: boolean }> => {
if (isChangeRequestConfigured(environment)) {
onAddToChangeRequest({
type: 'updateMilestoneProgression',
sourceMilestoneId: milestone.id,
payload,
type: 'changeMilestoneProgression',
payload: {
...payload,
sourceMilestone: milestone.id,
},
});
return { shouldReset: true };
}
try {
await updateMilestoneProgression(
await changeMilestoneProgression(
projectId,
environment,
featureName,
@ -150,8 +110,9 @@ export const ReleasePlanMilestoneItem = ({
);
setToastData({
type: 'success',
text: 'Automation updated successfully',
text: 'Automation configured successfully',
});
handleCloseProgressionForm();
await onUpdate();
return {};
} catch (error: unknown) {
@ -187,8 +148,7 @@ export const ReleasePlanMilestoneItem = ({
pendingProgressionChange={pendingProgressionChange}
onOpenProgressionForm={handleOpenProgressionForm}
onCloseProgressionForm={handleCloseProgressionForm}
onCreateProgression={handleCreateProgression}
onUpdateProgression={handleUpdateProgression}
onChangeProgression={handleChangeProgression}
onDeleteProgression={onDeleteProgression}
/>
) : undefined;

View File

@ -22,8 +22,7 @@ export interface IChangeSchema {
| 'addReleasePlan'
| 'deleteReleasePlan'
| 'startMilestone'
| 'createMilestoneProgression'
| 'updateMilestoneProgression'
| 'changeMilestoneProgression'
| 'deleteMilestoneProgression';
payload: string | boolean | object | number | undefined;
}

View File

@ -1,40 +1,19 @@
import useAPI from '../useApi/useApi.js';
import type { CreateMilestoneProgressionSchema } from 'openapi/models/createMilestoneProgressionSchema';
import type { UpdateMilestoneProgressionSchema } from 'openapi/models/updateMilestoneProgressionSchema';
import type { ChangeMilestoneProgressionSchema } from 'openapi/models/changeMilestoneProgressionSchema';
export const useMilestoneProgressionsApi = () => {
const { makeRequest, createRequest, errors, loading } = useAPI({
propagateErrors: true,
});
const createMilestoneProgression = async (
projectId: string,
environment: string,
featureName: string,
body: CreateMilestoneProgressionSchema,
): Promise<void> => {
const requestId = 'createMilestoneProgression';
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions`;
const req = createRequest(
path,
{
method: 'POST',
body: JSON.stringify(body),
},
requestId,
);
await makeRequest(req.caller, req.id);
};
const updateMilestoneProgression = async (
const changeMilestoneProgression = async (
projectId: string,
environment: string,
featureName: string,
sourceMilestoneId: string,
body: UpdateMilestoneProgressionSchema,
body: ChangeMilestoneProgressionSchema,
): Promise<void> => {
const requestId = 'updateMilestoneProgression';
const requestId = 'changeMilestoneProgression';
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
const req = createRequest(
path,
@ -68,8 +47,7 @@ export const useMilestoneProgressionsApi = () => {
};
return {
createMilestoneProgression,
updateMilestoneProgression,
changeMilestoneProgression,
deleteMilestoneProgression,
errors,
loading,

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type CreateMilestoneProgression403 = {
export type ChangeMilestoneProgression401 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type CreateMilestoneProgression401 = {
export type ChangeMilestoneProgression403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -5,9 +5,13 @@
*/
import type { TransitionConditionSchema } from './transitionConditionSchema.js';
export type ChangeRequestOneOrManyCreateSchemaOneOfThreesevenPayload = {
/** The ID of the source milestone with progression to update. */
sourceMilestone: string;
/**
* Request body to create or update a milestone progression
*/
export interface ChangeMilestoneProgressionSchema {
/** The ID of the target milestone */
targetMilestone: string;
/** The condition configuration for the transition */
transitionCondition: TransitionConditionSchema;
};
[key: string]: unknown;
}

View File

@ -16,8 +16,7 @@ import type { ChangeRequestCreateFeatureSchemaOneOfTwotwo } from './changeReques
import type { ChangeRequestCreateFeatureSchemaOneOfTwofour } from './changeRequestCreateFeatureSchemaOneOfTwofour.js';
import type { ChangeRequestCreateFeatureSchemaOneOfTwoseven } from './changeRequestCreateFeatureSchemaOneOfTwoseven.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreezero } from './changeRequestCreateFeatureSchemaOneOfThreezero.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreetwo } from './changeRequestCreateFeatureSchemaOneOfThreetwo.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreefive } from './changeRequestCreateFeatureSchemaOneOfThreefive.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreethree } from './changeRequestCreateFeatureSchemaOneOfThreethree.js';
/**
* Data used to create a [change request](https://docs.getunleash.io/reference/change-requests) for a single feature change.
@ -36,5 +35,4 @@ export type ChangeRequestCreateFeatureSchema =
| ChangeRequestCreateFeatureSchemaOneOfTwofour
| ChangeRequestCreateFeatureSchemaOneOfTwoseven
| ChangeRequestCreateFeatureSchemaOneOfThreezero
| ChangeRequestCreateFeatureSchemaOneOfThreetwo
| ChangeRequestCreateFeatureSchemaOneOfThreefive;
| ChangeRequestCreateFeatureSchemaOneOfThreethree;

View File

@ -1,18 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateFeatureSchemaOneOfThreefiveAction } from './changeRequestCreateFeatureSchemaOneOfThreefiveAction.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreefivePayload } from './changeRequestCreateFeatureSchemaOneOfThreefivePayload.js';
/**
* Delete milestone progression.
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreefive = {
/** The name of this action. */
action: ChangeRequestCreateFeatureSchemaOneOfThreefiveAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestCreateFeatureSchemaOneOfThreefivePayload;
};

View File

@ -1,16 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* The name of this action.
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreefiveAction =
(typeof ChangeRequestCreateFeatureSchemaOneOfThreefiveAction)[keyof typeof ChangeRequestCreateFeatureSchemaOneOfThreefiveAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestCreateFeatureSchemaOneOfThreefiveAction = {
deleteMilestoneProgression: 'deleteMilestoneProgression',
} as const;

View File

@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateFeatureSchemaOneOfThreethreeAction } from './changeRequestCreateFeatureSchemaOneOfThreethreeAction.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreethreePayload } from './changeRequestCreateFeatureSchemaOneOfThreethreePayload.js';
/**
* Delete milestone progression.
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreethree = {
/** The name of this action. */
action: ChangeRequestCreateFeatureSchemaOneOfThreethreeAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestCreateFeatureSchemaOneOfThreethreePayload;
};

View File

@ -7,10 +7,10 @@
/**
* The name of this action.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfFourzeroAction =
(typeof ChangeRequestOneOrManyCreateSchemaOneOfFourzeroAction)[keyof typeof ChangeRequestOneOrManyCreateSchemaOneOfFourzeroAction];
export type ChangeRequestCreateFeatureSchemaOneOfThreethreeAction =
(typeof ChangeRequestCreateFeatureSchemaOneOfThreethreeAction)[keyof typeof ChangeRequestCreateFeatureSchemaOneOfThreethreeAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestOneOrManyCreateSchemaOneOfFourzeroAction = {
export const ChangeRequestCreateFeatureSchemaOneOfThreethreeAction = {
deleteMilestoneProgression: 'deleteMilestoneProgression',
} as const;

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfFourzeroPayload = {
export type ChangeRequestCreateFeatureSchemaOneOfThreethreePayload = {
/** The ID of the source milestone with progression to delete. */
sourceMilestone: string;
};

View File

@ -1,18 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateFeatureSchemaOneOfThreetwoAction } from './changeRequestCreateFeatureSchemaOneOfThreetwoAction.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreetwoPayload } from './changeRequestCreateFeatureSchemaOneOfThreetwoPayload.js';
/**
* Update milestone progression transition condition.
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreetwo = {
/** The name of this action. */
action: ChangeRequestCreateFeatureSchemaOneOfThreetwoAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestCreateFeatureSchemaOneOfThreetwoPayload;
};

View File

@ -1,16 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* The name of this action.
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreetwoAction =
(typeof ChangeRequestCreateFeatureSchemaOneOfThreetwoAction)[keyof typeof ChangeRequestCreateFeatureSchemaOneOfThreetwoAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestCreateFeatureSchemaOneOfThreetwoAction = {
updateMilestoneProgression: 'updateMilestoneProgression',
} as const;

View File

@ -4,15 +4,15 @@
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateFeatureSchemaOneOfThreezeroAction } from './changeRequestCreateFeatureSchemaOneOfThreezeroAction.js';
import type { CreateMilestoneProgressionSchema } from './createMilestoneProgressionSchema.js';
import type { ChangeRequestCreateFeatureSchemaOneOfThreezeroPayload } from './changeRequestCreateFeatureSchemaOneOfThreezeroPayload.js';
/**
* Create milestone progression from one milestone to another.
* Create or update milestone progression from one milestone to another.
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreezero = {
/** The name of this action. */
action: ChangeRequestCreateFeatureSchemaOneOfThreezeroAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: CreateMilestoneProgressionSchema;
payload: ChangeRequestCreateFeatureSchemaOneOfThreezeroPayload;
};

View File

@ -12,5 +12,5 @@ export type ChangeRequestCreateFeatureSchemaOneOfThreezeroAction =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestCreateFeatureSchemaOneOfThreezeroAction = {
createMilestoneProgression: 'createMilestoneProgression',
changeMilestoneProgression: 'changeMilestoneProgression',
} as const;

View File

@ -5,14 +5,11 @@
*/
import type { TransitionConditionSchema } from './transitionConditionSchema.js';
/**
* Request body to create a milestone progression
*/
export interface CreateMilestoneProgressionSchema {
export type ChangeRequestCreateFeatureSchemaOneOfThreezeroPayload = {
/** The ID of the source milestone */
sourceMilestone: string;
/** The ID of the target milestone */
targetMilestone: string;
/** The condition configuration for the transition */
transitionCondition: TransitionConditionSchema;
}
};

View File

@ -18,8 +18,7 @@ import type { ChangeRequestCreateSchemaOneOfTwoseven } from './changeRequestCrea
import type { ChangeRequestCreateSchemaOneOfTwonine } from './changeRequestCreateSchemaOneOfTwonine.js';
import type { ChangeRequestCreateSchemaOneOfThreetwo } from './changeRequestCreateSchemaOneOfThreetwo.js';
import type { ChangeRequestCreateSchemaOneOfThreefive } from './changeRequestCreateSchemaOneOfThreefive.js';
import type { ChangeRequestCreateSchemaOneOfThreeseven } from './changeRequestCreateSchemaOneOfThreeseven.js';
import type { ChangeRequestCreateSchemaOneOfFourzero } from './changeRequestCreateSchemaOneOfFourzero.js';
import type { ChangeRequestCreateSchemaOneOfThreeeight } from './changeRequestCreateSchemaOneOfThreeeight.js';
/**
* Data used to create a [change request](https://docs.getunleash.io/reference/change-requests) for a single feature or segment change.
@ -40,5 +39,4 @@ export type ChangeRequestCreateSchema =
| ChangeRequestCreateSchemaOneOfTwonine
| ChangeRequestCreateSchemaOneOfThreetwo
| ChangeRequestCreateSchemaOneOfThreefive
| ChangeRequestCreateSchemaOneOfThreeseven
| ChangeRequestCreateSchemaOneOfFourzero;
| ChangeRequestCreateSchemaOneOfThreeeight;

View File

@ -1,18 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateSchemaOneOfFourzeroAction } from './changeRequestCreateSchemaOneOfFourzeroAction.js';
import type { ChangeRequestCreateSchemaOneOfFourzeroPayload } from './changeRequestCreateSchemaOneOfFourzeroPayload.js';
/**
* Delete milestone progression.
*/
export type ChangeRequestCreateSchemaOneOfFourzero = {
/** The name of this action. */
action: ChangeRequestCreateSchemaOneOfFourzeroAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestCreateSchemaOneOfFourzeroPayload;
};

View File

@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateSchemaOneOfThreeeightAction } from './changeRequestCreateSchemaOneOfThreeeightAction.js';
import type { ChangeRequestCreateSchemaOneOfThreeeightPayload } from './changeRequestCreateSchemaOneOfThreeeightPayload.js';
/**
* Delete milestone progression.
*/
export type ChangeRequestCreateSchemaOneOfThreeeight = {
/** The name of this action. */
action: ChangeRequestCreateSchemaOneOfThreeeightAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestCreateSchemaOneOfThreeeightPayload;
};

View File

@ -7,10 +7,10 @@
/**
* The name of this action.
*/
export type ChangeRequestCreateSchemaOneOfFourzeroAction =
(typeof ChangeRequestCreateSchemaOneOfFourzeroAction)[keyof typeof ChangeRequestCreateSchemaOneOfFourzeroAction];
export type ChangeRequestCreateSchemaOneOfThreeeightAction =
(typeof ChangeRequestCreateSchemaOneOfThreeeightAction)[keyof typeof ChangeRequestCreateSchemaOneOfThreeeightAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestCreateSchemaOneOfFourzeroAction = {
export const ChangeRequestCreateSchemaOneOfThreeeightAction = {
deleteMilestoneProgression: 'deleteMilestoneProgression',
} as const;

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type ChangeRequestCreateSchemaOneOfFourzeroPayload = {
export type ChangeRequestCreateSchemaOneOfThreeeightPayload = {
/** The ID of the source milestone with progression to delete. */
sourceMilestone: string;
};

View File

@ -4,15 +4,15 @@
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateSchemaOneOfThreefiveAction } from './changeRequestCreateSchemaOneOfThreefiveAction.js';
import type { CreateMilestoneProgressionSchema } from './createMilestoneProgressionSchema.js';
import type { ChangeRequestCreateSchemaOneOfThreefivePayload } from './changeRequestCreateSchemaOneOfThreefivePayload.js';
/**
* Create milestone progression from one milestone to another.
* Create or update milestone progression from one milestone to another.
*/
export type ChangeRequestCreateSchemaOneOfThreefive = {
/** The name of this action. */
action: ChangeRequestCreateSchemaOneOfThreefiveAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: CreateMilestoneProgressionSchema;
payload: ChangeRequestCreateSchemaOneOfThreefivePayload;
};

View File

@ -12,5 +12,5 @@ export type ChangeRequestCreateSchemaOneOfThreefiveAction =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestCreateSchemaOneOfThreefiveAction = {
createMilestoneProgression: 'createMilestoneProgression',
changeMilestoneProgression: 'changeMilestoneProgression',
} as const;

View File

@ -5,9 +5,11 @@
*/
import type { TransitionConditionSchema } from './transitionConditionSchema.js';
export type ChangeRequestCreateFeatureSchemaOneOfThreetwoPayload = {
/** The ID of the source milestone with progression to update. */
export type ChangeRequestCreateSchemaOneOfThreefivePayload = {
/** The ID of the source milestone */
sourceMilestone: string;
/** The ID of the target milestone */
targetMilestone: string;
/** The condition configuration for the transition */
transitionCondition: TransitionConditionSchema;
};

View File

@ -1,18 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestCreateSchemaOneOfThreesevenAction } from './changeRequestCreateSchemaOneOfThreesevenAction.js';
import type { ChangeRequestCreateSchemaOneOfThreesevenPayload } from './changeRequestCreateSchemaOneOfThreesevenPayload.js';
/**
* Update milestone progression transition condition.
*/
export type ChangeRequestCreateSchemaOneOfThreeseven = {
/** The name of this action. */
action: ChangeRequestCreateSchemaOneOfThreesevenAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestCreateSchemaOneOfThreesevenPayload;
};

View File

@ -1,16 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* The name of this action.
*/
export type ChangeRequestCreateSchemaOneOfThreesevenAction =
(typeof ChangeRequestCreateSchemaOneOfThreesevenAction)[keyof typeof ChangeRequestCreateSchemaOneOfThreesevenAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestCreateSchemaOneOfThreesevenAction = {
updateMilestoneProgression: 'updateMilestoneProgression',
} as const;

View File

@ -18,8 +18,7 @@ import type { ChangeRequestOneOrManyCreateSchemaOneOfTwoseven } from './changeRe
import type { ChangeRequestOneOrManyCreateSchemaOneOfTwonine } from './changeRequestOneOrManyCreateSchemaOneOfTwonine.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreetwo } from './changeRequestOneOrManyCreateSchemaOneOfThreetwo.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreefive } from './changeRequestOneOrManyCreateSchemaOneOfThreefive.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreeseven } from './changeRequestOneOrManyCreateSchemaOneOfThreeseven.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfFourzero } from './changeRequestOneOrManyCreateSchemaOneOfFourzero.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreeeight } from './changeRequestOneOrManyCreateSchemaOneOfThreeeight.js';
import type { ChangeRequestCreateSchema } from './changeRequestCreateSchema.js';
/**
@ -41,6 +40,5 @@ export type ChangeRequestOneOrManyCreateSchema =
| ChangeRequestOneOrManyCreateSchemaOneOfTwonine
| ChangeRequestOneOrManyCreateSchemaOneOfThreetwo
| ChangeRequestOneOrManyCreateSchemaOneOfThreefive
| ChangeRequestOneOrManyCreateSchemaOneOfThreeseven
| ChangeRequestOneOrManyCreateSchemaOneOfFourzero
| ChangeRequestOneOrManyCreateSchemaOneOfThreeeight
| ChangeRequestCreateSchema[];

View File

@ -1,18 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestOneOrManyCreateSchemaOneOfFourzeroAction } from './changeRequestOneOrManyCreateSchemaOneOfFourzeroAction.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfFourzeroPayload } from './changeRequestOneOrManyCreateSchemaOneOfFourzeroPayload.js';
/**
* Delete milestone progression.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfFourzero = {
/** The name of this action. */
action: ChangeRequestOneOrManyCreateSchemaOneOfFourzeroAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestOneOrManyCreateSchemaOneOfFourzeroPayload;
};

View File

@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreeeightAction } from './changeRequestOneOrManyCreateSchemaOneOfThreeeightAction.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreeeightPayload } from './changeRequestOneOrManyCreateSchemaOneOfThreeeightPayload.js';
/**
* Delete milestone progression.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfThreeeight = {
/** The name of this action. */
action: ChangeRequestOneOrManyCreateSchemaOneOfThreeeightAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestOneOrManyCreateSchemaOneOfThreeeightPayload;
};

View File

@ -0,0 +1,16 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* The name of this action.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfThreeeightAction =
(typeof ChangeRequestOneOrManyCreateSchemaOneOfThreeeightAction)[keyof typeof ChangeRequestOneOrManyCreateSchemaOneOfThreeeightAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestOneOrManyCreateSchemaOneOfThreeeightAction = {
deleteMilestoneProgression: 'deleteMilestoneProgression',
} as const;

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type ChangeRequestCreateFeatureSchemaOneOfThreefivePayload = {
export type ChangeRequestOneOrManyCreateSchemaOneOfThreeeightPayload = {
/** The ID of the source milestone with progression to delete. */
sourceMilestone: string;
};

View File

@ -4,15 +4,15 @@
* See `gen:api` script in package.json
*/
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreefiveAction } from './changeRequestOneOrManyCreateSchemaOneOfThreefiveAction.js';
import type { CreateMilestoneProgressionSchema } from './createMilestoneProgressionSchema.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreefivePayload } from './changeRequestOneOrManyCreateSchemaOneOfThreefivePayload.js';
/**
* Create milestone progression from one milestone to another.
* Create or update milestone progression from one milestone to another.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfThreefive = {
/** The name of this action. */
action: ChangeRequestOneOrManyCreateSchemaOneOfThreefiveAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: CreateMilestoneProgressionSchema;
payload: ChangeRequestOneOrManyCreateSchemaOneOfThreefivePayload;
};

View File

@ -12,5 +12,5 @@ export type ChangeRequestOneOrManyCreateSchemaOneOfThreefiveAction =
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestOneOrManyCreateSchemaOneOfThreefiveAction = {
createMilestoneProgression: 'createMilestoneProgression',
changeMilestoneProgression: 'changeMilestoneProgression',
} as const;

View File

@ -5,9 +5,11 @@
*/
import type { TransitionConditionSchema } from './transitionConditionSchema.js';
export type ChangeRequestCreateSchemaOneOfThreesevenPayload = {
/** The ID of the source milestone with progression to update. */
export type ChangeRequestOneOrManyCreateSchemaOneOfThreefivePayload = {
/** The ID of the source milestone */
sourceMilestone: string;
/** The ID of the target milestone */
targetMilestone: string;
/** The condition configuration for the transition */
transitionCondition: TransitionConditionSchema;
};

View File

@ -1,18 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreesevenAction } from './changeRequestOneOrManyCreateSchemaOneOfThreesevenAction.js';
import type { ChangeRequestOneOrManyCreateSchemaOneOfThreesevenPayload } from './changeRequestOneOrManyCreateSchemaOneOfThreesevenPayload.js';
/**
* Update milestone progression transition condition.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfThreeseven = {
/** The name of this action. */
action: ChangeRequestOneOrManyCreateSchemaOneOfThreesevenAction;
/** The name of the feature that this change applies to. */
feature: string;
payload: ChangeRequestOneOrManyCreateSchemaOneOfThreesevenPayload;
};

View File

@ -1,16 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* The name of this action.
*/
export type ChangeRequestOneOrManyCreateSchemaOneOfThreesevenAction =
(typeof ChangeRequestOneOrManyCreateSchemaOneOfThreesevenAction)[keyof typeof ChangeRequestOneOrManyCreateSchemaOneOfThreesevenAction];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ChangeRequestOneOrManyCreateSchemaOneOfThreesevenAction = {
updateMilestoneProgression: 'updateMilestoneProgression',
} as const;

View File

@ -22,7 +22,7 @@ export interface DetailedInvoicesLineSchema {
/** Optional start date for the metered period */
startDate?: string;
/** Total amount for this line item in minor currency units */
totalAmount: number;
/** Unit price for usage line items */
totalAmount?: number;
/** Unit price for the line item */
unitPrice?: number;
}

View File

@ -27,7 +27,7 @@ export type DetailedInvoicesSchemaInvoicesItem = {
/** Tax amount for the invoice */
taxAmount: number;
/** Tax percentage for the invoice */
taxPercentage?: number;
taxPercentage: number;
/** Total amount for the invoice */
totalAmount: number;
/** Usage line items (traffic, consumption usage, overages) */

View File

@ -4,7 +4,7 @@
* See `gen:api` script in package.json
*/
export type UpdateMilestoneProgression401 = {
export type EdgeInstanceHeartbeat400 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */

View File

@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { EdgeLicenseStateSchemaEdgeLicenseState } from './edgeLicenseStateSchemaEdgeLicenseState.js';
/**
* A model representing the Edge license state response.
*/
export interface EdgeLicenseStateSchema {
/** State of the current Enterprise Edge license */
edgeLicenseState: EdgeLicenseStateSchemaEdgeLicenseState;
}

View File

@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* State of the current Enterprise Edge license
*/
export type EdgeLicenseStateSchemaEdgeLicenseState =
(typeof EdgeLicenseStateSchemaEdgeLicenseState)[keyof typeof EdgeLicenseStateSchemaEdgeLicenseState];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const EdgeLicenseStateSchemaEdgeLicenseState = {
Valid: 'Valid',
Invalid: 'Invalid',
Expired: 'Expired',
} as const;

View File

@ -173,6 +173,7 @@ export const EventSchemaType = {
'milestone-progression-created': 'milestone-progression-created',
'milestone-progression-updated': 'milestone-progression-updated',
'milestone-progression-deleted': 'milestone-progression-deleted',
'milestone-progression-changed': 'milestone-progression-changed',
'user-preference-updated': 'user-preference-updated',
'scim-users-deleted': 'scim-users-deleted',
'scim-groups-deleted': 'scim-groups-deleted',

View File

@ -141,6 +141,9 @@ export * from './bulkToggleFeaturesEnvironmentOn415.js';
export * from './bulkToggleFeaturesSchema.js';
export * from './cdnApiTokenSchema.js';
export * from './cdnApiTokensSchema.js';
export * from './changeMilestoneProgression401.js';
export * from './changeMilestoneProgression403.js';
export * from './changeMilestoneProgressionSchema.js';
export * from './changePassword401.js';
export * from './changePassword403.js';
export * from './changePassword415.js';
@ -185,14 +188,12 @@ export * from './changeRequestCreateFeatureSchemaOneOfOnethreePayload.js';
export * from './changeRequestCreateFeatureSchemaOneOfPayload.js';
export * from './changeRequestCreateFeatureSchemaOneOfSix.js';
export * from './changeRequestCreateFeatureSchemaOneOfSixAction.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreefive.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreefiveAction.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreefivePayload.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreetwo.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreetwoAction.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreetwoPayload.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreethree.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreethreeAction.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreethreePayload.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreezero.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreezeroAction.js';
export * from './changeRequestCreateFeatureSchemaOneOfThreezeroPayload.js';
export * from './changeRequestCreateFeatureSchemaOneOfTwofour.js';
export * from './changeRequestCreateFeatureSchemaOneOfTwofourAction.js';
export * from './changeRequestCreateFeatureSchemaOneOfTwofourPayload.js';
@ -206,9 +207,6 @@ export * from './changeRequestCreateFeatureSchemaOneOfTwozeroAction.js';
export * from './changeRequestCreateSchema.js';
export * from './changeRequestCreateSchemaOneOf.js';
export * from './changeRequestCreateSchemaOneOfAction.js';
export * from './changeRequestCreateSchemaOneOfFourzero.js';
export * from './changeRequestCreateSchemaOneOfFourzeroAction.js';
export * from './changeRequestCreateSchemaOneOfFourzeroPayload.js';
export * from './changeRequestCreateSchemaOneOfNine.js';
export * from './changeRequestCreateSchemaOneOfNineAction.js';
export * from './changeRequestCreateSchemaOneOfOneeight.js';
@ -227,11 +225,12 @@ export * from './changeRequestCreateSchemaOneOfSixPayload.js';
export * from './changeRequestCreateSchemaOneOfThree.js';
export * from './changeRequestCreateSchemaOneOfThreeAction.js';
export * from './changeRequestCreateSchemaOneOfThreePayload.js';
export * from './changeRequestCreateSchemaOneOfThreeeight.js';
export * from './changeRequestCreateSchemaOneOfThreeeightAction.js';
export * from './changeRequestCreateSchemaOneOfThreeeightPayload.js';
export * from './changeRequestCreateSchemaOneOfThreefive.js';
export * from './changeRequestCreateSchemaOneOfThreefiveAction.js';
export * from './changeRequestCreateSchemaOneOfThreeseven.js';
export * from './changeRequestCreateSchemaOneOfThreesevenAction.js';
export * from './changeRequestCreateSchemaOneOfThreesevenPayload.js';
export * from './changeRequestCreateSchemaOneOfThreefivePayload.js';
export * from './changeRequestCreateSchemaOneOfThreetwo.js';
export * from './changeRequestCreateSchemaOneOfThreetwoAction.js';
export * from './changeRequestCreateSchemaOneOfThreetwoPayload.js';
@ -259,9 +258,6 @@ export * from './changeRequestFeatureSchema.js';
export * from './changeRequestOneOrManyCreateSchema.js';
export * from './changeRequestOneOrManyCreateSchemaOneOf.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfFourzero.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfFourzeroAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfFourzeroPayload.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfNine.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfNineAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfOneeight.js';
@ -280,11 +276,12 @@ export * from './changeRequestOneOrManyCreateSchemaOneOfSixPayload.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThree.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreeAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreePayload.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreeeight.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreeeightAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreeeightPayload.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreefive.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreefiveAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreeseven.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreesevenAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreesevenPayload.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreefivePayload.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreetwo.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreetwoAction.js';
export * from './changeRequestOneOrManyCreateSchemaOneOfThreetwoPayload.js';
@ -464,9 +461,6 @@ export * from './createImpactMetricsConfigSchemaLabelSelectors.js';
export * from './createImpactMetricsConfigSchemaTimeRange.js';
export * from './createImpactMetricsConfigSchemaYAxisMin.js';
export * from './createInvitedUserSchema.js';
export * from './createMilestoneProgression401.js';
export * from './createMilestoneProgression403.js';
export * from './createMilestoneProgressionSchema.js';
export * from './createPat401.js';
export * from './createPat403.js';
export * from './createPat404.js';
@ -642,12 +636,15 @@ export * from './doraFeaturesSchema.js';
export * from './edgeEndpointTrafficSchema.js';
export * from './edgeInstanceDataSchema.js';
export * from './edgeInstanceDataSchemaHosting.js';
export * from './edgeInstanceHeartbeat400.js';
export * from './edgeInstanceTrafficSchema.js';
export * from './edgeInstanceTrafficSchemaAccessDenied.js';
export * from './edgeInstanceTrafficSchemaCachedResponses.js';
export * from './edgeInstanceTrafficSchemaGet.js';
export * from './edgeInstanceTrafficSchemaPost.js';
export * from './edgeLatencyMetricsSchema.js';
export * from './edgeLicenseStateSchema.js';
export * from './edgeLicenseStateSchemaEdgeLicenseState.js';
export * from './edgeProcessMetricsSchema.js';
export * from './edgeRequestStatsSchema.js';
export * from './edgeTokenSchema.js';
@ -988,6 +985,7 @@ export * from './legalValueSchema.js';
export * from './licenseCheckSchema.js';
export * from './licenseCheckSchemaMessageType.js';
export * from './licenseReadSchema.js';
export * from './licenseReadSchemaResources.js';
export * from './licenseUpdateSchema.js';
export * from './licensedUserSchema.js';
export * from './licensedUsersSchema.js';
@ -1504,10 +1502,6 @@ export * from './updateLicense400.js';
export * from './updateLicense401.js';
export * from './updateLicense403.js';
export * from './updateLicense415.js';
export * from './updateMilestoneProgression401.js';
export * from './updateMilestoneProgression403.js';
export * from './updateMilestoneProgression404.js';
export * from './updateMilestoneProgressionSchema.js';
export * from './updateMilestoneStrategy401.js';
export * from './updateMilestoneStrategy403.js';
export * from './updateMilestoneStrategy404.js';

View File

@ -3,6 +3,7 @@
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { LicenseReadSchemaResources } from './licenseReadSchemaResources.js';
/**
* A model representing a license response.
@ -22,10 +23,8 @@ export interface LicenseReadSchema {
isValid: boolean;
/** Name of plan that the license is for. */
plan?: string;
/** Number of release templates in the license. */
releaseTemplates?: number;
/** Number of seats in the license. */
seats?: number;
/** The resources available in the license. */
resources?: LicenseReadSchemaResources;
/** The actual license token. */
token?: string;
/** Type of license. */

View File

@ -0,0 +1,17 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* The resources available in the license.
*/
export type LicenseReadSchemaResources = {
/** Number of Edge instances in the license. */
edgeInstances?: number;
/** Number of release templates in the license. */
releaseTemplates?: number;
/** Number of seats in the license. */
seats?: number;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateMilestoneProgression403 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type UpdateMilestoneProgression404 = {
/** The ID of the error instance */
id?: string;
/** A description of what went wrong. */
message?: string;
/** The name of the error kind */
name?: string;
};

View File

@ -1,14 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { TransitionConditionSchema } from './transitionConditionSchema.js';
/**
* Request body to update a milestone progression transition condition
*/
export interface UpdateMilestoneProgressionSchema {
/** The updated condition configuration for the transition */
transitionCondition: TransitionConditionSchema;
}