forked from github/plane
fix: gantt issues not getting updated (#3075)
This commit is contained in:
parent
c33cfeb227
commit
07c15fcc1f
@ -54,20 +54,19 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
|||||||
|
|
||||||
const issues = issueIds.map((id) => issuesResponse?.[id]);
|
const issues = issueIds.map((id) => issuesResponse?.[id]);
|
||||||
|
|
||||||
const updateIssue = async (issue: IIssue, payload: IBlockUpdateData) => {
|
const updateIssueBlockStructure = async (issue: IIssue, data: IBlockUpdateData) => {
|
||||||
if (!workspaceSlug) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
//Todo fix sort order in the structure
|
const payload: any = { ...data };
|
||||||
await issueStore.updateIssue(
|
if (data.sort_order) payload.sort_order = data.sort_order.newSortOrder;
|
||||||
workspaceSlug.toString(),
|
|
||||||
issue.project,
|
await issueStore.updateIssue(workspaceSlug.toString(), issue.project, issue.id, payload, viewId);
|
||||||
issue.id,
|
};
|
||||||
{
|
|
||||||
start_date: payload.start_date,
|
const updateIssue = async (projectId: string, issueId: string, payload: Partial<IIssue>) => {
|
||||||
target_date: payload.target_date,
|
if (!workspaceSlug) return;
|
||||||
},
|
|
||||||
viewId
|
await issueStore.updateIssue(workspaceSlug.toString(), projectId, issueId, payload, viewId);
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
|
const isAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER;
|
||||||
@ -80,7 +79,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
|||||||
title="Issues"
|
title="Issues"
|
||||||
loaderTitle="Issues"
|
loaderTitle="Issues"
|
||||||
blocks={issues ? renderIssueBlocksStructure(issues as IIssueUnGroupedStructure) : null}
|
blocks={issues ? renderIssueBlocksStructure(issues as IIssueUnGroupedStructure) : null}
|
||||||
blockUpdateHandler={updateIssue}
|
blockUpdateHandler={updateIssueBlockStructure}
|
||||||
blockToRender={(data: IIssue) => <IssueGanttBlock data={data} />}
|
blockToRender={(data: IIssue) => <IssueGanttBlock data={data} />}
|
||||||
sidebarToRender={(props) => (
|
sidebarToRender={(props) => (
|
||||||
<IssueGanttSidebar
|
<IssueGanttSidebar
|
||||||
@ -102,8 +101,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
|||||||
projectId={peekProjectId.toString()}
|
projectId={peekProjectId.toString()}
|
||||||
issueId={peekIssueId.toString()}
|
issueId={peekIssueId.toString()}
|
||||||
handleIssue={async (issueToUpdate) => {
|
handleIssue={async (issueToUpdate) => {
|
||||||
// TODO: update the logic here
|
await updateIssue(peekProjectId.toString(), peekIssueId.toString(), issueToUpdate);
|
||||||
await updateIssue(issueToUpdate as IIssue, {});
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -7,9 +7,15 @@ import { useRouter } from "next/router";
|
|||||||
|
|
||||||
export const CycleGanttLayout: React.FC = observer(() => {
|
export const CycleGanttLayout: React.FC = observer(() => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { cycleId } = router.query as { cycleId: string };
|
const { cycleId } = router.query;
|
||||||
|
|
||||||
const { cycleIssues: cycleIssueStore, cycleIssuesFilter: cycleIssueFilterStore } = useMobxStore();
|
const { cycleIssues: cycleIssueStore, cycleIssuesFilter: cycleIssueFilterStore } = useMobxStore();
|
||||||
|
|
||||||
return <BaseGanttRoot issueFiltersStore={cycleIssueFilterStore} issueStore={cycleIssueStore} viewId={cycleId} />;
|
return (
|
||||||
|
<BaseGanttRoot
|
||||||
|
issueFiltersStore={cycleIssueFilterStore}
|
||||||
|
issueStore={cycleIssueStore}
|
||||||
|
viewId={cycleId?.toString()}
|
||||||
|
/>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
@ -7,9 +7,15 @@ import { useRouter } from "next/router";
|
|||||||
|
|
||||||
export const ModuleGanttLayout: React.FC = observer(() => {
|
export const ModuleGanttLayout: React.FC = observer(() => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { moduleId } = router.query as { moduleId: string };
|
const { moduleId } = router.query;
|
||||||
|
|
||||||
const { moduleIssues: moduleIssueStore, moduleIssuesFilter: moduleIssueFilterStore } = useMobxStore();
|
const { moduleIssues: moduleIssueStore, moduleIssuesFilter: moduleIssueFilterStore } = useMobxStore();
|
||||||
|
|
||||||
return <BaseGanttRoot issueFiltersStore={moduleIssueFilterStore} issueStore={moduleIssueStore} viewId={moduleId} />;
|
return (
|
||||||
|
<BaseGanttRoot
|
||||||
|
issueFiltersStore={moduleIssueFilterStore}
|
||||||
|
issueStore={moduleIssueStore}
|
||||||
|
viewId={moduleId?.toString()}
|
||||||
|
/>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user