2023-01-30 14:05:18 +00:00
|
|
|
import { createContext, useCallback, useEffect, useReducer } from "react";
|
2023-01-26 18:12:20 +00:00
|
|
|
import { useRouter } from "next/router";
|
2023-03-15 06:14:44 +00:00
|
|
|
import useSWR, { mutate } from "swr";
|
2023-01-26 18:12:20 +00:00
|
|
|
// components
|
|
|
|
import ToastAlert from "components/toast-alert";
|
|
|
|
// services
|
2023-12-04 06:41:36 +00:00
|
|
|
import { ProjectService, ProjectMemberService } from "services/project";
|
|
|
|
import { CycleService } from "services/cycle.service";
|
|
|
|
import { ModuleService } from "services/module.service";
|
|
|
|
import { ViewService } from "services/view.service";
|
2023-01-26 18:12:20 +00:00
|
|
|
// types
|
2023-12-04 06:41:36 +00:00
|
|
|
import { IIssueFilterOptions, IProjectMember, IIssueDisplayFilterOptions, IProjectViewProps } from "types";
|
2023-01-26 18:12:20 +00:00
|
|
|
// fetch-keys
|
2023-12-04 06:41:36 +00:00
|
|
|
import { CYCLE_DETAILS, MODULE_DETAILS, USER_PROJECT_VIEW, VIEW_DETAILS } from "constants/fetch-keys";
|
|
|
|
|
|
|
|
const projectService = new ProjectService();
|
|
|
|
const projectMemberService = new ProjectMemberService();
|
|
|
|
const cycleService = new CycleService();
|
|
|
|
const moduleService = new ModuleService();
|
|
|
|
const viewService = new ViewService();
|
2023-01-26 18:12:20 +00:00
|
|
|
|
|
|
|
export const issueViewContext = createContext<ContextType>({} as ContextType);
|
|
|
|
|
|
|
|
type ReducerActionType = {
|
2023-09-12 16:57:15 +00:00
|
|
|
type: "REHYDRATE_THEME" | "SET_DISPLAY_FILTERS" | "SET_FILTERS" | "RESET_TO_DEFAULT";
|
|
|
|
payload?: Partial<IProjectViewProps>;
|
2023-01-26 18:12:20 +00:00
|
|
|
};
|
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
type ContextType = IProjectViewProps & {
|
|
|
|
setDisplayFilters: (displayFilter: Partial<IIssueDisplayFilterOptions>) => void;
|
2023-03-22 12:48:19 +00:00
|
|
|
setFilters: (filters: Partial<IIssueFilterOptions>, saveToServer?: boolean) => void;
|
2023-01-26 18:12:20 +00:00
|
|
|
resetFilterToDefault: () => void;
|
|
|
|
setNewFilterDefaultView: () => void;
|
|
|
|
};
|
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
type StateType = IProjectViewProps;
|
2023-01-26 18:12:20 +00:00
|
|
|
type ReducerFunctionType = (state: StateType, action: ReducerActionType) => StateType;
|
|
|
|
|
|
|
|
export const initialState: StateType = {
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
group_by: null,
|
|
|
|
layout: "list",
|
|
|
|
order_by: "-created_at",
|
|
|
|
show_empty_groups: true,
|
|
|
|
sub_issue: true,
|
|
|
|
},
|
2023-03-15 06:14:44 +00:00
|
|
|
filters: {
|
2023-03-16 08:37:19 +00:00
|
|
|
priority: null,
|
2023-03-15 06:14:44 +00:00
|
|
|
assignees: null,
|
|
|
|
labels: null,
|
2023-03-16 08:37:19 +00:00
|
|
|
state: null,
|
2023-07-26 19:27:12 +00:00
|
|
|
state_group: null,
|
2023-12-04 06:41:36 +00:00
|
|
|
mentions: null,
|
2023-08-08 07:45:25 +00:00
|
|
|
subscriber: null,
|
2023-03-24 18:01:56 +00:00
|
|
|
created_by: null,
|
2023-08-24 14:15:23 +00:00
|
|
|
start_date: null,
|
2023-07-04 17:43:07 +00:00
|
|
|
target_date: null,
|
2023-03-15 06:14:44 +00:00
|
|
|
},
|
2023-01-26 18:12:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const reducer: ReducerFunctionType = (state, action) => {
|
|
|
|
const { type, payload } = action;
|
|
|
|
|
|
|
|
switch (type) {
|
2023-01-30 14:05:18 +00:00
|
|
|
case "REHYDRATE_THEME": {
|
|
|
|
let collapsed: any = localStorage.getItem("collapsed");
|
|
|
|
collapsed = collapsed ? JSON.parse(collapsed) : false;
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-01-30 14:05:18 +00:00
|
|
|
return { ...initialState, ...payload, collapsed };
|
|
|
|
}
|
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
case "SET_DISPLAY_FILTERS": {
|
2023-05-15 06:05:07 +00:00
|
|
|
const newState = {
|
|
|
|
...state,
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
...state.display_filters,
|
|
|
|
...payload,
|
|
|
|
},
|
|
|
|
issueView: payload?.display_filters?.layout || "list",
|
2023-05-15 06:05:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
...newState,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-03-15 06:14:44 +00:00
|
|
|
case "SET_FILTERS": {
|
2023-01-26 18:12:20 +00:00
|
|
|
const newState = {
|
|
|
|
...state,
|
2023-03-15 06:14:44 +00:00
|
|
|
filters: {
|
|
|
|
...state.filters,
|
2023-06-21 12:02:56 +00:00
|
|
|
...payload?.filters,
|
2023-03-15 06:14:44 +00:00
|
|
|
},
|
2023-01-26 18:12:20 +00:00
|
|
|
};
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-01-26 18:12:20 +00:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
...newState,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
case "RESET_TO_DEFAULT": {
|
|
|
|
return {
|
|
|
|
...initialState,
|
|
|
|
...payload,
|
|
|
|
};
|
|
|
|
}
|
2023-02-14 14:35:32 +00:00
|
|
|
|
2023-01-26 18:12:20 +00:00
|
|
|
default: {
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
const saveDataToServer = async (workspaceSlug: string, projectId: string, state: IProjectViewProps) => {
|
2023-05-29 13:05:43 +00:00
|
|
|
mutate<IProjectMember>(
|
2023-09-12 16:57:15 +00:00
|
|
|
workspaceSlug && projectId ? USER_PROJECT_VIEW(projectId as string) : null,
|
2023-05-29 13:05:43 +00:00
|
|
|
(prevData) => {
|
|
|
|
if (!prevData) return prevData;
|
|
|
|
|
|
|
|
return {
|
|
|
|
...prevData,
|
|
|
|
view_props: state,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
await projectService.setProjectView(workspaceSlug, projectId, {
|
2023-01-26 18:12:20 +00:00
|
|
|
view_props: state,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
const saveCycleFilters = async (workspaceSlug: string, projectId: string, cycleId: string, state: any) => {
|
|
|
|
await cycleService.patchCycle(workspaceSlug, projectId, cycleId, {
|
|
|
|
...state,
|
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
};
|
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
const saveModuleFilters = async (workspaceSlug: string, projectId: string, moduleId: string, state: any) => {
|
|
|
|
await moduleService.patchModule(workspaceSlug, projectId, moduleId, {
|
|
|
|
...state,
|
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
};
|
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
const saveViewFilters = async (workspaceSlug: string, projectId: string, viewId: string, state: any) => {
|
|
|
|
await viewService.patchView(workspaceSlug, projectId, viewId, {
|
|
|
|
...state,
|
|
|
|
});
|
2023-03-16 08:37:19 +00:00
|
|
|
};
|
|
|
|
|
2023-03-15 06:14:44 +00:00
|
|
|
const setNewDefault = async (workspaceSlug: string, projectId: string, state: any) => {
|
|
|
|
mutate<IProjectMember>(
|
|
|
|
workspaceSlug && projectId ? USER_PROJECT_VIEW(projectId as string) : null,
|
|
|
|
(prevData) => {
|
|
|
|
if (!prevData) return prevData;
|
|
|
|
|
|
|
|
return {
|
|
|
|
...prevData,
|
|
|
|
view_props: state,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
|
|
|
|
|
|
|
await projectService.setProjectView(workspaceSlug, projectId, {
|
2023-01-26 18:12:20 +00:00
|
|
|
view_props: state,
|
|
|
|
default_props: state,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
|
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
|
|
|
|
|
|
const router = useRouter();
|
2023-04-19 11:55:31 +00:00
|
|
|
const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query;
|
2023-01-26 18:12:20 +00:00
|
|
|
|
|
|
|
const { data: myViewProps, mutate: mutateMyViewProps } = useSWR(
|
|
|
|
workspaceSlug && projectId ? USER_PROJECT_VIEW(projectId as string) : null,
|
|
|
|
workspaceSlug && projectId
|
2023-12-04 06:41:36 +00:00
|
|
|
? () => projectMemberService.projectMemberMe(workspaceSlug as string, projectId as string)
|
2023-01-26 18:12:20 +00:00
|
|
|
: null
|
|
|
|
);
|
|
|
|
|
2023-03-16 08:37:19 +00:00
|
|
|
const { data: viewDetails, mutate: mutateViewDetails } = useSWR(
|
|
|
|
workspaceSlug && projectId && viewId ? VIEW_DETAILS(viewId as string) : null,
|
|
|
|
workspaceSlug && projectId && viewId
|
2023-12-04 06:41:36 +00:00
|
|
|
? () => viewService.getViewDetails(workspaceSlug as string, projectId as string, viewId as string)
|
2023-03-16 08:37:19 +00:00
|
|
|
: null
|
|
|
|
);
|
|
|
|
|
2023-04-19 11:55:31 +00:00
|
|
|
const { data: cycleDetails, mutate: mutateCycleDetails } = useSWR(
|
|
|
|
workspaceSlug && projectId && cycleId ? CYCLE_DETAILS(cycleId as string) : null,
|
|
|
|
workspaceSlug && projectId && cycleId
|
2023-12-04 06:41:36 +00:00
|
|
|
? () => cycleService.getCycleDetails(workspaceSlug.toString(), projectId.toString(), cycleId.toString())
|
2023-04-19 11:55:31 +00:00
|
|
|
: null
|
|
|
|
);
|
|
|
|
|
|
|
|
const { data: moduleDetails, mutate: mutateModuleDetails } = useSWR(
|
|
|
|
workspaceSlug && projectId && moduleId ? MODULE_DETAILS(moduleId.toString()) : null,
|
|
|
|
workspaceSlug && projectId && moduleId
|
2023-12-04 06:41:36 +00:00
|
|
|
? () => moduleService.getModuleDetails(workspaceSlug.toString(), projectId.toString(), moduleId.toString())
|
2023-04-19 11:55:31 +00:00
|
|
|
: null
|
|
|
|
);
|
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
const setDisplayFilters = useCallback(
|
|
|
|
(displayFilter: Partial<IIssueDisplayFilterOptions>) => {
|
2023-03-29 20:31:53 +00:00
|
|
|
dispatch({
|
2023-09-12 16:57:15 +00:00
|
|
|
type: "SET_DISPLAY_FILTERS",
|
2023-03-29 20:31:53 +00:00
|
|
|
payload: {
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
...state.display_filters,
|
|
|
|
...displayFilter,
|
|
|
|
},
|
2023-03-29 20:31:53 +00:00
|
|
|
},
|
|
|
|
});
|
2023-01-26 18:12:20 +00:00
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
const additionalProperties: Partial<IIssueDisplayFilterOptions> = {
|
|
|
|
group_by: displayFilter.group_by ?? state.display_filters?.group_by,
|
|
|
|
order_by: displayFilter.order_by ?? state.display_filters?.order_by,
|
2023-08-18 09:42:12 +00:00
|
|
|
};
|
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
if (displayFilter.layout && displayFilter.layout === "kanban" && state.display_filters?.group_by === null) {
|
2023-09-12 16:57:15 +00:00
|
|
|
additionalProperties.group_by = "state";
|
2023-03-29 20:31:53 +00:00
|
|
|
dispatch({
|
2023-09-12 16:57:15 +00:00
|
|
|
type: "SET_DISPLAY_FILTERS",
|
2023-03-29 20:31:53 +00:00
|
|
|
payload: {
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
group_by: "state",
|
|
|
|
},
|
2023-03-29 20:31:53 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2023-09-12 16:57:15 +00:00
|
|
|
if (displayFilter.layout && displayFilter.layout === "calendar") {
|
|
|
|
additionalProperties.group_by = null;
|
2023-04-20 20:12:09 +00:00
|
|
|
dispatch({
|
2023-09-12 16:57:15 +00:00
|
|
|
type: "SET_DISPLAY_FILTERS",
|
2023-04-20 20:12:09 +00:00
|
|
|
payload: {
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
group_by: null,
|
|
|
|
},
|
2023-04-20 20:12:09 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2023-09-12 16:57:15 +00:00
|
|
|
if (displayFilter.layout && displayFilter.layout === "gantt_chart") {
|
|
|
|
additionalProperties.order_by = "sort_order";
|
2023-08-18 09:42:12 +00:00
|
|
|
dispatch({
|
2023-09-12 16:57:15 +00:00
|
|
|
type: "SET_DISPLAY_FILTERS",
|
2023-08-18 09:42:12 +00:00
|
|
|
payload: {
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
order_by: "sort_order",
|
|
|
|
},
|
2023-08-18 09:42:12 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-03-29 20:31:53 +00:00
|
|
|
if (!workspaceSlug || !projectId) return;
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-03-29 20:31:53 +00:00
|
|
|
saveDataToServer(workspaceSlug as string, projectId as string, {
|
|
|
|
...state,
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: {
|
|
|
|
...state.display_filters,
|
|
|
|
...displayFilter,
|
|
|
|
...additionalProperties,
|
2023-07-25 07:39:38 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
2023-09-12 16:57:15 +00:00
|
|
|
[workspaceSlug, projectId, state]
|
2023-05-15 06:05:07 +00:00
|
|
|
);
|
|
|
|
|
2023-03-15 06:14:44 +00:00
|
|
|
const setFilters = useCallback(
|
2023-03-22 12:48:19 +00:00
|
|
|
(property: Partial<IIssueFilterOptions>, saveToServer = true) => {
|
2023-03-21 11:41:04 +00:00
|
|
|
Object.keys(property).forEach((key) => {
|
2023-12-04 06:41:36 +00:00
|
|
|
if (property[key as keyof typeof property]?.length === 0) property[key as keyof typeof property] = null;
|
2023-03-21 11:41:04 +00:00
|
|
|
});
|
|
|
|
|
2023-01-26 18:12:20 +00:00
|
|
|
dispatch({
|
2023-03-15 06:14:44 +00:00
|
|
|
type: "SET_FILTERS",
|
2023-01-26 18:12:20 +00:00
|
|
|
payload: {
|
2023-03-15 06:14:44 +00:00
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
|
|
|
},
|
2023-01-26 18:12:20 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!workspaceSlug || !projectId) return;
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-04-19 11:55:31 +00:00
|
|
|
if (cycleId) {
|
|
|
|
mutateCycleDetails((prevData: any) => {
|
|
|
|
if (!prevData) return prevData;
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-04-19 11:55:31 +00:00
|
|
|
return {
|
|
|
|
...prevData,
|
|
|
|
view_props: {
|
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}, false);
|
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
saveCycleFilters(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), {
|
|
|
|
view_props: {
|
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
2023-03-15 06:14:44 +00:00
|
|
|
},
|
|
|
|
},
|
2023-12-04 06:41:36 +00:00
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
} else if (moduleId) {
|
|
|
|
mutateModuleDetails((prevData: any) => {
|
|
|
|
if (!prevData) return prevData;
|
|
|
|
|
|
|
|
return {
|
|
|
|
...prevData,
|
|
|
|
view_props: {
|
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}, false);
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-12-04 06:41:36 +00:00
|
|
|
saveModuleFilters(workspaceSlug.toString(), projectId.toString(), moduleId.toString(), {
|
|
|
|
view_props: {
|
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
2023-04-19 11:55:31 +00:00
|
|
|
},
|
|
|
|
},
|
2023-12-04 06:41:36 +00:00
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
} else if (viewId) {
|
2023-03-16 08:37:19 +00:00
|
|
|
mutateViewDetails((prevData: any) => {
|
|
|
|
if (!prevData) return prevData;
|
|
|
|
return {
|
|
|
|
...prevData,
|
|
|
|
query_data: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}, false);
|
2023-03-22 12:48:19 +00:00
|
|
|
if (saveToServer)
|
2023-12-04 06:41:36 +00:00
|
|
|
saveViewFilters(workspaceSlug as string, projectId as string, viewId as string, {
|
|
|
|
query_data: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
2023-03-22 12:48:19 +00:00
|
|
|
},
|
2023-12-04 06:41:36 +00:00
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
} else {
|
2023-08-15 09:34:46 +00:00
|
|
|
mutateMyViewProps((prevData: any) => {
|
2023-04-19 11:55:31 +00:00
|
|
|
if (!prevData) return prevData;
|
|
|
|
|
|
|
|
return {
|
|
|
|
...prevData,
|
|
|
|
view_props: {
|
|
|
|
...state,
|
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}, false);
|
|
|
|
|
2023-03-16 08:37:19 +00:00
|
|
|
saveDataToServer(workspaceSlug as string, projectId as string, {
|
|
|
|
...state,
|
|
|
|
filters: {
|
|
|
|
...state.filters,
|
|
|
|
...property,
|
|
|
|
},
|
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
}
|
2023-01-26 18:12:20 +00:00
|
|
|
},
|
2023-04-19 11:55:31 +00:00
|
|
|
[
|
|
|
|
projectId,
|
|
|
|
workspaceSlug,
|
|
|
|
state,
|
|
|
|
mutateMyViewProps,
|
|
|
|
cycleId,
|
|
|
|
mutateCycleDetails,
|
|
|
|
moduleId,
|
|
|
|
mutateModuleDetails,
|
|
|
|
viewId,
|
|
|
|
mutateViewDetails,
|
|
|
|
]
|
2023-01-26 18:12:20 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
const setNewDefaultView = useCallback(() => {
|
|
|
|
if (!workspaceSlug || !projectId) return;
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-01-26 18:12:20 +00:00
|
|
|
setNewDefault(workspaceSlug as string, projectId as string, state).then(() => {
|
|
|
|
mutateMyViewProps();
|
|
|
|
});
|
|
|
|
}, [projectId, workspaceSlug, state, mutateMyViewProps]);
|
|
|
|
|
|
|
|
const resetToDefault = useCallback(() => {
|
|
|
|
dispatch({
|
|
|
|
type: "RESET_TO_DEFAULT",
|
|
|
|
payload: myViewProps?.default_props,
|
|
|
|
});
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
if (!workspaceSlug || !projectId || !myViewProps) return;
|
2023-03-15 06:14:44 +00:00
|
|
|
|
2023-09-12 16:57:15 +00:00
|
|
|
saveDataToServer(workspaceSlug as string, projectId as string, myViewProps.default_props);
|
2023-01-26 18:12:20 +00:00
|
|
|
}, [projectId, workspaceSlug, myViewProps]);
|
|
|
|
|
2023-01-30 14:05:18 +00:00
|
|
|
useEffect(() => {
|
|
|
|
dispatch({
|
|
|
|
type: "REHYDRATE_THEME",
|
2023-03-16 08:37:19 +00:00
|
|
|
payload: {
|
|
|
|
...myViewProps?.view_props,
|
|
|
|
filters: {
|
2023-04-19 11:55:31 +00:00
|
|
|
...(cycleId
|
|
|
|
? cycleDetails?.view_props.filters
|
|
|
|
: moduleId
|
|
|
|
? moduleDetails?.view_props.filters
|
|
|
|
: viewId
|
|
|
|
? viewDetails?.query_data
|
|
|
|
: myViewProps?.view_props?.filters),
|
2023-03-16 08:37:19 +00:00
|
|
|
} as any,
|
|
|
|
},
|
2023-01-30 14:05:18 +00:00
|
|
|
});
|
2023-04-19 11:55:31 +00:00
|
|
|
}, [myViewProps, cycleId, cycleDetails, moduleId, moduleDetails, viewId, viewDetails]);
|
2023-01-30 14:05:18 +00:00
|
|
|
|
2023-01-26 18:12:20 +00:00
|
|
|
return (
|
|
|
|
<issueViewContext.Provider
|
|
|
|
value={{
|
2023-09-12 16:57:15 +00:00
|
|
|
display_filters: state.display_filters,
|
|
|
|
setDisplayFilters,
|
2023-03-15 06:14:44 +00:00
|
|
|
filters: state.filters,
|
|
|
|
setFilters,
|
2023-01-26 18:12:20 +00:00
|
|
|
resetFilterToDefault: resetToDefault,
|
|
|
|
setNewFilterDefaultView: setNewDefaultView,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ToastAlert />
|
|
|
|
{children}
|
|
|
|
</issueViewContext.Provider>
|
|
|
|
);
|
|
|
|
};
|