1
0
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:
David Leek 2025-01-30 10:56:31 +01:00 committed by GitHub
parent 07d4693f6d
commit b04079c82d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View File

@ -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}

View File

@ -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',

View File

@ -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;
} }