| 56 | } |
| 57 | |
| 58 | export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues { |
| 59 | viewFlags = { |
| 60 | enableQuickAdd: true, |
| 61 | enableIssueCreation: true, |
| 62 | enableInlineEditing: true, |
| 63 | }; |
| 64 | // service |
| 65 | workspaceService; |
| 66 | // filterStore |
| 67 | issueFilterStore; |
| 68 | |
| 69 | constructor(_rootStore: IIssueRootStore, issueFilterStore: IWorkspaceIssuesFilter) { |
| 70 | super(_rootStore, issueFilterStore); |
| 71 | |
| 72 | makeObservable(this, { |
| 73 | // action |
| 74 | fetchIssues: action, |
| 75 | fetchNextIssues: action, |
| 76 | fetchIssuesWithExistingPagination: action, |
| 77 | }); |
| 78 | // services |
| 79 | this.workspaceService = new WorkspaceService(); |
| 80 | // filter store |
| 81 | this.issueFilterStore = issueFilterStore; |
| 82 | } |
| 83 | |
| 84 | fetchParentStats = () => {}; |
| 85 | |
| 86 | /** */ |
| 87 | updateParentStats = () => {}; |
| 88 | |
| 89 | /** |
| 90 | * This method is called to fetch the first issues of pagination |
| 91 | * @param workspaceSlug |
| 92 | * @param viewId |
| 93 | * @param loadType |
| 94 | * @param options |
| 95 | * @returns |
| 96 | */ |
| 97 | fetchIssues = async ( |
| 98 | workspaceSlug: string, |
| 99 | viewId: string, |
| 100 | loadType: TLoader, |
| 101 | options: IssuePaginationOptions, |
| 102 | isExistingPaginationOptions: boolean = false |
| 103 | ) => { |
| 104 | try { |
| 105 | // set loader and clear store |
| 106 | runInAction(() => { |
| 107 | this.setLoader(loadType); |
| 108 | }); |
| 109 | this.clear(!isExistingPaginationOptions); |
| 110 | |
| 111 | // get params from pagination options |
| 112 | const params = this.issueFilterStore?.getFilterParams(options, viewId, undefined, undefined, undefined); |
| 113 | // call the fetch issues API with the params |
| 114 | const response = await this.workspaceService.getViewIssues(workspaceSlug, params, { |
| 115 | signal: this.controller.signal, |
nothing calls this directly
no test coverage detected