mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02:00
https://linear.app/unleash/issue/2-3249/adding-a-release-plan-to-a-non-cr-environment-feels-too-immediate This adds a new confirmation / preview dialog when adding a release plan. What's cool about it is that it will describe what will happen before you confirm. It also acts as the "add to CR" dialog, so we now only have 1 dialog instead of 2 separate ones. This also refactors quite a bit of our code here, hopefully simplifying it. ### Simple (env disabled)  ### CR protected (env enabled) 
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { IReleasePlan } from 'interfaces/releasePlans';
|
|
import { useReleasePlanTemplate } from './api/getters/useReleasePlanTemplates/useReleasePlanTemplate';
|
|
|
|
export const useReleasePlanPreview = (
|
|
templateId: string,
|
|
featureName: string,
|
|
environment: string,
|
|
): IReleasePlan => {
|
|
const { template } = useReleasePlanTemplate(templateId);
|
|
|
|
return {
|
|
...template,
|
|
featureName,
|
|
environment,
|
|
milestones: template.milestones.map((milestone) => ({
|
|
...milestone,
|
|
releasePlanDefinitionId: template.id,
|
|
strategies: (milestone.strategies || []).map((strategy) => ({
|
|
...strategy,
|
|
parameters: {
|
|
...strategy.parameters,
|
|
...(strategy.parameters.groupId && {
|
|
groupId: String(strategy.parameters.groupId).replaceAll(
|
|
'{{featureName}}',
|
|
featureName,
|
|
),
|
|
}),
|
|
},
|
|
milestoneId: milestone.id,
|
|
})),
|
|
})),
|
|
};
|
|
};
|