[WEB-1686] fix: issues incorrect filters while switching between, projects, modules etc (#4904)
* fix issues incorrect filters while switching between, projects, modules etc * fix minor kanban pagination loader
This commit is contained in:
parent
dcdd1ef065
commit
adec4e1f2d
24 changed files with 224 additions and 82 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
// hooks
|
// hooks
|
||||||
import { ProjectIssueQuickActions } from "@/components/issues";
|
import { ProjectIssueQuickActions } from "@/components/issues";
|
||||||
// components
|
// components
|
||||||
|
|
@ -6,6 +7,8 @@ import { ProjectIssueQuickActions } from "@/components/issues";
|
||||||
import { BaseCalendarRoot } from "../base-calendar-root";
|
import { BaseCalendarRoot } from "../base-calendar-root";
|
||||||
// constants
|
// constants
|
||||||
|
|
||||||
export const ProjectViewCalendarLayout: React.FC = observer(() => (
|
export const ProjectViewCalendarLayout: React.FC = observer(() => {
|
||||||
<BaseCalendarRoot QuickActions={ProjectIssueQuickActions} />
|
const { viewId } = useParams();
|
||||||
));
|
|
||||||
|
return <BaseCalendarRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ export const KanbanGroup = observer((props: IKanbanGroup) => {
|
||||||
loadMoreIssues(groupId, sub_group_id === "null"? undefined: sub_group_id)
|
loadMoreIssues(groupId, sub_group_id === "null"? undefined: sub_group_id)
|
||||||
}, [loadMoreIssues, groupId, sub_group_id])
|
}, [loadMoreIssues, groupId, sub_group_id])
|
||||||
|
|
||||||
const isPaginating = !!getIssueLoader(groupId);
|
const isPaginating = !!getIssueLoader(groupId, sub_group_id);
|
||||||
|
|
||||||
useIntersectionObserver(
|
useIntersectionObserver(
|
||||||
containerRef,
|
containerRef,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
// hooks
|
// hooks
|
||||||
// constant
|
// constant
|
||||||
// types
|
// types
|
||||||
|
|
@ -7,6 +8,8 @@ import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
|
||||||
// components
|
// components
|
||||||
import { BaseKanBanRoot } from "../base-kanban-root";
|
import { BaseKanBanRoot } from "../base-kanban-root";
|
||||||
|
|
||||||
export const ProjectViewKanBanLayout: React.FC = observer(() => (
|
export const ProjectViewKanBanLayout: React.FC = observer(() => {
|
||||||
<BaseKanBanRoot QuickActions={ProjectIssueQuickActions} />
|
const { viewId } = useParams();
|
||||||
));
|
|
||||||
|
return <BaseKanBanRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
// store
|
// store
|
||||||
// constants
|
// constants
|
||||||
// types
|
// types
|
||||||
|
|
@ -7,4 +8,8 @@ import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
|
||||||
// components
|
// components
|
||||||
import { BaseListRoot } from "../base-list-root";
|
import { BaseListRoot } from "../base-list-root";
|
||||||
|
|
||||||
export const ProjectViewListLayout: React.FC = observer(() => <BaseListRoot QuickActions={ProjectIssueQuickActions} />);
|
export const ProjectViewListLayout: React.FC = observer(() => {
|
||||||
|
const { viewId } = useParams();
|
||||||
|
|
||||||
|
return <BaseListRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import { useIssues } from "@/hooks/store";
|
||||||
import { IssuesStoreContext } from "@/hooks/use-issue-layout-store";
|
import { IssuesStoreContext } from "@/hooks/use-issue-layout-store";
|
||||||
// types
|
// types
|
||||||
|
|
||||||
const ProjectViewIssueLayout = (props: { activeLayout: EIssueLayoutTypes | undefined }) => {
|
const ProjectViewIssueLayout = (props: { activeLayout: EIssueLayoutTypes | undefined; viewId: string }) => {
|
||||||
switch (props.activeLayout) {
|
switch (props.activeLayout) {
|
||||||
case EIssueLayoutTypes.LIST:
|
case EIssueLayoutTypes.LIST:
|
||||||
return <ProjectViewListLayout />;
|
return <ProjectViewListLayout />;
|
||||||
|
|
@ -61,7 +61,7 @@ export const ProjectViewLayoutRoot: React.FC = observer(() => {
|
||||||
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
||||||
<ProjectViewAppliedFiltersRoot />
|
<ProjectViewAppliedFiltersRoot />
|
||||||
<div className="relative h-full w-full overflow-auto">
|
<div className="relative h-full w-full overflow-auto">
|
||||||
<ProjectViewIssueLayout activeLayout={activeLayout} />
|
<ProjectViewIssueLayout activeLayout={activeLayout} viewId={viewId.toString()} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* peek overview */}
|
{/* peek overview */}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
// mobx store
|
// mobx store
|
||||||
// components
|
// components
|
||||||
import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
|
import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
|
||||||
|
|
@ -7,6 +8,8 @@ import { BaseSpreadsheetRoot } from "../base-spreadsheet-root";
|
||||||
// types
|
// types
|
||||||
// constants
|
// constants
|
||||||
|
|
||||||
export const ProjectViewSpreadsheetLayout: React.FC = observer(() => (
|
export const ProjectViewSpreadsheetLayout: React.FC = observer(() => {
|
||||||
<BaseSpreadsheetRoot QuickActions={ProjectIssueQuickActions} />
|
const { viewId } = useParams();
|
||||||
));
|
|
||||||
|
return <BaseSpreadsheetRoot QuickActions={ProjectIssueQuickActions} viewId={viewId.toString()} />;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -459,16 +459,16 @@ const useProjectViewIssueActions = () => {
|
||||||
const { issues, issuesFilter } = useIssues(EIssuesStoreType.PROJECT_VIEW);
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.PROJECT_VIEW);
|
||||||
|
|
||||||
const fetchIssues = useCallback(
|
const fetchIssues = useCallback(
|
||||||
async (loadType: TLoader, options: IssuePaginationOptions) => {
|
async (loadType: TLoader, options: IssuePaginationOptions, viewId?: string) => {
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug || !projectId || !viewId) return;
|
||||||
return issues.fetchIssues(workspaceSlug.toString(), projectId.toString(), loadType, options);
|
return issues.fetchIssues(workspaceSlug.toString(), projectId.toString(), viewId, loadType, options);
|
||||||
},
|
},
|
||||||
[issues.fetchIssues, workspaceSlug, projectId]
|
[issues.fetchIssues, workspaceSlug, projectId]
|
||||||
);
|
);
|
||||||
const fetchNextIssues = useCallback(
|
const fetchNextIssues = useCallback(
|
||||||
async (groupId?: string, subGroupId?: string) => {
|
async (groupId?: string, subGroupId?: string) => {
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug || !projectId || !viewId) return;
|
||||||
return issues.fetchNextIssues(workspaceSlug.toString(), projectId.toString(), groupId, subGroupId);
|
return issues.fetchNextIssues(workspaceSlug.toString(), projectId.toString(), viewId, groupId, subGroupId);
|
||||||
},
|
},
|
||||||
[issues.fetchIssues, workspaceSlug, projectId]
|
[issues.fetchIssues, workspaceSlug, projectId]
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export interface IArchivedIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
projectId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -72,6 +73,17 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
||||||
const projectId = this.rootIssueStore.projectId;
|
const projectId = this.rootIssueStore.projectId;
|
||||||
if (!projectId) return undefined;
|
if (!projectId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const projectId = this.rootIssueStore.projectId;
|
||||||
|
if (!projectId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(projectId: string) {
|
||||||
const displayFilters = this.filters[projectId] || undefined;
|
const displayFilters = this.filters[projectId] || undefined;
|
||||||
if (isEmpty(displayFilters)) return undefined;
|
if (isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
|
|
@ -80,8 +92,8 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
||||||
return _filters;
|
return _filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(projectId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(projectId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
||||||
|
|
@ -99,11 +111,12 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
projectId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(projectId);
|
||||||
|
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
|
|
@ -211,7 +224,9 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
|
||||||
this.rootIssueStore.archivedIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
this.rootIssueStore.archivedIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
||||||
|
}
|
||||||
|
|
||||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {
|
this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {
|
||||||
display_filters: _filters.displayFilters,
|
display_filters: _filters.displayFilters,
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, projectId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.issueArchiveService.getArchivedIssues(workspaceSlug, projectId, params, {
|
const response = await this.issueArchiveService.getArchivedIssues(workspaceSlug, projectId, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -131,6 +131,7 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
projectId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export interface ICycleIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
cycleId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -73,6 +74,17 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
||||||
const cycleId = this.rootIssueStore.cycleId;
|
const cycleId = this.rootIssueStore.cycleId;
|
||||||
if (!cycleId) return undefined;
|
if (!cycleId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(cycleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const cycleId = this.rootIssueStore.cycleId;
|
||||||
|
if (!cycleId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(cycleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(cycleId: string) {
|
||||||
const displayFilters = this.filters[cycleId] || undefined;
|
const displayFilters = this.filters[cycleId] || undefined;
|
||||||
if (isEmpty(displayFilters)) return undefined;
|
if (isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
|
|
@ -81,8 +93,8 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
||||||
return _filters;
|
return _filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(cycleId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(cycleId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
||||||
|
|
@ -102,11 +114,12 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
cycleId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(cycleId);
|
||||||
|
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
|
|
@ -223,12 +236,14 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
|
||||||
this.rootIssueStore.cycleIssues.fetchIssuesWithExistingPagination(
|
this.rootIssueStore.cycleIssues.fetchIssuesWithExistingPagination(
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
projectId,
|
projectId,
|
||||||
"mutation",
|
"mutation",
|
||||||
cycleId
|
cycleId
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {
|
await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {
|
||||||
display_filters: _filters.displayFilters,
|
display_filters: _filters.displayFilters,
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, cycleId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.cycleService.getCycleIssues(workspaceSlug, projectId, cycleId, params, {
|
const response = await this.cycleService.getCycleIssues(workspaceSlug, projectId, cycleId, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -205,6 +205,7 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
cycleId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export interface IDraftIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
projectId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -72,6 +73,17 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
||||||
const projectId = this.rootIssueStore.projectId;
|
const projectId = this.rootIssueStore.projectId;
|
||||||
if (!projectId) return undefined;
|
if (!projectId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const projectId = this.rootIssueStore.projectId;
|
||||||
|
if (!projectId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(projectId: string) {
|
||||||
const displayFilters = this.filters[projectId] || undefined;
|
const displayFilters = this.filters[projectId] || undefined;
|
||||||
if (!projectId || isEmpty(displayFilters)) return undefined;
|
if (!projectId || isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
|
|
@ -80,8 +92,8 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
||||||
return _filters;
|
return _filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(projectId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(projectId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
||||||
|
|
@ -99,11 +111,12 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
projectId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(projectId);
|
||||||
|
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
|
|
@ -206,7 +219,9 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
|
||||||
this.rootIssueStore.draftIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
this.rootIssueStore.draftIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
||||||
|
}
|
||||||
|
|
||||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {
|
this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {
|
||||||
display_filters: _filters.displayFilters,
|
display_filters: _filters.displayFilters,
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, projectId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.issueDraftService.getDraftIssues(workspaceSlug, projectId, params, {
|
const response = await this.issueDraftService.getDraftIssues(workspaceSlug, projectId, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -129,6 +129,7 @@ export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
projectId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
|
||||||
* @param displayFilters
|
* @param displayFilters
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
requiresServerUpdate = (displayFilters: IIssueDisplayFilterOptions) => {
|
getShouldReFetchIssues = (displayFilters: IIssueDisplayFilterOptions) => {
|
||||||
const NON_SERVER_DISPLAY_FILTERS = ["order_by", "sub_issue", "type"];
|
const NON_SERVER_DISPLAY_FILTERS = ["order_by", "sub_issue", "type"];
|
||||||
const displayFilterKeys = Object.keys(displayFilters);
|
const displayFilterKeys = Object.keys(displayFilters);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export interface IModuleIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
moduleId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -73,6 +74,17 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
|
||||||
const moduleId = this.rootIssueStore.moduleId;
|
const moduleId = this.rootIssueStore.moduleId;
|
||||||
if (!moduleId) return undefined;
|
if (!moduleId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(moduleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const moduleId = this.rootIssueStore.moduleId;
|
||||||
|
if (!moduleId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(moduleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(moduleId: string) {
|
||||||
const displayFilters = this.filters[moduleId] || undefined;
|
const displayFilters = this.filters[moduleId] || undefined;
|
||||||
if (isEmpty(displayFilters)) return undefined;
|
if (isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
|
|
@ -81,8 +93,8 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
|
||||||
return _filters;
|
return _filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(moduleId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(moduleId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
||||||
|
|
@ -102,11 +114,12 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
moduleId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(moduleId);
|
||||||
|
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
|
|
@ -222,12 +235,14 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
|
||||||
this.rootIssueStore.moduleIssues.fetchIssuesWithExistingPagination(
|
this.rootIssueStore.moduleIssues.fetchIssuesWithExistingPagination(
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
projectId,
|
projectId,
|
||||||
"mutation",
|
"mutation",
|
||||||
moduleId
|
moduleId
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {
|
await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {
|
||||||
display_filters: _filters.displayFilters,
|
display_filters: _filters.displayFilters,
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, moduleId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.moduleService.getModuleIssues(workspaceSlug, projectId, moduleId, params, {
|
const response = await this.moduleService.getModuleIssues(workspaceSlug, projectId, moduleId, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -160,6 +160,7 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
moduleId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ export interface IProfileIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
userId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -77,6 +78,17 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
||||||
const userId = this.rootIssueStore.userId;
|
const userId = this.rootIssueStore.userId;
|
||||||
if (!userId) return undefined;
|
if (!userId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const userId = this.rootIssueStore.userId;
|
||||||
|
if (!userId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(userId: string) {
|
||||||
const displayFilters = this.filters[userId] || undefined;
|
const displayFilters = this.filters[userId] || undefined;
|
||||||
if (isEmpty(displayFilters)) return undefined;
|
if (isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
|
|
@ -85,8 +97,8 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
||||||
return _filters;
|
return _filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(userId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(userId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "profile_issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "profile_issues");
|
||||||
|
|
@ -104,11 +116,12 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
userId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(userId);
|
||||||
|
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
|
||||||
this.setViewId(view);
|
this.setViewId(view);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
let params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
let params = this.issueFilterStore?.getFilterParams(options, userId, undefined, undefined, undefined);
|
||||||
params = {
|
params = {
|
||||||
...params,
|
...params,
|
||||||
assignees: undefined,
|
assignees: undefined,
|
||||||
|
|
@ -167,6 +167,7 @@ export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
let params = this.issueFilterStore?.getFilterParams(
|
let params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
userId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export interface IProjectViewIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
viewId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -73,6 +74,17 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
||||||
const viewId = this.rootIssueStore.viewId;
|
const viewId = this.rootIssueStore.viewId;
|
||||||
if (!viewId) return undefined;
|
if (!viewId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(viewId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const viewId = this.rootIssueStore.viewId;
|
||||||
|
if (!viewId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(viewId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(viewId: string) {
|
||||||
const displayFilters = this.filters[viewId] || undefined;
|
const displayFilters = this.filters[viewId] || undefined;
|
||||||
if (isEmpty(displayFilters)) return undefined;
|
if (isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
|
|
@ -81,8 +93,8 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
||||||
return _filters;
|
return _filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(viewId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(viewId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
||||||
|
|
@ -100,11 +112,12 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
viewId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(viewId);
|
||||||
|
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
|
|
@ -180,6 +193,7 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
||||||
this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(
|
this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
projectId,
|
projectId,
|
||||||
|
viewId,
|
||||||
isEmpty(filteredFilters) ? "init-loader" : "mutation"
|
isEmpty(filteredFilters) ? "init-loader" : "mutation"
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
@ -217,7 +231,14 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
|
||||||
|
this.rootIssueStore.projectViewIssues.fetchIssuesWithExistingPagination(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
viewId,
|
||||||
|
"mutation"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await this.issueFilterService.patchView(workspaceSlug, projectId, viewId, {
|
await this.issueFilterService.patchView(workspaceSlug, projectId, viewId, {
|
||||||
display_filters: _filters.displayFilters,
|
display_filters: _filters.displayFilters,
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,20 @@ export interface IProjectViewIssues extends IBaseIssuesStore {
|
||||||
fetchIssues: (
|
fetchIssues: (
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
|
viewId: string,
|
||||||
loadType: TLoader,
|
loadType: TLoader,
|
||||||
options: IssuePaginationOptions
|
options: IssuePaginationOptions
|
||||||
) => Promise<TIssuesResponse | undefined>;
|
) => Promise<TIssuesResponse | undefined>;
|
||||||
fetchIssuesWithExistingPagination: (
|
fetchIssuesWithExistingPagination: (
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
|
viewId: string,
|
||||||
loadType: TLoader
|
loadType: TLoader
|
||||||
) => Promise<TIssuesResponse | undefined>;
|
) => Promise<TIssuesResponse | undefined>;
|
||||||
fetchNextIssues: (
|
fetchNextIssues: (
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
|
viewId: string,
|
||||||
groupId?: string,
|
groupId?: string,
|
||||||
subGroupId?: string
|
subGroupId?: string
|
||||||
) => Promise<TIssuesResponse | undefined>;
|
) => Promise<TIssuesResponse | undefined>;
|
||||||
|
|
@ -78,6 +81,7 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
||||||
fetchIssues = async (
|
fetchIssues = async (
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
|
viewId: string,
|
||||||
loadType: TLoader,
|
loadType: TLoader,
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
isExistingPaginationOptions: boolean = false
|
isExistingPaginationOptions: boolean = false
|
||||||
|
|
@ -90,7 +94,7 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, viewId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.issueService.getIssues(workspaceSlug, projectId, params, {
|
const response = await this.issueService.getIssues(workspaceSlug, projectId, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -116,7 +120,13 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
||||||
* @param subGroupId
|
* @param subGroupId
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
fetchNextIssues = async (workspaceSlug: string, projectId: string, groupId?: string, subGroupId?: string) => {
|
fetchNextIssues = async (
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
viewId: string,
|
||||||
|
groupId?: string,
|
||||||
|
subGroupId?: string
|
||||||
|
) => {
|
||||||
const cursorObject = this.getPaginationData(groupId, subGroupId);
|
const cursorObject = this.getPaginationData(groupId, subGroupId);
|
||||||
// if there are no pagination options and the next page results do not exist the return
|
// if there are no pagination options and the next page results do not exist the return
|
||||||
if (!this.paginationOptions || (cursorObject && !cursorObject?.nextPageResults)) return;
|
if (!this.paginationOptions || (cursorObject && !cursorObject?.nextPageResults)) return;
|
||||||
|
|
@ -127,6 +137,7 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
viewId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
@ -152,9 +163,14 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
||||||
* @param loadType
|
* @param loadType
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
fetchIssuesWithExistingPagination = async (workspaceSlug: string, projectId: string, loadType: TLoader) => {
|
fetchIssuesWithExistingPagination = async (
|
||||||
|
workspaceSlug: string,
|
||||||
|
projectId: string,
|
||||||
|
viewId: string,
|
||||||
|
loadType: TLoader
|
||||||
|
) => {
|
||||||
if (!this.paginationOptions) return;
|
if (!this.paginationOptions) return;
|
||||||
return await this.fetchIssues(workspaceSlug, projectId, loadType, this.paginationOptions, true);
|
return await this.fetchIssues(workspaceSlug, projectId, viewId, loadType, this.paginationOptions, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
archiveBulkIssues = this.bulkArchiveIssues;
|
archiveBulkIssues = this.bulkArchiveIssues;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export interface IProjectIssuesFilter extends IBaseIssueFilterStore {
|
||||||
//helper actions
|
//helper actions
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
projectId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -70,18 +71,27 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
|
||||||
|
|
||||||
get issueFilters() {
|
get issueFilters() {
|
||||||
const projectId = this.rootIssueStore.projectId;
|
const projectId = this.rootIssueStore.projectId;
|
||||||
console.log("projectId", projectId);
|
|
||||||
if (!projectId) return undefined;
|
if (!projectId) return undefined;
|
||||||
|
|
||||||
|
return this.getIssueFilters(projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const projectId = this.rootIssueStore.projectId;
|
||||||
|
if (!projectId) return undefined;
|
||||||
|
|
||||||
|
return this.getAppliedFilters(projectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getIssueFilters(projectId: string) {
|
||||||
const displayFilters = this.filters[projectId] || undefined;
|
const displayFilters = this.filters[projectId] || undefined;
|
||||||
console.log("displayFilters", displayFilters);
|
|
||||||
if (isEmpty(displayFilters)) return undefined;
|
if (isEmpty(displayFilters)) return undefined;
|
||||||
|
|
||||||
return this.computedIssueFilters(displayFilters);
|
return this.computedIssueFilters(displayFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
get appliedFilters() {
|
getAppliedFilters(projectId: string) {
|
||||||
const userFilters = this.issueFilters;
|
const userFilters = this.getIssueFilters(projectId);
|
||||||
if (!userFilters) return undefined;
|
if (!userFilters) return undefined;
|
||||||
|
|
||||||
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
const filteredParams = handleIssueQueryParamsByLayout(userFilters?.displayFilters?.layout, "issues");
|
||||||
|
|
@ -99,11 +109,12 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
projectId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
) => {
|
) => {
|
||||||
const filterParams = this.appliedFilters;
|
const filterParams = this.getAppliedFilters(projectId);
|
||||||
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
const paginationParams = this.getPaginationParams(filterParams, options, cursor, groupId, subGroupId);
|
||||||
return paginationParams;
|
return paginationParams;
|
||||||
}
|
}
|
||||||
|
|
@ -217,8 +228,9 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
if (this.getShouldReFetchIssues(updatedDisplayFilters)) {
|
||||||
this.rootIssueStore.projectIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
this.rootIssueStore.projectIssues.fetchIssuesWithExistingPagination(workspaceSlug, projectId, "mutation");
|
||||||
|
}
|
||||||
|
|
||||||
await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {
|
await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {
|
||||||
display_filters: _filters.displayFilters,
|
display_filters: _filters.displayFilters,
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, projectId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.issueService.getIssues(workspaceSlug, projectId, params, {
|
const response = await this.issueService.getIssues(workspaceSlug, projectId, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -130,6 +130,7 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
projectId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ export interface IWorkspaceIssuesFilter extends IBaseIssueFilterStore {
|
||||||
getIssueFilters: (viewId: string | undefined) => IIssueFilters | undefined;
|
getIssueFilters: (viewId: string | undefined) => IIssueFilters | undefined;
|
||||||
getAppliedFilters: (viewId: string) => Partial<Record<TIssueParams, string | boolean>> | undefined;
|
getAppliedFilters: (viewId: string) => Partial<Record<TIssueParams, string | boolean>> | undefined;
|
||||||
getFilterParams: (
|
getFilterParams: (
|
||||||
viewId: string,
|
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
viewId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -104,10 +104,20 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWo
|
||||||
return filteredRouteParams;
|
return filteredRouteParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
get issueFilters() {
|
||||||
|
const viewId = this.rootIssueStore.globalViewId;
|
||||||
|
return this.getIssueFilters(viewId);
|
||||||
|
}
|
||||||
|
|
||||||
|
get appliedFilters() {
|
||||||
|
const viewId = this.rootIssueStore.globalViewId;
|
||||||
|
return this.getAppliedFilters(viewId);
|
||||||
|
}
|
||||||
|
|
||||||
getFilterParams = computedFn(
|
getFilterParams = computedFn(
|
||||||
(
|
(
|
||||||
viewId: string,
|
|
||||||
options: IssuePaginationOptions,
|
options: IssuePaginationOptions,
|
||||||
|
viewId: string,
|
||||||
cursor: string | undefined,
|
cursor: string | undefined,
|
||||||
groupId: string | undefined,
|
groupId: string | undefined,
|
||||||
subGroupId: string | undefined
|
subGroupId: string | undefined
|
||||||
|
|
@ -119,16 +129,6 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWo
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
get issueFilters() {
|
|
||||||
const viewId = this.rootIssueStore.globalViewId;
|
|
||||||
return this.getIssueFilters(viewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
get appliedFilters() {
|
|
||||||
const viewId = this.rootIssueStore.globalViewId;
|
|
||||||
return this.getAppliedFilters(viewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchFilters = async (workspaceSlug: string, viewId: TWorkspaceFilters) => {
|
fetchFilters = async (workspaceSlug: string, viewId: TWorkspaceFilters) => {
|
||||||
try {
|
try {
|
||||||
let filters: IIssueFilterOptions;
|
let filters: IIssueFilterOptions;
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues
|
||||||
this.clear(!isExistingPaginationOptions);
|
this.clear(!isExistingPaginationOptions);
|
||||||
|
|
||||||
// get params from pagination options
|
// get params from pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(viewId, options, undefined, undefined, undefined);
|
const params = this.issueFilterStore?.getFilterParams(options, viewId, undefined, undefined, undefined);
|
||||||
// call the fetch issues API with the params
|
// call the fetch issues API with the params
|
||||||
const response = await this.workspaceService.getViewIssues(workspaceSlug, params, {
|
const response = await this.workspaceService.getViewIssues(workspaceSlug, params, {
|
||||||
signal: this.controller.signal,
|
signal: this.controller.signal,
|
||||||
|
|
@ -128,8 +128,8 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues
|
||||||
|
|
||||||
// get params from stored pagination options
|
// get params from stored pagination options
|
||||||
const params = this.issueFilterStore?.getFilterParams(
|
const params = this.issueFilterStore?.getFilterParams(
|
||||||
viewId,
|
|
||||||
this.paginationOptions,
|
this.paginationOptions,
|
||||||
|
viewId,
|
||||||
this.getNextCursor(groupId, subGroupId),
|
this.getNextCursor(groupId, subGroupId),
|
||||||
groupId,
|
groupId,
|
||||||
subGroupId
|
subGroupId
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue