mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +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>
|
</Popover>
|
||||||
<ReleasePlanAddChangeRequestDialog
|
<ReleasePlanAddChangeRequestDialog
|
||||||
|
projectId={projectId}
|
||||||
onClosing={() => setTemplateForChangeRequestDialog(undefined)}
|
onClosing={() => setTemplateForChangeRequestDialog(undefined)}
|
||||||
featureId={featureId}
|
featureId={featureId}
|
||||||
environmentId={environmentId}
|
environmentId={environmentId}
|
||||||
|
@ -2,12 +2,14 @@ import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
|||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import { styled, Button } from '@mui/material';
|
import { styled, Button } from '@mui/material';
|
||||||
import type { IReleasePlanTemplate } from 'interfaces/releasePlans';
|
import type { IReleasePlanTemplate } from 'interfaces/releasePlans';
|
||||||
|
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||||
|
|
||||||
const StyledBoldSpan = styled('span')(({ theme }) => ({
|
const StyledBoldSpan = styled('span')(({ theme }) => ({
|
||||||
fontWeight: theme.typography.fontWeightBold,
|
fontWeight: theme.typography.fontWeightBold,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
interface IReleasePlanAddChangeRequestDialogProps {
|
interface IReleasePlanAddChangeRequestDialogProps {
|
||||||
|
projectId: string;
|
||||||
featureId: string;
|
featureId: string;
|
||||||
environmentId: string;
|
environmentId: string;
|
||||||
releaseTemplate: IReleasePlanTemplate | undefined;
|
releaseTemplate: IReleasePlanTemplate | undefined;
|
||||||
@ -15,14 +17,24 @@ interface IReleasePlanAddChangeRequestDialogProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ReleasePlanAddChangeRequestDialog = ({
|
export const ReleasePlanAddChangeRequestDialog = ({
|
||||||
|
projectId,
|
||||||
featureId,
|
featureId,
|
||||||
environmentId,
|
environmentId,
|
||||||
releaseTemplate,
|
releaseTemplate,
|
||||||
onClosing,
|
onClosing,
|
||||||
}: IReleasePlanAddChangeRequestDialogProps) => {
|
}: IReleasePlanAddChangeRequestDialogProps) => {
|
||||||
const { setToastData } = useToast();
|
const { setToastData } = useToast();
|
||||||
|
const { addChange } = useChangeRequestApi();
|
||||||
|
|
||||||
const addReleasePlanToChangeRequest = async () => {
|
const addReleasePlanToChangeRequest = async () => {
|
||||||
|
addChange(projectId, environmentId, {
|
||||||
|
feature: featureId,
|
||||||
|
action: 'addReleasePlan',
|
||||||
|
payload: {
|
||||||
|
templateId: releaseTemplate?.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
text: 'Added to draft',
|
text: 'Added to draft',
|
||||||
|
@ -17,7 +17,8 @@ export interface IChangeSchema {
|
|||||||
| 'archiveFeature'
|
| 'archiveFeature'
|
||||||
| 'updateSegment'
|
| 'updateSegment'
|
||||||
| 'addDependency'
|
| 'addDependency'
|
||||||
| 'deleteDependency';
|
| 'deleteDependency'
|
||||||
|
| 'addReleasePlan';
|
||||||
payload: string | boolean | object | number | undefined;
|
payload: string | boolean | object | number | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user