fix: archived issues and minor bug fixes (#3451)
* make computedFn without optional arguments * fix archived issues * fix activity changes with proper context * fix display filters that require server side filtering
This commit is contained in:
parent
338d58f79d
commit
6a2be6afc4
23 changed files with 118 additions and 39 deletions
|
|
@ -18,7 +18,7 @@ export interface IEstimateStore {
|
|||
activeEstimateDetails: IEstimate | null;
|
||||
// computed actions
|
||||
areEstimatesEnabledForProject: (projectId: string) => boolean;
|
||||
getEstimatePointValue: (estimateKey: number | null, projectId?: string) => string;
|
||||
getEstimatePointValue: (estimateKey: number | null, projectId: string | null) => string;
|
||||
getProjectEstimateById: (estimateId: string) => IEstimate | null;
|
||||
getProjectActiveEstimateDetails: (projectId: string) => IEstimate | null;
|
||||
// fetch actions
|
||||
|
|
@ -109,7 +109,7 @@ export class EstimateStore implements IEstimateStore {
|
|||
/**
|
||||
* @description returns the point value for the given estimate key to display in the UI
|
||||
*/
|
||||
getEstimatePointValue = computedFn((estimateKey: number | null, projectId?: string) => {
|
||||
getEstimatePointValue = computedFn((estimateKey: number | null, projectId: string | null) => {
|
||||
if (estimateKey === null) return "None";
|
||||
const activeEstimate = projectId ? this.getProjectActiveEstimateDetails(projectId) : this.activeEstimateDetails;
|
||||
return activeEstimate?.points?.find((point) => point.key === estimateKey)?.value || "None";
|
||||
|
|
|
|||
|
|
@ -194,6 +194,9 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.archivedIssues.fetchIssues(workspaceSlug, projectId, "mutation");
|
||||
|
||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -90,11 +90,15 @@ export class ArchivedIssues extends IssueHelperStore implements IArchivedIssues
|
|||
const response = await this.archivedIssueService.getArchivedIssues(workspaceSlug, projectId, params);
|
||||
|
||||
runInAction(() => {
|
||||
set(this.issues, [projectId], Object.keys(response));
|
||||
set(
|
||||
this.issues,
|
||||
[projectId],
|
||||
response.map((issue: TIssue) => issue.id)
|
||||
);
|
||||
this.loader = undefined;
|
||||
});
|
||||
|
||||
this.rootIssueStore.issues.addIssue(Object.values(response));
|
||||
this.rootIssueStore.issues.addIssue(response);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -205,6 +205,9 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.cycleIssues.fetchIssues(workspaceSlug, projectId, "mutation", cycleId);
|
||||
|
||||
await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
@ -259,3 +262,5 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.draftIssues.fetchIssues(workspaceSlug, projectId, "mutation");
|
||||
|
||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -183,6 +183,20 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
|
|||
updated_on: displayProperties?.updated_on ?? true,
|
||||
});
|
||||
|
||||
/**
|
||||
* This Method returns true if the display properties changed requires a server side update
|
||||
* @param displayFilters
|
||||
* @returns
|
||||
*/
|
||||
requiresServerUpdate = (displayFilters: IIssueDisplayFilterOptions) => {
|
||||
const SERVER_DISPLAY_FILTERS = ["sub_issue", "type"];
|
||||
const displayFilterKeys = Object.keys(displayFilters);
|
||||
|
||||
return SERVER_DISPLAY_FILTERS.some((serverDisplayfilter: string) =>
|
||||
displayFilterKeys.includes(serverDisplayfilter)
|
||||
);
|
||||
};
|
||||
|
||||
handleIssuesLocalFilters = {
|
||||
fetchFiltersFromStorage: () => {
|
||||
const _filters = storage.get("issue_local_filters");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export interface IIssueKanBanViewStore {
|
|||
subgroupByIssuesVisibility: string[];
|
||||
};
|
||||
// computed
|
||||
getCanUserDragDrop: (order_by: string | null, group_by: string | null, sub_group_by?: string | null) => boolean;
|
||||
getCanUserDragDrop: (group_by: string | null, sub_group_by: string | null) => boolean;
|
||||
canUserDragDropVertically: boolean;
|
||||
canUserDragDropHorizontally: boolean;
|
||||
// actions
|
||||
|
|
@ -38,7 +38,7 @@ export class IssueKanBanViewStore implements IIssueKanBanViewStore {
|
|||
this.rootStore = _rootStore;
|
||||
}
|
||||
|
||||
getCanUserDragDrop = computedFn((group_by: string | null, sub_group_by?: string | null) => {
|
||||
getCanUserDragDrop = computedFn((group_by: string | null, sub_group_by: string | null) => {
|
||||
if (group_by && ["state", "priority"].includes(group_by)) {
|
||||
if (!sub_group_by) return true;
|
||||
if (sub_group_by && ["state", "priority"].includes(sub_group_by)) return true;
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.moduleIssues.fetchIssues(workspaceSlug, projectId, "mutation", moduleId);
|
||||
|
||||
await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -199,6 +199,15 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.profileIssues.fetchIssues(
|
||||
workspaceSlug,
|
||||
undefined,
|
||||
"mutation",
|
||||
userId,
|
||||
this.rootIssueStore.profileIssues.currentView
|
||||
);
|
||||
|
||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.PROFILE, type, workspaceSlug, userId, undefined, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -203,6 +203,9 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.projectViewIssues.fetchIssues(workspaceSlug, projectId, "mutation", viewId);
|
||||
|
||||
await this.issueFilterService.patchView(workspaceSlug, projectId, viewId, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -201,6 +201,9 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
|
|||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.projectIssues.fetchIssues(workspaceSlug, projectId, "mutation");
|
||||
|
||||
await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {
|
||||
display_filters: _filters.displayFilters,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -222,6 +222,10 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWo
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
if (this.requiresServerUpdate(updatedDisplayFilters))
|
||||
this.rootIssueStore.workspaceIssues.fetchIssues(workspaceSlug, viewId, "mutation");
|
||||
|
||||
if (["all-issues", "assigned", "created", "subscribed"].includes(viewId))
|
||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.GLOBAL, type, workspaceSlug, undefined, viewId, {
|
||||
display_filters: _filters.displayFilters,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue