forked from github/plane
fix: update global issues filter and enable profile issues (#3410)
* fix all issues and fix profile issues * minor comments update * minor change nullish check logic * update nullish check logic --------- Co-authored-by: Rahul R <rahulr@Rahuls-MacBook-Pro.local>
This commit is contained in:
parent
864519e770
commit
d656f8e62a
@ -5,19 +5,17 @@ import useSWR from "swr";
|
|||||||
// hooks
|
// hooks
|
||||||
import { useGlobalView, useIssues, useUser } from "hooks/store";
|
import { useGlobalView, useIssues, useUser } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { GlobalViewsAppliedFiltersRoot } from "components/issues";
|
import { GlobalViewsAppliedFiltersRoot, IssuePeekOverview } from "components/issues";
|
||||||
import { SpreadsheetView } from "components/issues/issue-layouts";
|
import { SpreadsheetView } from "components/issues/issue-layouts";
|
||||||
import { AllIssueQuickActions } from "components/issues/issue-layouts/quick-action-dropdowns";
|
import { AllIssueQuickActions } from "components/issues/issue-layouts/quick-action-dropdowns";
|
||||||
// ui
|
// ui
|
||||||
import { Spinner } from "@plane/ui";
|
import { Spinner } from "@plane/ui";
|
||||||
// types
|
// types
|
||||||
import { TIssue, IIssueDisplayFilterOptions, TStaticViewTypes, TUnGroupedIssues } from "@plane/types";
|
import { TIssue, IIssueDisplayFilterOptions } from "@plane/types";
|
||||||
import { EIssueActions } from "../types";
|
import { EIssueActions } from "../types";
|
||||||
import { EUserProjectRoles } from "constants/project";
|
import { EUserProjectRoles } from "constants/project";
|
||||||
import { EIssueFilterType, EIssuesStoreType } from "constants/issue";
|
import { EIssueFilterType, EIssuesStoreType } from "constants/issue";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const AllIssueLayoutRoot: React.FC = observer(() => {
|
export const AllIssueLayoutRoot: React.FC = observer(() => {
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -48,11 +46,7 @@ export const AllIssueLayoutRoot: React.FC = observer(() => {
|
|||||||
if (workspaceSlug && globalViewId) {
|
if (workspaceSlug && globalViewId) {
|
||||||
await fetchAllGlobalViews(workspaceSlug.toString());
|
await fetchAllGlobalViews(workspaceSlug.toString());
|
||||||
await fetchFilters(workspaceSlug.toString(), globalViewId.toString());
|
await fetchFilters(workspaceSlug.toString(), globalViewId.toString());
|
||||||
await fetchIssues(
|
await fetchIssues(workspaceSlug.toString(), globalViewId.toString(), issueIds ? "mutation" : "init-loader");
|
||||||
workspaceSlug.toString(),
|
|
||||||
globalViewId.toString(),
|
|
||||||
groupedIssueIds ? "mutation" : "init-loader"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -138,6 +132,9 @@ export const AllIssueLayoutRoot: React.FC = observer(() => {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* peek overview */}
|
||||||
|
<IssuePeekOverview />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -35,12 +35,9 @@ export type TIssuePeekOperations = {
|
|||||||
export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||||
const { is_archived = false, onIssueUpdate } = props;
|
const { is_archived = false, onIssueUpdate } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const {
|
|
||||||
project: {},
|
|
||||||
} = useMember();
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentWorkspaceAllProjectsRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
const {
|
const {
|
||||||
issues: { removeIssue: removeArchivedIssue },
|
issues: { removeIssue: removeArchivedIssue },
|
||||||
@ -198,6 +195,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
|||||||
|
|
||||||
const issue = getIssueById(peekIssue.issueId) || undefined;
|
const issue = getIssueById(peekIssue.issueId) || undefined;
|
||||||
|
|
||||||
|
const currentProjectRole = currentWorkspaceAllProjectsRole?.[peekIssue?.projectId];
|
||||||
// Check if issue is editable, based on user role
|
// Check if issue is editable, based on user role
|
||||||
const is_editable = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
const is_editable = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||||
const isLoading = !issue || loader ? true : false;
|
const isLoading = !issue || loader ? true : false;
|
||||||
|
@ -5,7 +5,7 @@ import { observer } from "mobx-react-lite";
|
|||||||
// components
|
// components
|
||||||
import { ProfileIssuesListLayout } from "components/issues/issue-layouts/list/roots/profile-issues-root";
|
import { ProfileIssuesListLayout } from "components/issues/issue-layouts/list/roots/profile-issues-root";
|
||||||
import { ProfileIssuesKanBanLayout } from "components/issues/issue-layouts/kanban/roots/profile-issues-root";
|
import { ProfileIssuesKanBanLayout } from "components/issues/issue-layouts/kanban/roots/profile-issues-root";
|
||||||
import { ProfileIssuesAppliedFiltersRoot } from "components/issues";
|
import { IssuePeekOverview, ProfileIssuesAppliedFiltersRoot } from "components/issues";
|
||||||
import { Spinner } from "@plane/ui";
|
import { Spinner } from "@plane/ui";
|
||||||
// hooks
|
// hooks
|
||||||
import { useIssues } from "hooks/store";
|
import { useIssues } from "hooks/store";
|
||||||
@ -34,7 +34,7 @@ export const ProfileIssuesPage = observer((props: IProfileIssuesPage) => {
|
|||||||
async () => {
|
async () => {
|
||||||
if (workspaceSlug && userId) {
|
if (workspaceSlug && userId) {
|
||||||
await fetchFilters(workspaceSlug, userId);
|
await fetchFilters(workspaceSlug, userId);
|
||||||
await fetchIssues(workspaceSlug, userId, groupedIssueIds ? "mutation" : "init-loader", undefined, type);
|
await fetchIssues(workspaceSlug, undefined, groupedIssueIds ? "mutation" : "init-loader", userId, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -57,6 +57,8 @@ export const ProfileIssuesPage = observer((props: IProfileIssuesPage) => {
|
|||||||
<ProfileIssuesKanBanLayout />
|
<ProfileIssuesKanBanLayout />
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
{/* peek overview */}
|
||||||
|
<IssuePeekOverview />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
@ -1,7 +1 @@
|
|||||||
export const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
|
export const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
|
||||||
|
|
||||||
export const isNil = (value: any) => {
|
|
||||||
if (value === undefined || value === null) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
TStaticViewTypes,
|
TStaticViewTypes,
|
||||||
} from "@plane/types";
|
} from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { isNil } from "constants/common";
|
|
||||||
import { EIssueFilterType, EIssuesStoreType } from "constants/issue";
|
import { EIssueFilterType, EIssuesStoreType } from "constants/issue";
|
||||||
// lib
|
// lib
|
||||||
import { storage } from "lib/local-storage";
|
import { storage } from "lib/local-storage";
|
||||||
@ -76,8 +75,8 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
|
|||||||
target_date: filters?.target_date || undefined,
|
target_date: filters?.target_date || undefined,
|
||||||
// display filters
|
// display filters
|
||||||
type: displayFilters?.type || undefined,
|
type: displayFilters?.type || undefined,
|
||||||
sub_issue: isNil(displayFilters?.sub_issue) ? true : displayFilters?.sub_issue,
|
sub_issue: displayFilters?.sub_issue ?? true,
|
||||||
start_target_date: isNil(displayFilters?.start_target_date) ? true : displayFilters?.start_target_date,
|
start_target_date: displayFilters?.start_target_date ?? true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const issueFiltersParams: Partial<Record<TIssueParams, boolean | string>> = {};
|
const issueFiltersParams: Partial<Record<TIssueParams, boolean | string>> = {};
|
||||||
@ -169,19 +168,19 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
|
|||||||
* @returns {IIssueDisplayProperties}
|
* @returns {IIssueDisplayProperties}
|
||||||
*/
|
*/
|
||||||
computedDisplayProperties = (displayProperties: IIssueDisplayProperties): IIssueDisplayProperties => ({
|
computedDisplayProperties = (displayProperties: IIssueDisplayProperties): IIssueDisplayProperties => ({
|
||||||
assignee: displayProperties?.assignee || false,
|
assignee: displayProperties?.assignee ?? true,
|
||||||
start_date: displayProperties?.start_date || false,
|
start_date: displayProperties?.start_date ?? true,
|
||||||
due_date: displayProperties?.due_date || false,
|
due_date: displayProperties?.due_date ?? true,
|
||||||
labels: displayProperties?.labels || false,
|
labels: displayProperties?.labels ?? true,
|
||||||
priority: displayProperties?.priority || false,
|
priority: displayProperties?.priority ?? true,
|
||||||
state: displayProperties?.state || false,
|
state: displayProperties?.state ?? true,
|
||||||
sub_issue_count: displayProperties?.sub_issue_count || false,
|
sub_issue_count: displayProperties?.sub_issue_count ?? true,
|
||||||
attachment_count: displayProperties?.attachment_count || false,
|
attachment_count: displayProperties?.attachment_count ?? true,
|
||||||
estimate: displayProperties?.estimate || false,
|
link: displayProperties?.link ?? true,
|
||||||
link: displayProperties?.link || false,
|
estimate: displayProperties?.estimate ?? true,
|
||||||
key: displayProperties?.key || false,
|
key: displayProperties?.key ?? true,
|
||||||
created_on: displayProperties?.created_on || false,
|
created_on: displayProperties?.created_on ?? true,
|
||||||
updated_on: displayProperties?.updated_on || false,
|
updated_on: displayProperties?.updated_on ?? true,
|
||||||
});
|
});
|
||||||
|
|
||||||
handleIssuesLocalFilters = {
|
handleIssuesLocalFilters = {
|
||||||
|
@ -183,10 +183,10 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
|||||||
_filters.displayFilters.sub_group_by = null;
|
_filters.displayFilters.sub_group_by = null;
|
||||||
updatedDisplayFilters.sub_group_by = null;
|
updatedDisplayFilters.sub_group_by = null;
|
||||||
}
|
}
|
||||||
// set group_by to state if layout is switched to kanban and group_by is null
|
// set group_by to priority if layout is switched to kanban and group_by is null
|
||||||
if (_filters.displayFilters.layout === "kanban" && _filters.displayFilters.group_by === null) {
|
if (_filters.displayFilters.layout === "kanban" && _filters.displayFilters.group_by === null) {
|
||||||
_filters.displayFilters.group_by = "state";
|
_filters.displayFilters.group_by = "priority";
|
||||||
updatedDisplayFilters.group_by = "state";
|
updatedDisplayFilters.group_by = "priority";
|
||||||
}
|
}
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
|
@ -97,7 +97,9 @@ export class ProfileIssues extends IssueHelperStore implements IProfileIssues {
|
|||||||
const orderBy = displayFilters?.order_by;
|
const orderBy = displayFilters?.order_by;
|
||||||
const layout = displayFilters?.layout;
|
const layout = displayFilters?.layout;
|
||||||
|
|
||||||
const userIssueIds = this.issues[userId][currentView] ?? [];
|
const userIssueIds = this.issues[userId]?.[currentView];
|
||||||
|
|
||||||
|
if (!userIssueIds) return;
|
||||||
|
|
||||||
const _issues = this.rootStore.issues.getIssuesByIds(userIssueIds);
|
const _issues = this.rootStore.issues.getIssuesByIds(userIssueIds);
|
||||||
if (!_issues) return undefined;
|
if (!_issues) return undefined;
|
||||||
|
@ -123,6 +123,7 @@ export class IssueRootStore implements IIssueRootStore {
|
|||||||
moduleId: observable.ref,
|
moduleId: observable.ref,
|
||||||
viewId: observable.ref,
|
viewId: observable.ref,
|
||||||
userId: observable.ref,
|
userId: observable.ref,
|
||||||
|
globalViewId: observable.ref,
|
||||||
states: observable,
|
states: observable,
|
||||||
stateDetails: observable,
|
stateDetails: observable,
|
||||||
labels: observable,
|
labels: observable,
|
||||||
|
Loading…
Reference in New Issue
Block a user