mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
feat: send the add release plan change request from dialog when submitted (#9174)
This commit is contained in:
parent
07d4693f6d
commit
b04079c82d
@ -188,6 +188,7 @@ export const FeatureStrategyMenu = ({
|
||||
/>
|
||||
</Popover>
|
||||
<ReleasePlanAddChangeRequestDialog
|
||||
projectId={projectId}
|
||||
onClosing={() => setTemplateForChangeRequestDialog(undefined)}
|
||||
featureId={featureId}
|
||||
environmentId={environmentId}
|
||||
|
@ -2,12 +2,14 @@ import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
||||
import useToast from 'hooks/useToast';
|
||||
import { styled, Button } from '@mui/material';
|
||||
import type { IReleasePlanTemplate } from 'interfaces/releasePlans';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
|
||||
const StyledBoldSpan = styled('span')(({ theme }) => ({
|
||||
fontWeight: theme.typography.fontWeightBold,
|
||||
}));
|
||||
|
||||
interface IReleasePlanAddChangeRequestDialogProps {
|
||||
projectId: string;
|
||||
featureId: string;
|
||||
environmentId: string;
|
||||
releaseTemplate: IReleasePlanTemplate | undefined;
|
||||
@ -15,14 +17,24 @@ interface IReleasePlanAddChangeRequestDialogProps {
|
||||
}
|
||||
|
||||
export const ReleasePlanAddChangeRequestDialog = ({
|
||||
projectId,
|
||||
featureId,
|
||||
environmentId,
|
||||
releaseTemplate,
|
||||
onClosing,
|
||||
}: IReleasePlanAddChangeRequestDialogProps) => {
|
||||
const { setToastData } = useToast();
|
||||
const { addChange } = useChangeRequestApi();
|
||||
|
||||
const addReleasePlanToChangeRequest = async () => {
|
||||
addChange(projectId, environmentId, {
|
||||
feature: featureId,
|
||||
action: 'addReleasePlan',
|
||||
payload: {
|
||||
templateId: releaseTemplate?.id,
|
||||
},
|
||||
});
|
||||
|
||||
setToastData({
|
||||
type: 'success',
|
||||
text: 'Added to draft',
|
||||
|
@ -17,7 +17,8 @@ export interface IChangeSchema {
|
||||
| 'archiveFeature'
|
||||
| 'updateSegment'
|
||||
| 'addDependency'
|
||||
| 'deleteDependency';
|
||||
| 'deleteDependency'
|
||||
| 'addReleasePlan';
|
||||
payload: string | boolean | object | number | undefined;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user