mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 05:49:40 +02:00
[WEB-3395] fix: create sub work item operation (#2504)
* fix: add sub work item operation * chore: code refactor
This commit is contained in:
committed by
GitHub
parent
688d196bba
commit
6ff7dbdb3a
@@ -54,6 +54,7 @@ export const EpicOverviewRoot: FC<Props> = observer((props) => {
|
||||
containerClassName=""
|
||||
tabListClassName="w-36"
|
||||
tabListContainerClassName="justify-between"
|
||||
tabClassName="px-2 py-1"
|
||||
actions={
|
||||
<div className="flex items-center justify-end gap-2">
|
||||
{storedValue === "issues" ? (
|
||||
|
||||
@@ -34,9 +34,10 @@ export const EpicOverviewWidgetModals: FC<Props> = observer((props) => {
|
||||
issueCrudOperationState,
|
||||
setIssueCrudOperationState,
|
||||
createSubIssues: createEpicSubIssues,
|
||||
issue: { getIssueById },
|
||||
} = useIssueDetail(EIssueServiceType.EPICS);
|
||||
const { createSubIssues } = useIssueDetail();
|
||||
const { fetchEpicAnalytics } = useIssueTypes();
|
||||
const { fetchEpicAnalytics, getIssueTypeById } = useIssueTypes();
|
||||
|
||||
const handleAddSubIssueResponse = (successMessage: string) => {
|
||||
setToast({
|
||||
@@ -116,10 +117,16 @@ export const EpicOverviewWidgetModals: FC<Props> = observer((props) => {
|
||||
setLastWidgetAction("sub-issues");
|
||||
};
|
||||
|
||||
// derived values
|
||||
|
||||
const handleCreateUpdateModalOnSubmit = async (_issue: TIssue) => {
|
||||
if (_issue.parent_id) {
|
||||
if (_issue.parent_id === epicId) {
|
||||
await addSubIssueToEpic(workspaceSlug, projectId, epicId, [_issue.id]).then(() => {
|
||||
const parentIssue = getIssueById(_issue.parent_id);
|
||||
const parentIssueTypeDetails = parentIssue?.type_id ? getIssueTypeById(parentIssue.type_id) : undefined;
|
||||
const isParentEpic = parentIssueTypeDetails?.is_epic;
|
||||
|
||||
if (isParentEpic) {
|
||||
await addSubIssueToEpic(workspaceSlug, projectId, _issue.parent_id, [_issue.id]).then(() => {
|
||||
fetchEpicAnalytics(workspaceSlug, projectId, epicId);
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user