1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

refactor: milestone progression methods (#11002)

This commit is contained in:
Mateusz Kwasniewski 2025-11-19 14:57:53 +01:00 committed by GitHub
parent 7ea14b8d22
commit 00166f4875
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 29 deletions

View File

@ -383,12 +383,12 @@ export const ReleasePlan = ({
return;
try {
await deleteMilestoneProgression(
await deleteMilestoneProgression({
projectId,
environment,
featureName,
milestoneToDeleteProgression.id,
);
sourceMilestoneId: milestoneToDeleteProgression.id,
});
await refetch();
setMilestoneToDeleteProgression(null);
setToastData({
@ -403,12 +403,12 @@ export const ReleasePlan = ({
const onResumeMilestoneProgressions = async () => {
try {
await resumeMilestoneProgressions(
await resumeMilestoneProgressions({
projectId,
environment,
featureName,
id,
);
planId: id,
});
setToastData({
type: 'success',
text: 'Automation resumed successfully',

View File

@ -122,13 +122,13 @@ export const ReleasePlanMilestoneItem = ({
}
try {
await changeMilestoneProgression(
await changeMilestoneProgression({
projectId,
environment,
featureName,
milestone.id,
payload,
);
sourceMilestoneId: milestone.id,
body: payload,
});
setToastData({
type: 'success',
text: 'Automation configured successfully',

View File

@ -6,13 +6,19 @@ export const useMilestoneProgressionsApi = () => {
propagateErrors: true,
});
const changeMilestoneProgression = async (
projectId: string,
environment: string,
featureName: string,
sourceMilestoneId: string,
body: ChangeMilestoneProgressionSchema,
): Promise<void> => {
const changeMilestoneProgression = async ({
projectId,
environment,
featureName,
sourceMilestoneId,
body,
}: {
projectId: string;
environment: string;
featureName: string;
sourceMilestoneId: string;
body: ChangeMilestoneProgressionSchema;
}): Promise<void> => {
const requestId = 'changeMilestoneProgression';
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
const req = createRequest(
@ -27,12 +33,17 @@ export const useMilestoneProgressionsApi = () => {
await makeRequest(req.caller, req.id);
};
const deleteMilestoneProgression = async (
projectId: string,
environment: string,
featureName: string,
sourceMilestoneId: string,
): Promise<void> => {
const deleteMilestoneProgression = async ({
projectId,
environment,
featureName,
sourceMilestoneId,
}: {
projectId: string;
environment: string;
featureName: string;
sourceMilestoneId: string;
}): Promise<void> => {
const requestId = 'deleteMilestoneProgression';
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
const req = createRequest(
@ -46,12 +57,17 @@ export const useMilestoneProgressionsApi = () => {
await makeRequest(req.caller, req.id);
};
const resumeMilestoneProgressions = async (
projectId: string,
environment: string,
featureName: string,
planId: string,
): Promise<void> => {
const resumeMilestoneProgressions = async ({
projectId,
environment,
featureName,
planId,
}: {
projectId: string;
environment: string;
featureName: string;
planId: string;
}): Promise<void> => {
const requestId = 'resumeProgressions';
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${planId}/resume`;
const req = createRequest(