forked from github/plane
1e152c666c
* chore: moved app & space from apps to root * chore: modified workspace configuration * chore: modified dockerfiles for space and web * chore: modified icons for space * feat: updated files for new svg icons supported by next-images * chore: added /spaces base path for next * chore: added compose config for space * chore: updated husky configuration * chore: updated workflows for new configuration * chore: changed app name to web * fix: resolved build errors with web * chore: reset file tracing root for both projects * chore: added nginx config for deploy * fix: eslint and tsconfig settings for space app * husky setup fixes based on new dir * eslint fixes * prettier formatting --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import useSWR from "swr";
|
|
|
|
// services
|
|
import modulesService from "services/modules.service";
|
|
// hooks
|
|
import useIssuesView from "hooks/use-issues-view";
|
|
// fetch-keys
|
|
import { MODULE_ISSUES_WITH_PARAMS } from "constants/fetch-keys";
|
|
|
|
const useGanttChartModuleIssues = (
|
|
workspaceSlug: string | undefined,
|
|
projectId: string | undefined,
|
|
moduleId: string | undefined
|
|
) => {
|
|
const { orderBy, filters, showSubIssues } = useIssuesView();
|
|
|
|
const params: any = {
|
|
order_by: orderBy,
|
|
type: filters?.type ? filters?.type : undefined,
|
|
sub_issue: showSubIssues,
|
|
assignees: filters?.assignees ? filters?.assignees.join(",") : undefined,
|
|
state: filters?.state ? filters?.state.join(",") : undefined,
|
|
priority: filters?.priority ? filters?.priority.join(",") : undefined,
|
|
labels: filters?.labels ? filters?.labels.join(",") : undefined,
|
|
created_by: filters?.created_by ? filters?.created_by.join(",") : undefined,
|
|
start_date: filters?.start_date ? filters?.start_date.join(",") : undefined,
|
|
target_date: filters?.target_date ? filters?.target_date.join(",") : undefined,
|
|
start_target_date: true, // to fetch only issues with a start and target date
|
|
};
|
|
|
|
// all issues under the workspace and project
|
|
const { data: ganttIssues, mutate: mutateGanttIssues } = useSWR(
|
|
workspaceSlug && projectId && moduleId
|
|
? MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), params)
|
|
: null,
|
|
workspaceSlug && projectId && moduleId
|
|
? () =>
|
|
modulesService.getModuleIssuesWithParams(
|
|
workspaceSlug.toString(),
|
|
projectId.toString(),
|
|
moduleId.toString(),
|
|
params
|
|
)
|
|
: null
|
|
);
|
|
|
|
return {
|
|
ganttIssues,
|
|
mutateGanttIssues,
|
|
};
|
|
};
|
|
|
|
export default useGanttChartModuleIssues;
|