-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deleting release-plan templates
- Loading branch information
Showing
3 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
frontend/src/component/releases/ReleaseManagement/TemplateDeleteDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Dialogue } from 'component/common/Dialogue/Dialogue'; | ||
import type { IReleasePlanTemplate } from 'interfaces/releasePlans'; | ||
|
||
interface ITemplateDeleteDialogProps { | ||
template?: IReleasePlanTemplate; | ||
open: boolean; | ||
setOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
onConfirm: (template: IReleasePlanTemplate) => void; | ||
} | ||
|
||
export const TemplateDeleteDialog: React.FC<ITemplateDeleteDialogProps> = ({ | ||
template, | ||
open, | ||
setOpen, | ||
onConfirm, | ||
}) => { | ||
return ( | ||
<Dialogue | ||
title='Delete release plan template?' | ||
open={open} | ||
primaryButtonText='Delete template' | ||
secondaryButtonText='Cancel' | ||
onClick={() => onConfirm(template!)} | ||
onClose={() => { | ||
setOpen(false); | ||
}} | ||
> | ||
<p> | ||
You are about to delete release plan template:{' '} | ||
<strong>{template?.name}</strong> | ||
</p> | ||
</Dialogue> | ||
); | ||
}; |
23 changes: 23 additions & 0 deletions
23
frontend/src/hooks/api/actions/useReleasePlanTemplatesApi/useReleasePlanTemplatesApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import useAPI from '../useApi/useApi'; | ||
|
||
export const useReleasePlanTemplatesApi = () => { | ||
const { makeRequest, makeLightRequest, createRequest, errors, loading } = | ||
useAPI({ | ||
propagateErrors: true, | ||
}); | ||
|
||
const deleteReleasePlanTemplate = async (id: string) => { | ||
const path = `api/admin/release-plan-templates/${id}`; | ||
const req = createRequest(path, { | ||
method: 'DELETE', | ||
}); | ||
|
||
return makeRequest(req.caller, req.id); | ||
}; | ||
|
||
return { | ||
deleteReleasePlanTemplate, | ||
}; | ||
}; | ||
|
||
export default useReleasePlanTemplatesApi; |