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:
parent
7ea14b8d22
commit
00166f4875
@ -383,12 +383,12 @@ export const ReleasePlan = ({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await deleteMilestoneProgression(
|
await deleteMilestoneProgression({
|
||||||
projectId,
|
projectId,
|
||||||
environment,
|
environment,
|
||||||
featureName,
|
featureName,
|
||||||
milestoneToDeleteProgression.id,
|
sourceMilestoneId: milestoneToDeleteProgression.id,
|
||||||
);
|
});
|
||||||
await refetch();
|
await refetch();
|
||||||
setMilestoneToDeleteProgression(null);
|
setMilestoneToDeleteProgression(null);
|
||||||
setToastData({
|
setToastData({
|
||||||
@ -403,12 +403,12 @@ export const ReleasePlan = ({
|
|||||||
|
|
||||||
const onResumeMilestoneProgressions = async () => {
|
const onResumeMilestoneProgressions = async () => {
|
||||||
try {
|
try {
|
||||||
await resumeMilestoneProgressions(
|
await resumeMilestoneProgressions({
|
||||||
projectId,
|
projectId,
|
||||||
environment,
|
environment,
|
||||||
featureName,
|
featureName,
|
||||||
id,
|
planId: id,
|
||||||
);
|
});
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
text: 'Automation resumed successfully',
|
text: 'Automation resumed successfully',
|
||||||
|
|||||||
@ -122,13 +122,13 @@ export const ReleasePlanMilestoneItem = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await changeMilestoneProgression(
|
await changeMilestoneProgression({
|
||||||
projectId,
|
projectId,
|
||||||
environment,
|
environment,
|
||||||
featureName,
|
featureName,
|
||||||
milestone.id,
|
sourceMilestoneId: milestone.id,
|
||||||
payload,
|
body: payload,
|
||||||
);
|
});
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
text: 'Automation configured successfully',
|
text: 'Automation configured successfully',
|
||||||
|
|||||||
@ -6,13 +6,19 @@ export const useMilestoneProgressionsApi = () => {
|
|||||||
propagateErrors: true,
|
propagateErrors: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const changeMilestoneProgression = async (
|
const changeMilestoneProgression = async ({
|
||||||
projectId: string,
|
projectId,
|
||||||
environment: string,
|
environment,
|
||||||
featureName: string,
|
featureName,
|
||||||
sourceMilestoneId: string,
|
sourceMilestoneId,
|
||||||
body: ChangeMilestoneProgressionSchema,
|
body,
|
||||||
): Promise<void> => {
|
}: {
|
||||||
|
projectId: string;
|
||||||
|
environment: string;
|
||||||
|
featureName: string;
|
||||||
|
sourceMilestoneId: string;
|
||||||
|
body: ChangeMilestoneProgressionSchema;
|
||||||
|
}): Promise<void> => {
|
||||||
const requestId = 'changeMilestoneProgression';
|
const requestId = 'changeMilestoneProgression';
|
||||||
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
|
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
|
||||||
const req = createRequest(
|
const req = createRequest(
|
||||||
@ -27,12 +33,17 @@ export const useMilestoneProgressionsApi = () => {
|
|||||||
await makeRequest(req.caller, req.id);
|
await makeRequest(req.caller, req.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMilestoneProgression = async (
|
const deleteMilestoneProgression = async ({
|
||||||
projectId: string,
|
projectId,
|
||||||
environment: string,
|
environment,
|
||||||
featureName: string,
|
featureName,
|
||||||
sourceMilestoneId: string,
|
sourceMilestoneId,
|
||||||
): Promise<void> => {
|
}: {
|
||||||
|
projectId: string;
|
||||||
|
environment: string;
|
||||||
|
featureName: string;
|
||||||
|
sourceMilestoneId: string;
|
||||||
|
}): Promise<void> => {
|
||||||
const requestId = 'deleteMilestoneProgression';
|
const requestId = 'deleteMilestoneProgression';
|
||||||
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
|
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${sourceMilestoneId}`;
|
||||||
const req = createRequest(
|
const req = createRequest(
|
||||||
@ -46,12 +57,17 @@ export const useMilestoneProgressionsApi = () => {
|
|||||||
await makeRequest(req.caller, req.id);
|
await makeRequest(req.caller, req.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const resumeMilestoneProgressions = async (
|
const resumeMilestoneProgressions = async ({
|
||||||
projectId: string,
|
projectId,
|
||||||
environment: string,
|
environment,
|
||||||
featureName: string,
|
featureName,
|
||||||
planId: string,
|
planId,
|
||||||
): Promise<void> => {
|
}: {
|
||||||
|
projectId: string;
|
||||||
|
environment: string;
|
||||||
|
featureName: string;
|
||||||
|
planId: string;
|
||||||
|
}): Promise<void> => {
|
||||||
const requestId = 'resumeProgressions';
|
const requestId = 'resumeProgressions';
|
||||||
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${planId}/resume`;
|
const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/progressions/${planId}/resume`;
|
||||||
const req = createRequest(
|
const req = createRequest(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user