mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: kanban drag drop logic
This commit is contained in:
parent
d88a0885d5
commit
7b04adf03a
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 100,
|
"printWidth": 120,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"trailingComma": "es5"
|
"trailingComma": "es5"
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ export const FilterSelection = observer(() => {
|
|||||||
const handleFilterSectionVisibility = (section_key: string) =>
|
const handleFilterSectionVisibility = (section_key: string) =>
|
||||||
issueFilterStore?.issueView &&
|
issueFilterStore?.issueView &&
|
||||||
issueFilterStore?.issueLayout &&
|
issueFilterStore?.issueLayout &&
|
||||||
issueFilterVisibilityData[
|
issueFilterVisibilityData[issueFilterStore?.issueView === "my_issues" ? "my_issues" : "others"]?.filters?.[
|
||||||
issueFilterStore?.issueView === "my_issues" ? "my_issues" : "others"
|
issueFilterStore?.issueLayout
|
||||||
]?.filters?.[issueFilterStore?.issueLayout]?.includes(section_key);
|
]?.includes(section_key);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full h-full overflow-hidden select-none relative flex flex-col divide-y divide-custom-border-200">
|
<div className="w-full h-full overflow-hidden select-none relative flex flex-col divide-y divide-custom-border-200">
|
||||||
|
@ -14,11 +14,7 @@ export const IssueContent = ({ columnId, issues }: IssueContentProps) => {
|
|||||||
{issues && issues.length > 0 ? (
|
{issues && issues.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
{issues.map((issue: any, index: any) => (
|
{issues.map((issue: any, index: any) => (
|
||||||
<Draggable
|
<Draggable draggableId={issue.id} index={index} key={`issue-blocks-${columnId}-${issue.id}`}>
|
||||||
draggableId={issue.id}
|
|
||||||
index={index}
|
|
||||||
key={`issue-blocks-${columnId}-${issue.id}`}
|
|
||||||
>
|
|
||||||
{(provided: any, snapshot: any) => (
|
{(provided: any, snapshot: any) => (
|
||||||
<div
|
<div
|
||||||
key={issue.id}
|
key={issue.id}
|
||||||
@ -29,14 +25,10 @@ export const IssueContent = ({ columnId, issues }: IssueContentProps) => {
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={`min-h-[106px] text-sm rounded p-2 px-3 shadow-md space-y-[4px] border transition-all hover:cursor-grab ${
|
className={`min-h-[106px] text-sm rounded p-2 px-3 shadow-md space-y-[4px] border transition-all hover:cursor-grab ${
|
||||||
snapshot.isDragging
|
snapshot.isDragging ? `border-blue-500 bg-blue-50` : `border-transparent bg-white`
|
||||||
? `border-blue-500 bg-blue-50`
|
|
||||||
: `border-transparent bg-white`
|
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="text-xs line-clamp-1 text-gray-500">
|
<div className="text-xs line-clamp-1 text-gray-500">ONE-{issue.sequence_id}</div>
|
||||||
ONE-{issue.sequence_id}-{issue.sort_order}
|
|
||||||
</div>
|
|
||||||
<div className="line-clamp-2 h-[40px] text-sm font-medium">{issue.name}</div>
|
<div className="line-clamp-2 h-[40px] text-sm font-medium">{issue.name}</div>
|
||||||
<div className="h-[22px]">Footer</div>
|
<div className="h-[22px]">Footer</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,18 +4,14 @@ import { Plus } from "lucide-react";
|
|||||||
export const IssueHeader = () => (
|
export const IssueHeader = () => (
|
||||||
<div className="relative flex items-center w-full h-full gap-1">
|
<div className="relative flex items-center w-full h-full gap-1">
|
||||||
{/* default layout */}
|
{/* default layout */}
|
||||||
<div className=" border border-red-500 flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center">
|
<div className="flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center">I</div>
|
||||||
I
|
<div className="line-clamp-1 font-medium">Kanban Issue Heading</div>
|
||||||
</div>
|
<div className="flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center">0</div>
|
||||||
<div className=" border border-red-500 line-clamp-1 font-medium">Kanban Issue Heading</div>
|
|
||||||
<div className=" border border-red-500 flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center">
|
|
||||||
0
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className=" border border-red-500 ml-auto flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center cursor-pointer rounded-sm hover:bg-gray-100 transition-all">
|
<div className="ml-auto flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center cursor-pointer rounded-sm hover:bg-gray-100 transition-all">
|
||||||
M
|
M
|
||||||
</div>
|
</div>
|
||||||
<div className=" border border-red-500 flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center cursor-pointer rounded-sm hover:bg-gray-100 transition-all text-blue-800">
|
<div className="flex-shrink-0 w-[24px] h-[24px] flex justify-center items-center cursor-pointer rounded-sm hover:bg-gray-100 transition-all text-blue-800">
|
||||||
<Plus size={16} strokeWidth={2} />
|
<Plus size={16} strokeWidth={2} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,8 +11,7 @@ import { useMobxStore } from "lib/mobx/store-provider";
|
|||||||
import { RootStore } from "store/root";
|
import { RootStore } from "store/root";
|
||||||
|
|
||||||
export const IssueKanBanViewRoot = observer(() => {
|
export const IssueKanBanViewRoot = observer(() => {
|
||||||
const store: RootStore = useMobxStore();
|
const { issueView: issueViewStore, issueKanBanView: issueKanBanViewStore }: RootStore = useMobxStore();
|
||||||
const { issueView: issueViewStore } = store;
|
|
||||||
|
|
||||||
const onDragEnd = (result: any) => {
|
const onDragEnd = (result: any) => {
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
@ -25,7 +24,7 @@ export const IssueKanBanViewRoot = observer(() => {
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
console.log("result", result);
|
issueKanBanViewStore?.handleDragDrop(result.source, result.destination);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -38,10 +37,7 @@ export const IssueKanBanViewRoot = observer(() => {
|
|||||||
<DragDropContext onDragEnd={onDragEnd}>
|
<DragDropContext onDragEnd={onDragEnd}>
|
||||||
<div className="relative w-full h-full overflow-hidden !overflow-x-scroll flex">
|
<div className="relative w-full h-full overflow-hidden !overflow-x-scroll flex">
|
||||||
{Object.keys(issueViewStore?.getIssues).map((_issueStateKey: any) => (
|
{Object.keys(issueViewStore?.getIssues).map((_issueStateKey: any) => (
|
||||||
<div
|
<div key={`${_issueStateKey}`} className="flex-shrink-0 w-[380px] h-full relative flex flex-col">
|
||||||
key={`${_issueStateKey}`}
|
|
||||||
className="flex-shrink-0 w-[380px] h-full relative flex flex-col"
|
|
||||||
>
|
|
||||||
<div className="flex-shrink-0 w-full p-2">
|
<div className="flex-shrink-0 w-full p-2">
|
||||||
<IssueHeader />
|
<IssueHeader />
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,8 +19,7 @@ const KanBanViewRoot = () => {
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
console.log("request init--->");
|
console.log("request init--->");
|
||||||
const init = async () =>
|
const init = async () => await issueViewStore.getProjectIssuesAsync(workspace_slug, project_slug);
|
||||||
await issueViewStore.getProjectIssuesAsync(workspace_slug, project_slug);
|
|
||||||
if (workspace_slug && project_slug) init();
|
if (workspace_slug && project_slug) init();
|
||||||
console.log("request completed--->");
|
console.log("request completed--->");
|
||||||
}, [workspace_slug, project_slug, issueViewStore]);
|
}, [workspace_slug, project_slug, issueViewStore]);
|
||||||
|
@ -63,14 +63,8 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getIssueActivities(
|
async getIssueActivities(workspaceSlug: string, projectId: string, issueId: string): Promise<IIssueActivity[]> {
|
||||||
workspaceSlug: string,
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/history/`)
|
||||||
projectId: string,
|
|
||||||
issueId: string
|
|
||||||
): Promise<IIssueActivity[]> {
|
|
||||||
return this.get(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/history/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -78,9 +72,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getIssueComments(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
async getIssueComments(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
return this.get(
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/`)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -104,10 +96,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
},
|
},
|
||||||
user: ICurrentUserResponse | undefined
|
user: ICurrentUserResponse | undefined
|
||||||
) {
|
) {
|
||||||
return this.post(
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueMovedToCycleOrModuleEvent(
|
trackEventServices.trackIssueMovedToCycleOrModuleEvent(
|
||||||
{
|
{
|
||||||
@ -129,12 +118,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeIssueFromCycle(
|
async removeIssueFromCycle(workspaceSlug: string, projectId: string, cycleId: string, bridgeId: string) {
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
cycleId: string,
|
|
||||||
bridgeId: string
|
|
||||||
) {
|
|
||||||
return this.delete(
|
return this.delete(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/${bridgeId}/`
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/${bridgeId}/`
|
||||||
)
|
)
|
||||||
@ -156,10 +140,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
return this.post(
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueRelationEvent(response.data, "ISSUE_RELATION_CREATE", user);
|
trackEventServices.trackIssueRelationEvent(response.data, "ISSUE_RELATION_CREATE", user);
|
||||||
return response?.data;
|
return response?.data;
|
||||||
@ -189,10 +170,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createIssueProperties(workspaceSlug: string, projectId: string, data: any): Promise<any> {
|
async createIssueProperties(workspaceSlug: string, projectId: string, data: any): Promise<any> {
|
||||||
return this.post(
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-properties/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-properties/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -206,8 +184,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
data: any
|
data: any
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.patch(
|
return this.patch(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-properties/` +
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-properties/` + `${issuePropertyId}/`,
|
||||||
`${issuePropertyId}/`,
|
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
@ -223,10 +200,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
data: Partial<IIssueComment>,
|
data: Partial<IIssueComment>,
|
||||||
user: ICurrentUserResponse | undefined
|
user: ICurrentUserResponse | undefined
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.post(
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/comments/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueCommentEvent(response.data, "ISSUE_COMMENT_CREATE", user);
|
trackEventServices.trackIssueCommentEvent(response.data, "ISSUE_COMMENT_CREATE", user);
|
||||||
return response?.data;
|
return response?.data;
|
||||||
@ -335,10 +309,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
data: any,
|
data: any,
|
||||||
user: ICurrentUserResponse | undefined
|
user: ICurrentUserResponse | undefined
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.patch(
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/${labelId}/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/${labelId}/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueLabelEvent(
|
trackEventServices.trackIssueLabelEvent(
|
||||||
{
|
{
|
||||||
@ -367,9 +338,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
labelId: string,
|
labelId: string,
|
||||||
user: ICurrentUserResponse | undefined
|
user: ICurrentUserResponse | undefined
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.delete(
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/${labelId}/`)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-labels/${labelId}/`
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueLabelEvent(
|
trackEventServices.trackIssueLabelEvent(
|
||||||
{
|
{
|
||||||
@ -393,10 +362,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
data: Partial<IIssue>,
|
data: Partial<IIssue>,
|
||||||
user: ICurrentUserResponse | undefined
|
user: ICurrentUserResponse | undefined
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.patch(
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueEvent(response.data, "ISSUE_UPDATE", user);
|
trackEventServices.trackIssueEvent(response.data, "ISSUE_UPDATE", user);
|
||||||
return response?.data;
|
return response?.data;
|
||||||
@ -428,10 +394,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
data: any,
|
data: any,
|
||||||
user: ICurrentUserResponse | undefined
|
user: ICurrentUserResponse | undefined
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.delete(
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/bulk-delete-issues/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/bulk-delete-issues/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
trackEventServices.trackIssueBulkDeleteEvent(data, user);
|
trackEventServices.trackIssueBulkDeleteEvent(data, user);
|
||||||
return response?.data;
|
return response?.data;
|
||||||
@ -441,14 +404,8 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async subIssues(
|
async subIssues(workspaceSlug: string, projectId: string, issueId: string): Promise<ISubIssueResponse> {
|
||||||
workspaceSlug: string,
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`)
|
||||||
projectId: string,
|
|
||||||
issueId: string
|
|
||||||
): Promise<ISubIssueResponse> {
|
|
||||||
return this.get(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -461,10 +418,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
issueId: string,
|
issueId: string,
|
||||||
data: { sub_issue_ids: string[] }
|
data: { sub_issue_ids: string[] }
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.post(
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -481,10 +435,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.post(
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response;
|
throw error?.response;
|
||||||
@ -512,12 +463,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteIssueLink(
|
async deleteIssueLink(workspaceSlug: string, projectId: string, issueId: string, linkId: string): Promise<any> {
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
issueId: string,
|
|
||||||
linkId: string
|
|
||||||
): Promise<any> {
|
|
||||||
return this.delete(
|
return this.delete(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`
|
||||||
)
|
)
|
||||||
@ -527,12 +473,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadIssueAttachment(
|
async uploadIssueAttachment(workspaceSlug: string, projectId: string, issueId: string, file: FormData): Promise<any> {
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
issueId: string,
|
|
||||||
file: FormData
|
|
||||||
): Promise<any> {
|
|
||||||
return this.mediaUpload(
|
return this.mediaUpload(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/`,
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/`,
|
||||||
file
|
file
|
||||||
@ -543,14 +484,8 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getIssueAttachment(
|
async getIssueAttachment(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
workspaceSlug: string,
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/`)
|
||||||
projectId: string,
|
|
||||||
issueId: string
|
|
||||||
): Promise<any> {
|
|
||||||
return this.get(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-attachments/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -590,28 +525,16 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async retrieveArchivedIssue(
|
async retrieveArchivedIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
workspaceSlug: string,
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/${issueId}/`)
|
||||||
projectId: string,
|
|
||||||
issueId: string
|
|
||||||
): Promise<any> {
|
|
||||||
return this.get(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/${issueId}/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteArchivedIssue(
|
async deleteArchivedIssue(workspaceSlug: string, projectId: string, issuesId: string): Promise<any> {
|
||||||
workspaceSlug: string,
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/${issuesId}/`)
|
||||||
projectId: string,
|
|
||||||
issuesId: string
|
|
||||||
): Promise<any> {
|
|
||||||
return this.delete(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/archived-issues/${issuesId}/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
@ -648,10 +571,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
data: any,
|
data: any,
|
||||||
user: ICurrentUserResponse
|
user: ICurrentUserResponse
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.patch(
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`, data)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response;
|
throw error?.response;
|
||||||
@ -659,9 +579,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteDraftIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
async deleteDraftIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
return this.delete(
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response;
|
throw error?.response;
|
||||||
@ -669,9 +587,7 @@ export class ProjectIssuesServices extends APIService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getDraftIssueById(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
async getDraftIssueById(workspaceSlug: string, projectId: string, issueId: string): Promise<any> {
|
||||||
return this.get(
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`)
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-drafts/${issueId}/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response;
|
throw error?.response;
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
import { observable, action, computed, makeObservable, runInAction } from "mobx";
|
|
||||||
// types
|
|
||||||
import { RootStore } from "../root";
|
|
||||||
|
|
||||||
export interface IIssueViewStore {
|
|
||||||
loader: boolean;
|
|
||||||
error: any | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class IssueViewStore implements IIssueViewStore {
|
|
||||||
loader: boolean = false;
|
|
||||||
error: any | null = null;
|
|
||||||
|
|
||||||
// root store
|
|
||||||
rootStore;
|
|
||||||
// service
|
|
||||||
|
|
||||||
constructor(_rootStore: RootStore) {
|
|
||||||
makeObservable(this, {
|
|
||||||
// observable
|
|
||||||
loader: observable,
|
|
||||||
error: observable,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.rootStore = _rootStore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default IssueViewStore;
|
|
@ -49,11 +49,7 @@ export interface IIssueViewStore {
|
|||||||
getIssues: IIssues | null | undefined;
|
getIssues: IIssues | null | undefined;
|
||||||
// actions
|
// actions
|
||||||
getMyIssuesAsync: (workspaceId: string, fetchFilterToggle: boolean) => null | Promise<any>;
|
getMyIssuesAsync: (workspaceId: string, fetchFilterToggle: boolean) => null | Promise<any>;
|
||||||
getProjectIssuesAsync: (
|
getProjectIssuesAsync: (workspaceId: string, projectId: string, fetchFilterToggle: boolean) => null | Promise<any>;
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
fetchFilterToggle: boolean
|
|
||||||
) => null | Promise<any>;
|
|
||||||
getIssuesForModulesAsync: (
|
getIssuesForModulesAsync: (
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
@ -122,29 +118,25 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
if (!currentView || !currentWorkspaceId) return null;
|
if (!currentView || !currentWorkspaceId) return null;
|
||||||
|
|
||||||
const currentLayout: TIssueLayouts = currentProjectId
|
const currentLayout: TIssueLayouts = currentProjectId
|
||||||
? this.rootStore.issueFilters.issueFilters?.[currentWorkspaceId]
|
? this.rootStore.issueFilters.issueFilters?.[currentWorkspaceId]?.project_issue_properties?.[currentProjectId]
|
||||||
?.project_issue_properties?.[currentProjectId]?.issues?.display_filters?.layout
|
?.issues?.display_filters?.layout
|
||||||
: this.rootStore.issueFilters.issueFilters?.[currentWorkspaceId]?.my_issue_properties
|
: this.rootStore.issueFilters.issueFilters?.[currentWorkspaceId]?.my_issue_properties?.display_filters?.layout;
|
||||||
?.display_filters?.layout;
|
|
||||||
|
|
||||||
if (currentView === "my_issues")
|
if (currentView === "my_issues") return this.issues?.[currentWorkspaceId]?.my_issues?.[currentLayout];
|
||||||
return this.issues?.[currentWorkspaceId]?.my_issues?.[currentLayout];
|
|
||||||
else if (currentView === "issues" && currentProjectId)
|
else if (currentView === "issues" && currentProjectId)
|
||||||
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.issues?.[
|
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.issues?.[currentLayout];
|
||||||
|
else if (currentView === "modules" && currentProjectId && currentModuleId)
|
||||||
|
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.modules?.[currentModuleId]?.[
|
||||||
currentLayout
|
currentLayout
|
||||||
];
|
];
|
||||||
else if (currentView === "modules" && currentProjectId && currentModuleId)
|
|
||||||
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.modules?.[
|
|
||||||
currentModuleId
|
|
||||||
]?.[currentLayout];
|
|
||||||
else if (currentView === "cycles" && currentProjectId && currentCycleId)
|
else if (currentView === "cycles" && currentProjectId && currentCycleId)
|
||||||
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.cycles?.[
|
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.cycles?.[currentCycleId]?.[
|
||||||
currentCycleId
|
currentLayout
|
||||||
]?.[currentLayout];
|
];
|
||||||
else if (currentView === "views" && currentProjectId && currentViewId)
|
else if (currentView === "views" && currentProjectId && currentViewId)
|
||||||
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.views?.[
|
return this.issues?.[currentWorkspaceId]?.project_issues?.[currentProjectId]?.views?.[currentViewId]?.[
|
||||||
currentViewId
|
currentLayout
|
||||||
]?.[currentLayout];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -156,8 +148,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
if (fetchFilterToggle)
|
if (fetchFilterToggle) await this.rootStore.issueFilters.getWorkspaceMyIssuesFilters(workspaceId);
|
||||||
await this.rootStore.issueFilters.getWorkspaceMyIssuesFilters(workspaceId);
|
|
||||||
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
||||||
workspaceId,
|
workspaceId,
|
||||||
null,
|
null,
|
||||||
@ -175,8 +166,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
...this?.issues[workspaceId],
|
...this?.issues[workspaceId],
|
||||||
my_issues: {
|
my_issues: {
|
||||||
...this?.issues[workspaceId]?.my_issues,
|
...this?.issues[workspaceId]?.my_issues,
|
||||||
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]:
|
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]: issuesResponse,
|
||||||
issuesResponse,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -198,17 +188,12 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// fetching project issues
|
// fetching project issues
|
||||||
getProjectIssuesAsync = async (
|
getProjectIssuesAsync = async (workspaceId: string, projectId: string, fetchFilterToggle: boolean = true) => {
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
fetchFilterToggle: boolean = true
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
if (fetchFilterToggle)
|
if (fetchFilterToggle) await this.rootStore.issueFilters.getProjectIssueFilters(workspaceId, projectId);
|
||||||
await this.rootStore.issueFilters.getProjectIssueFilters(workspaceId, projectId);
|
|
||||||
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
||||||
workspaceId,
|
workspaceId,
|
||||||
projectId,
|
projectId,
|
||||||
@ -217,11 +202,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
null,
|
null,
|
||||||
"issues"
|
"issues"
|
||||||
);
|
);
|
||||||
const issuesResponse = await this.issueService.getIssuesWithParams(
|
const issuesResponse = await this.issueService.getIssuesWithParams(workspaceId, projectId, filteredParams);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
filteredParams
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesResponse) {
|
if (issuesResponse) {
|
||||||
const _issueResponse: any = {
|
const _issueResponse: any = {
|
||||||
@ -234,8 +215,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
...this?.issues?.[workspaceId]?.project_issues?.[projectId],
|
...this?.issues?.[workspaceId]?.project_issues?.[projectId],
|
||||||
issues: {
|
issues: {
|
||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.issues,
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.issues,
|
||||||
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]:
|
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]: issuesResponse,
|
||||||
issuesResponse,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -270,11 +250,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
if (fetchFilterToggle)
|
if (fetchFilterToggle)
|
||||||
await this.rootStore.issueFilters.getProjectIssueModuleFilters(
|
await this.rootStore.issueFilters.getProjectIssueModuleFilters(workspaceId, projectId, moduleId);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
moduleId
|
|
||||||
);
|
|
||||||
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
||||||
workspaceId,
|
workspaceId,
|
||||||
projectId,
|
projectId,
|
||||||
@ -303,8 +279,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.modules,
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.modules,
|
||||||
[moduleId]: {
|
[moduleId]: {
|
||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.modules?.[moduleId],
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.modules?.[moduleId],
|
||||||
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]:
|
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]: issuesResponse,
|
||||||
issuesResponse,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -340,11 +315,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
if (fetchFilterToggle)
|
if (fetchFilterToggle)
|
||||||
await this.rootStore.issueFilters.getProjectIssueCyclesFilters(
|
await this.rootStore.issueFilters.getProjectIssueCyclesFilters(workspaceId, projectId, cycleId);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
cycleId
|
|
||||||
);
|
|
||||||
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
||||||
workspaceId,
|
workspaceId,
|
||||||
projectId,
|
projectId,
|
||||||
@ -373,8 +344,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.cycles,
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.cycles,
|
||||||
[cycleId]: {
|
[cycleId]: {
|
||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.cycles?.[cycleId],
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.cycles?.[cycleId],
|
||||||
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]:
|
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]: issuesResponse,
|
||||||
issuesResponse,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -410,11 +380,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
if (fetchFilterToggle)
|
if (fetchFilterToggle)
|
||||||
await this.rootStore.issueFilters.getProjectIssueViewsFilters(
|
await this.rootStore.issueFilters.getProjectIssueViewsFilters(workspaceId, projectId, viewId);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
viewId
|
|
||||||
);
|
|
||||||
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
const filteredParams = this.rootStore.issueFilters.getComputedFilters(
|
||||||
workspaceId,
|
workspaceId,
|
||||||
projectId,
|
projectId,
|
||||||
@ -423,11 +389,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
viewId,
|
viewId,
|
||||||
"views"
|
"views"
|
||||||
);
|
);
|
||||||
const issuesResponse = await this.issueService.getIssuesWithParams(
|
const issuesResponse = await this.issueService.getIssuesWithParams(workspaceId, projectId, filteredParams);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
filteredParams
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesResponse) {
|
if (issuesResponse) {
|
||||||
const _issueResponse: any = {
|
const _issueResponse: any = {
|
||||||
@ -442,8 +404,7 @@ class IssueViewStore implements IIssueViewStore {
|
|||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.views,
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.views,
|
||||||
[viewId]: {
|
[viewId]: {
|
||||||
...this?.issues[workspaceId]?.project_issues?.[projectId]?.views?.[viewId],
|
...this?.issues[workspaceId]?.project_issues?.[projectId]?.views?.[viewId],
|
||||||
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]:
|
[this.rootStore?.issueFilters?.userFilters?.display_filters?.layout as string]: issuesResponse,
|
||||||
issuesResponse,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -45,7 +45,7 @@ export const displayPropertyGroupBy: { key: string; title: string }[] = [
|
|||||||
{ key: "state", title: "States" },
|
{ key: "state", title: "States" },
|
||||||
{ key: "state_detail.group", title: "State Groups" },
|
{ key: "state_detail.group", title: "State Groups" },
|
||||||
{ key: "priority", title: "Priority" },
|
{ key: "priority", title: "Priority" },
|
||||||
{ key: "Project", title: "Project" }, // required this on my issues
|
{ key: "project", title: "Project" }, // required this on my issues
|
||||||
{ key: "labels", title: "Labels" },
|
{ key: "labels", title: "Labels" },
|
||||||
{ key: "assignees", title: "Assignees" },
|
{ key: "assignees", title: "Assignees" },
|
||||||
{ key: "created_by", title: "Created By" },
|
{ key: "created_by", title: "Created By" },
|
||||||
|
175
web/store/issue-views/issue_detail.ts
Normal file
175
web/store/issue-views/issue_detail.ts
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
import { observable, action, makeObservable, runInAction } from "mobx";
|
||||||
|
// types
|
||||||
|
import { RootStore } from "../root";
|
||||||
|
// services
|
||||||
|
import { ProjectIssuesServices } from "services/issues.service";
|
||||||
|
|
||||||
|
export type IPeekMode = "side" | "modal" | "full";
|
||||||
|
|
||||||
|
export interface IIssueViewDetailStore {
|
||||||
|
loader: boolean;
|
||||||
|
error: any | null;
|
||||||
|
|
||||||
|
peekId: string | null;
|
||||||
|
peekMode: IPeekMode | null;
|
||||||
|
|
||||||
|
issue_detail: {
|
||||||
|
workspace: {
|
||||||
|
[key: string]: {
|
||||||
|
issues: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
setPeekId: (issueId: string | null) => void;
|
||||||
|
setPeekMode: (issueId: IPeekMode | null) => void;
|
||||||
|
|
||||||
|
// fetch issue details
|
||||||
|
fetchIssueDetailsAsync: (workspaceId: string, projectId: string, issueId: string) => void;
|
||||||
|
// creating issue
|
||||||
|
createIssueAsync: (workspaceId: string, projectId: string, issueId: string, data: any) => void;
|
||||||
|
// updating issue
|
||||||
|
updateIssueAsync: (workspaceId: string, projectId: string, issueId: string, data: any) => void;
|
||||||
|
// deleting issue
|
||||||
|
deleteIssueAsync: (workspaceId: string, projectId: string, issueId: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
class IssueViewDetailStore implements IIssueViewDetailStore {
|
||||||
|
loader: boolean = false;
|
||||||
|
error: any | null = null;
|
||||||
|
|
||||||
|
peekId: string | null = null;
|
||||||
|
peekMode: IPeekMode | null = null;
|
||||||
|
|
||||||
|
issue_detail: {
|
||||||
|
workspace: {
|
||||||
|
[key: string]: {
|
||||||
|
issues: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} = {
|
||||||
|
workspace: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// root store
|
||||||
|
rootStore;
|
||||||
|
// service
|
||||||
|
issueService;
|
||||||
|
|
||||||
|
constructor(_rootStore: RootStore) {
|
||||||
|
makeObservable(this, {
|
||||||
|
// observable
|
||||||
|
loader: observable,
|
||||||
|
error: observable,
|
||||||
|
|
||||||
|
peekId: observable,
|
||||||
|
peekMode: observable,
|
||||||
|
issue_detail: observable,
|
||||||
|
|
||||||
|
setPeekId: action,
|
||||||
|
setPeekMode: action,
|
||||||
|
|
||||||
|
fetchIssueDetailsAsync: action,
|
||||||
|
createIssueAsync: action,
|
||||||
|
updateIssueAsync: action,
|
||||||
|
deleteIssueAsync: action,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.rootStore = _rootStore;
|
||||||
|
this.issueService = new ProjectIssuesServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
setPeekId = (issueId: string | null) => (this.peekId = issueId);
|
||||||
|
setPeekMode = (mode: IPeekMode | null) => (this.peekMode = mode);
|
||||||
|
|
||||||
|
fetchIssueDetailsAsync = async (workspaceId: string, projectId: string, issueId: string) => {
|
||||||
|
try {
|
||||||
|
this.loader = true;
|
||||||
|
this.error = null;
|
||||||
|
|
||||||
|
console.log("workspaceId", workspaceId);
|
||||||
|
console.log("projectId", projectId);
|
||||||
|
console.log("issueId", issueId);
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
|
this.loader = false;
|
||||||
|
this.error = null;
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("error in fetching issue details", error);
|
||||||
|
this.loader = false;
|
||||||
|
this.error = error;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
createIssueAsync = async (workspaceId: string, projectId: string, issueId: string, data: any) => {
|
||||||
|
try {
|
||||||
|
this.loader = true;
|
||||||
|
this.error = null;
|
||||||
|
|
||||||
|
console.log("workspaceId", workspaceId);
|
||||||
|
console.log("projectId", projectId);
|
||||||
|
console.log("issueId", issueId);
|
||||||
|
console.log("data", data);
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
|
this.loader = false;
|
||||||
|
this.error = null;
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("error in fetching issue details", error);
|
||||||
|
this.loader = false;
|
||||||
|
this.error = error;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateIssueAsync = async (workspaceId: string, projectId: string, issueId: string, data: any) => {
|
||||||
|
try {
|
||||||
|
this.loader = true;
|
||||||
|
this.error = null;
|
||||||
|
|
||||||
|
const issueResponse = await this.issueService.patchIssue(workspaceId, projectId, issueId, data, undefined);
|
||||||
|
|
||||||
|
if (issueResponse) {
|
||||||
|
runInAction(() => {
|
||||||
|
this.loader = false;
|
||||||
|
this.error = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("error in fetching issue details", error);
|
||||||
|
this.loader = false;
|
||||||
|
this.error = error;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
deleteIssueAsync = async (workspaceId: string, projectId: string, issueId: string) => {
|
||||||
|
try {
|
||||||
|
this.loader = true;
|
||||||
|
this.error = null;
|
||||||
|
|
||||||
|
console.log("workspaceId", workspaceId);
|
||||||
|
console.log("projectId", projectId);
|
||||||
|
console.log("issueId", issueId);
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
|
this.loader = false;
|
||||||
|
this.error = null;
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("error in fetching issue details", error);
|
||||||
|
this.loader = false;
|
||||||
|
this.error = error;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IssueViewDetailStore;
|
@ -178,39 +178,17 @@ export interface IIssueFilterStore {
|
|||||||
|
|
||||||
getProjectIssueFilters: (workspaceId: string, projectId: string) => Promise<any>;
|
getProjectIssueFilters: (workspaceId: string, projectId: string) => Promise<any>;
|
||||||
|
|
||||||
getProjectIssueModuleFilters: (
|
getProjectIssueModuleFilters: (workspaceId: string, projectId: string, moduleId: string) => Promise<any>;
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
moduleId: string
|
|
||||||
) => Promise<any>;
|
|
||||||
updateProjectIssueModuleFilters: (
|
updateProjectIssueModuleFilters: (
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
moduleId: string,
|
moduleId: string,
|
||||||
data: any
|
data: any
|
||||||
) => Promise<any>;
|
) => Promise<any>;
|
||||||
getProjectIssueCyclesFilters: (
|
getProjectIssueCyclesFilters: (workspaceId: string, projectId: string, cycleId: string) => Promise<any>;
|
||||||
workspaceId: string,
|
updateProjectIssueCyclesFilters: (workspaceId: string, projectId: string, cycleId: string, data: any) => Promise<any>;
|
||||||
projectId: string,
|
getProjectIssueViewsFilters: (workspaceId: string, projectId: string, viewId: string) => Promise<any>;
|
||||||
cycleId: string
|
updateProjectIssueViewsFilters: (workspaceId: string, projectId: string, viewId: string, data: any) => Promise<any>;
|
||||||
) => Promise<any>;
|
|
||||||
updateProjectIssueCyclesFilters: (
|
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
cycleId: string,
|
|
||||||
data: any
|
|
||||||
) => Promise<any>;
|
|
||||||
getProjectIssueViewsFilters: (
|
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
viewId: string
|
|
||||||
) => Promise<any>;
|
|
||||||
updateProjectIssueViewsFilters: (
|
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
viewId: string,
|
|
||||||
data: any
|
|
||||||
) => Promise<any>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class IssueFilterStore implements IIssueFilterStore {
|
class IssueFilterStore implements IIssueFilterStore {
|
||||||
@ -323,11 +301,10 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
// computed
|
// computed
|
||||||
get issueLayout() {
|
get issueLayout() {
|
||||||
if (!this.workspaceId) return null;
|
if (!this.workspaceId) return null;
|
||||||
if (!this.projectId)
|
if (!this.projectId) return this.issueFilters?.[this.workspaceId]?.my_issue_properties?.display_filters?.layout;
|
||||||
return this.issueFilters?.[this.workspaceId]?.my_issue_properties?.display_filters?.layout;
|
|
||||||
if (this.projectId)
|
if (this.projectId)
|
||||||
return this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
return this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues?.display_filters
|
||||||
?.issues?.display_filters?.layout;
|
?.layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
get workspaceProjects() {
|
get workspaceProjects() {
|
||||||
@ -341,26 +318,22 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
|
|
||||||
get projectStates() {
|
get projectStates() {
|
||||||
if (!this.workspaceId || !this.projectId) return null;
|
if (!this.workspaceId || !this.projectId) return null;
|
||||||
return this.issueRenderFilters?.workspace_properties?.[this.workspaceId]?.project_properties?.[
|
return this.issueRenderFilters?.workspace_properties?.[this.workspaceId]?.project_properties?.[this.projectId]
|
||||||
this.projectId
|
?.states;
|
||||||
]?.states;
|
|
||||||
}
|
}
|
||||||
get projectLabels() {
|
get projectLabels() {
|
||||||
if (!this.workspaceId || !this.projectId) return null;
|
if (!this.workspaceId || !this.projectId) return null;
|
||||||
return this.issueRenderFilters?.workspace_properties?.[this.workspaceId]?.project_properties?.[
|
return this.issueRenderFilters?.workspace_properties?.[this.workspaceId]?.project_properties?.[this.projectId]
|
||||||
this.projectId
|
?.labels;
|
||||||
]?.labels;
|
|
||||||
}
|
}
|
||||||
get projectMembers() {
|
get projectMembers() {
|
||||||
if (!this.workspaceId || !this.projectId) return null;
|
if (!this.workspaceId || !this.projectId) return null;
|
||||||
return this.issueRenderFilters?.workspace_properties?.[this.workspaceId]?.project_properties?.[
|
return this.issueRenderFilters?.workspace_properties?.[this.workspaceId]?.project_properties?.[this.projectId]
|
||||||
this.projectId
|
?.members;
|
||||||
]?.members;
|
|
||||||
}
|
}
|
||||||
get projectDisplayProperties() {
|
get projectDisplayProperties() {
|
||||||
if (!this.workspaceId || !this.projectId) return null;
|
if (!this.workspaceId || !this.projectId) return null;
|
||||||
return this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
return this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.display_properties as any;
|
||||||
?.display_properties as any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get userFilters() {
|
get userFilters() {
|
||||||
@ -380,22 +353,17 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
} = {
|
} = {
|
||||||
filters: null,
|
filters: null,
|
||||||
display_filters:
|
display_filters:
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues
|
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues?.display_filters,
|
||||||
?.display_filters,
|
|
||||||
display_properties_id:
|
display_properties_id:
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.display_properties_id,
|
||||||
?.display_properties_id,
|
|
||||||
display_properties:
|
display_properties:
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.display_properties,
|
||||||
?.display_properties,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.issueView === "issues") {
|
if (this.issueView === "issues") {
|
||||||
_issueFilters = {
|
_issueFilters = {
|
||||||
..._issueFilters,
|
..._issueFilters,
|
||||||
filters:
|
filters: this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues?.filters,
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues
|
|
||||||
?.filters,
|
|
||||||
};
|
};
|
||||||
return _issueFilters;
|
return _issueFilters;
|
||||||
}
|
}
|
||||||
@ -404,8 +372,8 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
_issueFilters = {
|
_issueFilters = {
|
||||||
..._issueFilters,
|
..._issueFilters,
|
||||||
filters:
|
filters:
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.modules?.[this.moduleId]
|
||||||
?.modules?.[this.moduleId]?.filters,
|
?.filters,
|
||||||
};
|
};
|
||||||
return _issueFilters;
|
return _issueFilters;
|
||||||
}
|
}
|
||||||
@ -414,8 +382,8 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
_issueFilters = {
|
_issueFilters = {
|
||||||
..._issueFilters,
|
..._issueFilters,
|
||||||
filters:
|
filters:
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.cycles?.[this.cycleId]
|
||||||
?.cycles?.[this.cycleId]?.filters,
|
?.filters,
|
||||||
};
|
};
|
||||||
return _issueFilters;
|
return _issueFilters;
|
||||||
}
|
}
|
||||||
@ -424,8 +392,8 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
_issueFilters = {
|
_issueFilters = {
|
||||||
..._issueFilters,
|
..._issueFilters,
|
||||||
filters:
|
filters:
|
||||||
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.views?.[this.viewId]
|
||||||
?.views?.[this.viewId]?.filters,
|
?.filters,
|
||||||
};
|
};
|
||||||
return _issueFilters;
|
return _issueFilters;
|
||||||
}
|
}
|
||||||
@ -496,12 +464,11 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
[this.projectId]: {
|
[this.projectId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId],
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId],
|
||||||
issues: {
|
issues: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues,
|
||||||
?.issues,
|
|
||||||
[filter_type]: {
|
[filter_type]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues?.[
|
||||||
this.projectId
|
filter_type
|
||||||
]?.issues?.[filter_type],
|
],
|
||||||
[filter_key]: value,
|
[filter_key]: value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -524,17 +491,13 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_issue_properties: {
|
project_issue_properties: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
||||||
[this.projectId]: {
|
[this.projectId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId],
|
||||||
this.projectId
|
|
||||||
],
|
|
||||||
issues: {
|
issues: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues,
|
||||||
this.projectId
|
|
||||||
]?.issues,
|
|
||||||
[filter_type]: {
|
[filter_type]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.issues?.[
|
||||||
this.projectId
|
filter_type
|
||||||
]?.issues?.[filter_type],
|
],
|
||||||
[filter_key]: value,
|
[filter_key]: value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -556,21 +519,17 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_issue_properties: {
|
project_issue_properties: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
||||||
[this.projectId]: {
|
[this.projectId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId],
|
||||||
this.projectId
|
|
||||||
],
|
|
||||||
modules: {
|
modules: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.modules,
|
||||||
this.projectId
|
|
||||||
]?.modules,
|
|
||||||
[this.moduleId]: {
|
[this.moduleId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.modules?.[
|
||||||
this.projectId
|
this.moduleId
|
||||||
]?.modules?.[this.moduleId],
|
],
|
||||||
[filter_type]: {
|
[filter_type]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.modules?.[
|
||||||
this.projectId
|
this.moduleId
|
||||||
]?.modules?.[this.moduleId]?.[filter_type],
|
]?.[filter_type],
|
||||||
[filter_key]: value,
|
[filter_key]: value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -595,21 +554,17 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_issue_properties: {
|
project_issue_properties: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
||||||
[this.projectId]: {
|
[this.projectId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId],
|
||||||
this.projectId
|
|
||||||
],
|
|
||||||
cycles: {
|
cycles: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.cycles,
|
||||||
this.projectId
|
|
||||||
]?.cycles,
|
|
||||||
[this.cycleId]: {
|
[this.cycleId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.cycles?.[
|
||||||
this.projectId
|
this.cycleId
|
||||||
]?.cycles?.[this.cycleId],
|
],
|
||||||
[filter_type]: {
|
[filter_type]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.cycles?.[
|
||||||
this.projectId
|
this.cycleId
|
||||||
]?.cycles?.[this.cycleId]?.[filter_type],
|
]?.[filter_type],
|
||||||
[filter_key]: value,
|
[filter_key]: value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -618,12 +573,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.updateProjectIssueCyclesFilters(
|
this.updateProjectIssueCyclesFilters(this.workspaceId, this.projectId, this.cycleId, this.userFilters?.filters);
|
||||||
this.workspaceId,
|
|
||||||
this.projectId,
|
|
||||||
this.cycleId,
|
|
||||||
this.userFilters?.filters
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.issueView === "views" && this.viewId) {
|
if (this.issueView === "views" && this.viewId) {
|
||||||
@ -634,21 +584,17 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_issue_properties: {
|
project_issue_properties: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties,
|
||||||
[this.projectId]: {
|
[this.projectId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId],
|
||||||
this.projectId
|
|
||||||
],
|
|
||||||
views: {
|
views: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.views,
|
||||||
this.projectId
|
|
||||||
]?.views,
|
|
||||||
[this.viewId]: {
|
[this.viewId]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.views?.[
|
||||||
this.projectId
|
this.viewId
|
||||||
]?.views?.[this.viewId],
|
],
|
||||||
[filter_type]: {
|
[filter_type]: {
|
||||||
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[
|
...this.issueFilters?.[this.workspaceId]?.project_issue_properties?.[this.projectId]?.views?.[
|
||||||
this.projectId
|
this.viewId
|
||||||
]?.views?.[this.viewId]?.[filter_type],
|
]?.[filter_type],
|
||||||
[filter_key]: value,
|
[filter_key]: value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -657,12 +603,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.updateProjectIssueViewsFilters(
|
this.updateProjectIssueViewsFilters(this.workspaceId, this.projectId, this.viewId, this.userFilters?.filters);
|
||||||
this.workspaceId,
|
|
||||||
this.projectId,
|
|
||||||
this.viewId,
|
|
||||||
this.userFilters?.filters
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,26 +612,11 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
if (this.issueView === "issues")
|
if (this.issueView === "issues")
|
||||||
this.rootStore?.issueView?.getProjectIssuesAsync(this.workspaceId, this.projectId, false);
|
this.rootStore?.issueView?.getProjectIssuesAsync(this.workspaceId, this.projectId, false);
|
||||||
if (this.issueView === "modules" && this.moduleId)
|
if (this.issueView === "modules" && this.moduleId)
|
||||||
this.rootStore?.issueView?.getIssuesForModulesAsync(
|
this.rootStore?.issueView?.getIssuesForModulesAsync(this.workspaceId, this.projectId, this.moduleId, false);
|
||||||
this.workspaceId,
|
|
||||||
this.projectId,
|
|
||||||
this.moduleId,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (this.issueView === "cycles" && this.cycleId)
|
if (this.issueView === "cycles" && this.cycleId)
|
||||||
this.rootStore?.issueView?.getIssuesForCyclesAsync(
|
this.rootStore?.issueView?.getIssuesForCyclesAsync(this.workspaceId, this.projectId, this.cycleId, false);
|
||||||
this.workspaceId,
|
|
||||||
this.projectId,
|
|
||||||
this.cycleId,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (this.issueView === "views" && this.viewId)
|
if (this.issueView === "views" && this.viewId)
|
||||||
this.rootStore?.issueView?.getIssuesForViewsAsync(
|
this.rootStore?.issueView?.getIssuesForViewsAsync(this.workspaceId, this.projectId, this.viewId, false);
|
||||||
this.workspaceId,
|
|
||||||
this.projectId,
|
|
||||||
this.viewId,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
computedFilter = (filters: any, filteredParams: any) => {
|
computedFilter = (filters: any, filteredParams: any) => {
|
||||||
@ -698,9 +624,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
Object.keys(filters).map((key) => {
|
Object.keys(filters).map((key) => {
|
||||||
if (filters[key] != undefined && filteredParams.includes(key))
|
if (filters[key] != undefined && filteredParams.includes(key))
|
||||||
computedFilters[key] =
|
computedFilters[key] =
|
||||||
typeof filters[key] === "string" || typeof filters[key] === "boolean"
|
typeof filters[key] === "string" || typeof filters[key] === "boolean" ? filters[key] : filters[key].join(",");
|
||||||
? filters[key]
|
|
||||||
: filters[key].join(",");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return computedFilters;
|
return computedFilters;
|
||||||
@ -926,33 +850,25 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
order_by: issuesFiltersResponse?.view_props?.display_filters?.order_by ?? null,
|
order_by: issuesFiltersResponse?.view_props?.display_filters?.order_by ?? null,
|
||||||
type: issuesFiltersResponse?.view_props?.display_filters?.type ?? null,
|
type: issuesFiltersResponse?.view_props?.display_filters?.type ?? null,
|
||||||
sub_issue: issuesFiltersResponse?.view_props?.display_filters?.sub_issue ?? false,
|
sub_issue: issuesFiltersResponse?.view_props?.display_filters?.sub_issue ?? false,
|
||||||
show_empty_groups:
|
show_empty_groups: issuesFiltersResponse?.view_props?.display_filters?.show_empty_groups ?? false,
|
||||||
issuesFiltersResponse?.view_props?.display_filters?.show_empty_groups ?? false,
|
|
||||||
layout: issuesFiltersResponse?.view_props?.display_filters?.layout ?? "list",
|
layout: issuesFiltersResponse?.view_props?.display_filters?.layout ?? "list",
|
||||||
calendar_date_range:
|
calendar_date_range: issuesFiltersResponse?.view_props?.display_filters?.calendar_date_range ?? false,
|
||||||
issuesFiltersResponse?.view_props?.display_filters?.calendar_date_range ?? false,
|
start_target_date: issuesFiltersResponse?.view_props?.display_filters?.start_target_date ?? true,
|
||||||
start_target_date:
|
|
||||||
issuesFiltersResponse?.view_props?.display_filters?.start_target_date ?? true,
|
|
||||||
},
|
},
|
||||||
display_properties: {
|
display_properties: {
|
||||||
assignee: issuesFiltersResponse?.view_props?.display_properties?.assignee ?? false,
|
assignee: issuesFiltersResponse?.view_props?.display_properties?.assignee ?? false,
|
||||||
attachment_count:
|
attachment_count: issuesFiltersResponse?.view_props?.display_properties?.attachment_count ?? false,
|
||||||
issuesFiltersResponse?.view_props?.display_properties?.attachment_count ?? false,
|
created_on: issuesFiltersResponse?.view_props?.display_properties?.created_on ?? false,
|
||||||
created_on:
|
|
||||||
issuesFiltersResponse?.view_props?.display_properties?.created_on ?? false,
|
|
||||||
due_date: issuesFiltersResponse?.view_props?.display_properties?.due_date ?? false,
|
due_date: issuesFiltersResponse?.view_props?.display_properties?.due_date ?? false,
|
||||||
estimate: issuesFiltersResponse?.view_props?.display_properties?.estimate ?? false,
|
estimate: issuesFiltersResponse?.view_props?.display_properties?.estimate ?? false,
|
||||||
key: issuesFiltersResponse?.view_props?.display_properties?.key ?? false,
|
key: issuesFiltersResponse?.view_props?.display_properties?.key ?? false,
|
||||||
labels: issuesFiltersResponse?.view_props?.display_properties?.labels ?? false,
|
labels: issuesFiltersResponse?.view_props?.display_properties?.labels ?? false,
|
||||||
link: issuesFiltersResponse?.view_props?.display_properties?.link ?? false,
|
link: issuesFiltersResponse?.view_props?.display_properties?.link ?? false,
|
||||||
priority: issuesFiltersResponse?.view_props?.display_properties?.priority ?? false,
|
priority: issuesFiltersResponse?.view_props?.display_properties?.priority ?? false,
|
||||||
start_date:
|
start_date: issuesFiltersResponse?.view_props?.display_properties?.start_date ?? false,
|
||||||
issuesFiltersResponse?.view_props?.display_properties?.start_date ?? false,
|
|
||||||
state: issuesFiltersResponse?.view_props?.display_properties?.state ?? false,
|
state: issuesFiltersResponse?.view_props?.display_properties?.state ?? false,
|
||||||
sub_issue_count:
|
sub_issue_count: issuesFiltersResponse?.view_props?.display_properties?.sub_issue_count ?? false,
|
||||||
issuesFiltersResponse?.view_props?.display_properties?.sub_issue_count ?? false,
|
updated_on: issuesFiltersResponse?.view_props?.display_properties?.updated_on ?? false,
|
||||||
updated_on:
|
|
||||||
issuesFiltersResponse?.view_props?.display_properties?.updated_on ?? false,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -979,10 +895,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
const payload = {
|
const payload = {
|
||||||
view_props: data,
|
view_props: data,
|
||||||
};
|
};
|
||||||
const issuesFiltersResponse = await this.workspaceService.updateWorkspaceView(
|
const issuesFiltersResponse = await this.workspaceService.updateWorkspaceView(workspaceId, payload);
|
||||||
workspaceId,
|
|
||||||
payload
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesFiltersResponse) {
|
if (issuesFiltersResponse) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
@ -1014,8 +927,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_properties: {
|
project_properties: {
|
||||||
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties,
|
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties,
|
||||||
[projectId]: {
|
[projectId]: {
|
||||||
...this.issueRenderFilters?.workspace_properties?.[workspaceId]
|
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties?.[projectId],
|
||||||
?.project_properties?.[projectId],
|
|
||||||
states: issuesStateResponse,
|
states: issuesStateResponse,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1053,8 +965,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_properties: {
|
project_properties: {
|
||||||
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties,
|
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties,
|
||||||
[projectId]: {
|
[projectId]: {
|
||||||
...this.issueRenderFilters?.workspace_properties?.[workspaceId]
|
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties?.[projectId],
|
||||||
?.project_properties?.[projectId],
|
|
||||||
labels: issuesLabelsResponse,
|
labels: issuesLabelsResponse,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1081,10 +992,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
const issuesMembersResponse = await this.projectService.projectMembers(
|
const issuesMembersResponse = await this.projectService.projectMembers(workspaceId, projectId);
|
||||||
workspaceId,
|
|
||||||
projectId
|
|
||||||
);
|
|
||||||
if (issuesMembersResponse) {
|
if (issuesMembersResponse) {
|
||||||
const _issuesMembersResponse = {
|
const _issuesMembersResponse = {
|
||||||
...this.issueRenderFilters,
|
...this.issueRenderFilters,
|
||||||
@ -1095,8 +1003,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
project_properties: {
|
project_properties: {
|
||||||
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties,
|
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties,
|
||||||
[projectId]: {
|
[projectId]: {
|
||||||
...this.issueRenderFilters?.workspace_properties?.[workspaceId]
|
...this.issueRenderFilters?.workspace_properties?.[workspaceId]?.project_properties?.[projectId],
|
||||||
?.project_properties?.[projectId],
|
|
||||||
members: issuesMembersResponse,
|
members: issuesMembersResponse,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1124,10 +1031,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
const issuesDisplayPropertiesResponse = await this.issueService.getIssueProperties(
|
const issuesDisplayPropertiesResponse = await this.issueService.getIssueProperties(workspaceId, projectId);
|
||||||
workspaceId,
|
|
||||||
projectId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesDisplayPropertiesResponse) {
|
if (issuesDisplayPropertiesResponse) {
|
||||||
const _myUserId: string = issuesDisplayPropertiesResponse?.user;
|
const _myUserId: string = issuesDisplayPropertiesResponse?.user;
|
||||||
@ -1206,10 +1110,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
const issuesDisplayFiltersResponse = await this.projectService.projectMemberMe(
|
const issuesDisplayFiltersResponse = await this.projectService.projectMemberMe(workspaceId, projectId);
|
||||||
workspaceId,
|
|
||||||
projectId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesDisplayFiltersResponse) {
|
if (issuesDisplayFiltersResponse) {
|
||||||
const _filters = { ...issuesDisplayFiltersResponse?.view_props?.filters };
|
const _filters = { ...issuesDisplayFiltersResponse?.view_props?.filters };
|
||||||
@ -1256,11 +1157,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
const payload: any = {
|
const payload: any = {
|
||||||
view_props: data,
|
view_props: data,
|
||||||
};
|
};
|
||||||
const issuesFiltersResponse = await this.projectService.setProjectView(
|
const issuesFiltersResponse = await this.projectService.setProjectView(workspaceId, projectId, payload);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
payload
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesFiltersResponse) {
|
if (issuesFiltersResponse) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
@ -1302,22 +1199,14 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getProjectIssueModuleFilters = async (
|
getProjectIssueModuleFilters = async (workspaceId: string, projectId: string, moduleId: string) => {
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
moduleId: string
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
await this.getProjectIssueFilters(workspaceId, projectId);
|
await this.getProjectIssueFilters(workspaceId, projectId);
|
||||||
|
|
||||||
const issuesFiltersModuleResponse = await this.moduleService.getModuleDetails(
|
const issuesFiltersModuleResponse = await this.moduleService.getModuleDetails(workspaceId, projectId, moduleId);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
moduleId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesFiltersModuleResponse) {
|
if (issuesFiltersModuleResponse) {
|
||||||
const _filters = { ...issuesFiltersModuleResponse?.view_props?.filters };
|
const _filters = { ...issuesFiltersModuleResponse?.view_props?.filters };
|
||||||
@ -1330,11 +1219,9 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
[projectId]: {
|
[projectId]: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId],
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId],
|
||||||
modules: {
|
modules: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.modules,
|
||||||
?.modules,
|
|
||||||
[moduleId]: {
|
[moduleId]: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.modules?.[moduleId],
|
||||||
?.modules?.[moduleId],
|
|
||||||
filters: {
|
filters: {
|
||||||
priority: _filters?.priority ?? undefined,
|
priority: _filters?.priority ?? undefined,
|
||||||
state: _filters?.state ?? undefined,
|
state: _filters?.state ?? undefined,
|
||||||
@ -1365,12 +1252,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
updateProjectIssueModuleFilters = async (
|
updateProjectIssueModuleFilters = async (workspaceId: string, projectId: string, moduleId: string, data: any) => {
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
moduleId: string,
|
|
||||||
data: any
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
@ -1401,22 +1283,14 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getProjectIssueCyclesFilters = async (
|
getProjectIssueCyclesFilters = async (workspaceId: string, projectId: string, cycleId: string) => {
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
cycleId: string
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
await this.getProjectIssueFilters(workspaceId, projectId);
|
await this.getProjectIssueFilters(workspaceId, projectId);
|
||||||
|
|
||||||
const issuesFiltersCycleResponse = await this.cycleService.getCycleDetails(
|
const issuesFiltersCycleResponse = await this.cycleService.getCycleDetails(workspaceId, projectId, cycleId);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
cycleId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesFiltersCycleResponse) {
|
if (issuesFiltersCycleResponse) {
|
||||||
const _filters = { ...issuesFiltersCycleResponse?.view_props?.filters };
|
const _filters = { ...issuesFiltersCycleResponse?.view_props?.filters };
|
||||||
@ -1431,8 +1305,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
cycles: {
|
cycles: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.cycles,
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.cycles,
|
||||||
[cycleId]: {
|
[cycleId]: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.modules?.[cycleId],
|
||||||
?.modules?.[cycleId],
|
|
||||||
filters: {
|
filters: {
|
||||||
priority: _filters?.priority ?? undefined,
|
priority: _filters?.priority ?? undefined,
|
||||||
state: _filters?.state ?? undefined,
|
state: _filters?.state ?? undefined,
|
||||||
@ -1463,12 +1336,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
updateProjectIssueCyclesFilters = async (
|
updateProjectIssueCyclesFilters = async (workspaceId: string, projectId: string, cycleId: string, data: any) => {
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
cycleId: string,
|
|
||||||
data: any
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
@ -1506,11 +1374,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
|
|
||||||
await this.getProjectIssueFilters(workspaceId, projectId);
|
await this.getProjectIssueFilters(workspaceId, projectId);
|
||||||
|
|
||||||
const issuesFiltersViewResponse = await this.viewService.getViewDetails(
|
const issuesFiltersViewResponse = await this.viewService.getViewDetails(workspaceId, projectId, viewId);
|
||||||
workspaceId,
|
|
||||||
projectId,
|
|
||||||
viewId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (issuesFiltersViewResponse) {
|
if (issuesFiltersViewResponse) {
|
||||||
const _filters = { ...issuesFiltersViewResponse?.query_data } as any;
|
const _filters = { ...issuesFiltersViewResponse?.query_data } as any;
|
||||||
@ -1525,8 +1389,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
views: {
|
views: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.cycles,
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.cycles,
|
||||||
[viewId]: {
|
[viewId]: {
|
||||||
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]
|
...this?.issueFilters[workspaceId]?.project_issue_properties?.[projectId]?.modules?.[viewId],
|
||||||
?.modules?.[viewId],
|
|
||||||
filters: {
|
filters: {
|
||||||
priority: _filters?.priority ?? undefined,
|
priority: _filters?.priority ?? undefined,
|
||||||
state: _filters?.state ?? undefined,
|
state: _filters?.state ?? undefined,
|
||||||
@ -1557,12 +1420,7 @@ class IssueFilterStore implements IIssueFilterStore {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
updateProjectIssueViewsFilters = async (
|
updateProjectIssueViewsFilters = async (workspaceId: string, projectId: string, viewId: string, data: any) => {
|
||||||
workspaceId: string,
|
|
||||||
projectId: string,
|
|
||||||
viewId: string,
|
|
||||||
data: any
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
this.loader = true;
|
this.loader = true;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
185
web/store/issue-views/kanban-view.ts
Normal file
185
web/store/issue-views/kanban-view.ts
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
import { action, computed, makeObservable } from "mobx";
|
||||||
|
// types
|
||||||
|
import { RootStore } from "../root";
|
||||||
|
|
||||||
|
export interface IIssueKanBanViewStore {
|
||||||
|
handleDragDrop: (source: any, destination: any) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
class IssueKanBanViewStore implements IIssueKanBanViewStore {
|
||||||
|
// root store
|
||||||
|
rootStore;
|
||||||
|
|
||||||
|
constructor(_rootStore: RootStore) {
|
||||||
|
makeObservable(this, {
|
||||||
|
// computed
|
||||||
|
canUserDragDrop: computed,
|
||||||
|
canUserDragDropVertically: computed,
|
||||||
|
canUserDragDropHorizontally: computed,
|
||||||
|
|
||||||
|
// actions
|
||||||
|
handleDragDrop: action,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.rootStore = _rootStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
get canUserDragDrop() {
|
||||||
|
if (
|
||||||
|
this.rootStore?.issueFilters?.issueView &&
|
||||||
|
this.rootStore?.issueFilters?.userFilters?.display_filters?.group_by &&
|
||||||
|
this.rootStore?.issueFilters?.userFilters?.display_filters?.order_by &&
|
||||||
|
!["my_issues"].includes(this.rootStore?.issueFilters?.issueView) &&
|
||||||
|
["state", "priority"].includes(this.rootStore?.issueFilters?.userFilters?.display_filters?.group_by) &&
|
||||||
|
this.rootStore?.issueFilters?.userFilters?.display_filters?.order_by === "sort_order"
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
get canUserDragDropVertically() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
get canUserDragDropHorizontally() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDragDrop = async (source: any, destination: any) => {
|
||||||
|
const workspaceId = this.rootStore?.issueFilters?.workspaceId;
|
||||||
|
const projectId = this.rootStore?.issueFilters?.projectId;
|
||||||
|
const issueView = this.rootStore?.issueFilters?.issueView;
|
||||||
|
const issueLayout = this.rootStore?.issueFilters?.userFilters?.display_filters?.layout;
|
||||||
|
|
||||||
|
const sortOrderDefaultValue = 10000;
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.rootStore?.issueView?.getIssues &&
|
||||||
|
workspaceId &&
|
||||||
|
projectId &&
|
||||||
|
issueView &&
|
||||||
|
issueLayout &&
|
||||||
|
issueView != "my_issues"
|
||||||
|
) {
|
||||||
|
const projectSortedIssues: any =
|
||||||
|
this.rootStore?.issueView.issues?.[workspaceId]?.project_issues?.[projectId]?.[issueView]?.[issueLayout];
|
||||||
|
|
||||||
|
let updateIssue: any = {
|
||||||
|
workspaceId: workspaceId,
|
||||||
|
projectId: projectId,
|
||||||
|
};
|
||||||
|
|
||||||
|
// user can drag the issues from any direction
|
||||||
|
if (this.canUserDragDrop) {
|
||||||
|
// vertical
|
||||||
|
if (source.droppableId === destination.droppableId) {
|
||||||
|
const _columnId = source.droppableId;
|
||||||
|
const _issues = projectSortedIssues[_columnId];
|
||||||
|
|
||||||
|
// update the sort order
|
||||||
|
if (destination.index === 0) {
|
||||||
|
updateIssue = { ...updateIssue, sort_order: _issues[destination.index].sort_order - sortOrderDefaultValue };
|
||||||
|
} else if (destination.index === _issues.length - 1) {
|
||||||
|
updateIssue = { ...updateIssue, sort_order: _issues[destination.index].sort_order + sortOrderDefaultValue };
|
||||||
|
} else {
|
||||||
|
updateIssue = {
|
||||||
|
...updateIssue,
|
||||||
|
sort_order: (_issues[destination.index - 1].sort_order + _issues[destination.index].sort_order) / 2,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the mobx state array
|
||||||
|
const [removed] = _issues.splice(source.index, 1);
|
||||||
|
_issues.splice(destination.index, 0, { ...removed, sort_order: updateIssue.sort_order });
|
||||||
|
updateIssue = { ...updateIssue, issueId: removed?.id };
|
||||||
|
|
||||||
|
projectSortedIssues[_columnId] = _issues;
|
||||||
|
}
|
||||||
|
|
||||||
|
// horizontal
|
||||||
|
if (source.droppableId != destination.droppableId) {
|
||||||
|
const _sourceColumnId = source.droppableId;
|
||||||
|
const _destinationColumnId = destination.droppableId;
|
||||||
|
|
||||||
|
const _sourceIssues = projectSortedIssues[_sourceColumnId];
|
||||||
|
const _destinationIssues = projectSortedIssues[_destinationColumnId];
|
||||||
|
|
||||||
|
if (_destinationIssues.length > 0) {
|
||||||
|
if (destination.index === 0) {
|
||||||
|
updateIssue = {
|
||||||
|
...updateIssue,
|
||||||
|
sort_order: _destinationIssues[destination.index].sort_order - sortOrderDefaultValue,
|
||||||
|
state: destination?.droppableId,
|
||||||
|
};
|
||||||
|
} else if (destination.index === _destinationIssues.length - 1) {
|
||||||
|
updateIssue = {
|
||||||
|
...updateIssue,
|
||||||
|
sort_order: _destinationIssues[destination.index].sort_order + sortOrderDefaultValue,
|
||||||
|
state: destination?.droppableId,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
updateIssue = {
|
||||||
|
...updateIssue,
|
||||||
|
sort_order:
|
||||||
|
(_destinationIssues[destination.index - 1].sort_order +
|
||||||
|
_destinationIssues[destination.index].sort_order) /
|
||||||
|
2,
|
||||||
|
state: destination?.droppableId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateIssue = {
|
||||||
|
...updateIssue,
|
||||||
|
sort_order: sortOrderDefaultValue,
|
||||||
|
state: destination?.droppableId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const [removed] = _sourceIssues.splice(source.index, 1);
|
||||||
|
_destinationIssues.splice(destination.index, 0, {
|
||||||
|
...removed,
|
||||||
|
state: destination?.droppableId,
|
||||||
|
sort_order: updateIssue.sort_order,
|
||||||
|
});
|
||||||
|
updateIssue = { ...updateIssue, issueId: removed?.id };
|
||||||
|
|
||||||
|
projectSortedIssues[_sourceColumnId] = _sourceIssues;
|
||||||
|
projectSortedIssues[_destinationColumnId] = _destinationIssues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// user can drag the issues only vertically
|
||||||
|
if (this.canUserDragDropVertically && source.droppableId === destination.droppableId) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// user can drag the issues only horizontally
|
||||||
|
if (this.canUserDragDropHorizontally && source.droppableId != destination.droppableId) {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rootStore.issueView.issues = {
|
||||||
|
...this.rootStore?.issueView.issues,
|
||||||
|
[workspaceId]: {
|
||||||
|
...this.rootStore?.issueView.issues?.[workspaceId],
|
||||||
|
project_issues: {
|
||||||
|
...this.rootStore?.issueView.issues?.[workspaceId]?.project_issues,
|
||||||
|
[projectId]: {
|
||||||
|
...this.rootStore?.issueView.issues?.[workspaceId]?.project_issues?.[projectId],
|
||||||
|
[issueView]: {
|
||||||
|
...this.rootStore?.issueView.issues?.[workspaceId]?.project_issues?.[projectId]?.[issueView],
|
||||||
|
[issueLayout]: projectSortedIssues,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
this.rootStore.issueDetail?.updateIssueAsync(
|
||||||
|
updateIssue.workspaceId,
|
||||||
|
updateIssue.projectId,
|
||||||
|
updateIssue.issueId,
|
||||||
|
updateIssue
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IssueKanBanViewStore;
|
@ -9,6 +9,8 @@ import IssuesStore from "./issues";
|
|||||||
// issues views and filters
|
// issues views and filters
|
||||||
import IssueFilterStore from "./issue-views/issue_filters";
|
import IssueFilterStore from "./issue-views/issue_filters";
|
||||||
import IssueViewStore from "./issue-views/Issues";
|
import IssueViewStore from "./issue-views/Issues";
|
||||||
|
import IssueViewDetailStore from "./issue-views/issue_detail";
|
||||||
|
import IssueKanBanViewStore from "./issue-views/kanban-view";
|
||||||
|
|
||||||
enableStaticRendering(typeof window === "undefined");
|
enableStaticRendering(typeof window === "undefined");
|
||||||
|
|
||||||
@ -20,6 +22,8 @@ export class RootStore {
|
|||||||
issues: IssuesStore;
|
issues: IssuesStore;
|
||||||
issueFilters: IssueFilterStore;
|
issueFilters: IssueFilterStore;
|
||||||
issueView: IssueViewStore;
|
issueView: IssueViewStore;
|
||||||
|
issueDetail: IssueViewDetailStore;
|
||||||
|
issueKanBanView: IssueKanBanViewStore;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.user = new UserStore(this);
|
this.user = new UserStore(this);
|
||||||
@ -29,5 +33,7 @@ export class RootStore {
|
|||||||
this.issues = new IssuesStore(this);
|
this.issues = new IssuesStore(this);
|
||||||
this.issueFilters = new IssueFilterStore(this);
|
this.issueFilters = new IssueFilterStore(this);
|
||||||
this.issueView = new IssueViewStore(this);
|
this.issueView = new IssueViewStore(this);
|
||||||
|
this.issueDetail = new IssueViewDetailStore(this);
|
||||||
|
this.issueKanBanView = new IssueKanBanViewStore(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user