mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: issue filter loader improvement (#3406)
This commit is contained in:
parent
034f0a06db
commit
864519e770
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -148,8 +150,13 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
|||||||
set(this.filters, [projectId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
set(this.filters, [projectId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const appliedFilters = _filters.filters || {};
|
||||||
this.rootIssueStore.archivedIssues.fetchIssues(workspaceSlug, projectId, "mutation");
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.archivedIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation"
|
||||||
|
);
|
||||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {
|
this.handleIssuesLocalFilters.set(EIssuesStoreType.ARCHIVED, type, workspaceSlug, projectId, undefined, {
|
||||||
filters: _filters.filters,
|
filters: _filters.filters,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -158,7 +160,14 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rootIssueStore.cycleIssues.fetchIssues(workspaceSlug, projectId, "mutation", cycleId);
|
const appliedFilters = _filters.filters || {};
|
||||||
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.cycleIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation",
|
||||||
|
cycleId
|
||||||
|
);
|
||||||
await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {
|
await this.issueFilterService.patchCycleIssueFilters(workspaceSlug, projectId, cycleId, {
|
||||||
filters: _filters.filters,
|
filters: _filters.filters,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -143,8 +145,13 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
|||||||
set(this.filters, [projectId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
set(this.filters, [projectId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const appliedFilters = _filters.filters || {};
|
||||||
this.rootIssueStore.draftIssues.fetchIssues(workspaceSlug, projectId, "mutation");
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.draftIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation"
|
||||||
|
);
|
||||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {
|
this.handleIssuesLocalFilters.set(EIssuesStoreType.DRAFT, type, workspaceSlug, projectId, undefined, {
|
||||||
filters: _filters.filters,
|
filters: _filters.filters,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -157,8 +159,14 @@ export class ModuleIssuesFilter extends IssueFilterHelperStore implements IModul
|
|||||||
set(this.filters, [moduleId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
set(this.filters, [moduleId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const appliedFilters = _filters.filters || {};
|
||||||
this.rootIssueStore.moduleIssues.fetchIssues(workspaceSlug, projectId, "mutation", moduleId);
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.moduleIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation",
|
||||||
|
moduleId
|
||||||
|
);
|
||||||
await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {
|
await this.issueFilterService.patchModuleIssueFilters(workspaceSlug, projectId, moduleId, {
|
||||||
filters: _filters.filters,
|
filters: _filters.filters,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -150,13 +152,16 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const appliedFilters = _filters.filters || {};
|
||||||
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
this.rootIssueStore.profileIssues.fetchIssues(
|
this.rootIssueStore.profileIssues.fetchIssues(
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
undefined,
|
undefined,
|
||||||
"mutation",
|
isEmpty(filteredFilters) ? "init-loader" : "mutation",
|
||||||
userId,
|
userId,
|
||||||
this.rootIssueStore.profileIssues.currentView
|
this.rootIssueStore.profileIssues.currentView
|
||||||
);
|
);
|
||||||
|
|
||||||
this.handleIssuesLocalFilters.set(EIssuesStoreType.PROFILE, type, workspaceSlug, userId, undefined, {
|
this.handleIssuesLocalFilters.set(EIssuesStoreType.PROFILE, type, workspaceSlug, userId, undefined, {
|
||||||
filters: _filters.filters,
|
filters: _filters.filters,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -159,7 +161,14 @@ export class ProjectViewIssuesFilter extends IssueFilterHelperStore implements I
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rootIssueStore.projectViewIssues.fetchIssues(workspaceSlug, projectId, "mutation", viewId);
|
const appliedFilters = _filters.filters || {};
|
||||||
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.projectViewIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation",
|
||||||
|
viewId
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case EIssueFilterType.DISPLAY_FILTERS:
|
case EIssueFilterType.DISPLAY_FILTERS:
|
||||||
const updatedDisplayFilters = filters as IIssueDisplayFilterOptions;
|
const updatedDisplayFilters = filters as IIssueDisplayFilterOptions;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -155,7 +157,13 @@ export class ProjectIssuesFilter extends IssueFilterHelperStore implements IProj
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rootIssueStore.projectIssues.fetchIssues(workspaceSlug, projectId, "mutation");
|
const appliedFilters = _filters.filters || {};
|
||||||
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.projectIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
projectId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation"
|
||||||
|
);
|
||||||
await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {
|
await this.issueFilterService.patchProjectIssueFilters(workspaceSlug, projectId, {
|
||||||
filters: _filters.filters,
|
filters: _filters.filters,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
|
import pickBy from "lodash/pickBy";
|
||||||
|
import isArray from "lodash/isArray";
|
||||||
// base class
|
// base class
|
||||||
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
import { IssueFilterHelperStore } from "../helpers/issue-filter-helper.store";
|
||||||
// helpers
|
// helpers
|
||||||
@ -180,7 +182,13 @@ export class WorkspaceIssuesFilter extends IssueFilterHelperStore implements IWo
|
|||||||
set(this.filters, [viewId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
set(this.filters, [viewId, "filters", _key], updatedFilters[_key as keyof IIssueFilterOptions]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.rootIssueStore.workspaceIssues.fetchIssues(workspaceSlug, viewId, "mutation");
|
const appliedFilters = _filters.filters || {};
|
||||||
|
const filteredFilters = pickBy(appliedFilters, (value) => value && isArray(value) && value.length > 0);
|
||||||
|
this.rootIssueStore.workspaceIssues.fetchIssues(
|
||||||
|
workspaceSlug,
|
||||||
|
viewId,
|
||||||
|
isEmpty(filteredFilters) ? "init-loader" : "mutation"
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case EIssueFilterType.DISPLAY_FILTERS:
|
case EIssueFilterType.DISPLAY_FILTERS:
|
||||||
const updatedDisplayFilters = filters as IIssueDisplayFilterOptions;
|
const updatedDisplayFilters = filters as IIssueDisplayFilterOptions;
|
||||||
|
Loading…
Reference in New Issue
Block a user