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
|
||||
import { useGlobalView, useIssues, useUser } from "hooks/store";
|
||||
// components
|
||||
import { GlobalViewsAppliedFiltersRoot } from "components/issues";
|
||||
import { GlobalViewsAppliedFiltersRoot, IssuePeekOverview } from "components/issues";
|
||||
import { SpreadsheetView } from "components/issues/issue-layouts";
|
||||
import { AllIssueQuickActions } from "components/issues/issue-layouts/quick-action-dropdowns";
|
||||
// ui
|
||||
import { Spinner } from "@plane/ui";
|
||||
// types
|
||||
import { TIssue, IIssueDisplayFilterOptions, TStaticViewTypes, TUnGroupedIssues } from "@plane/types";
|
||||
import { TIssue, IIssueDisplayFilterOptions } from "@plane/types";
|
||||
import { EIssueActions } from "../types";
|
||||
import { EUserProjectRoles } from "constants/project";
|
||||
import { EIssueFilterType, EIssuesStoreType } from "constants/issue";
|
||||
|
||||
|
||||
|
||||
export const AllIssueLayoutRoot: React.FC = observer(() => {
|
||||
// router
|
||||
const router = useRouter();
|
||||
@ -48,11 +46,7 @@ export const AllIssueLayoutRoot: React.FC = observer(() => {
|
||||
if (workspaceSlug && globalViewId) {
|
||||
await fetchAllGlobalViews(workspaceSlug.toString());
|
||||
await fetchFilters(workspaceSlug.toString(), globalViewId.toString());
|
||||
await fetchIssues(
|
||||
workspaceSlug.toString(),
|
||||
globalViewId.toString(),
|
||||
groupedIssueIds ? "mutation" : "init-loader"
|
||||
);
|
||||
await fetchIssues(workspaceSlug.toString(), globalViewId.toString(), issueIds ? "mutation" : "init-loader");
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -138,6 +132,9 @@ export const AllIssueLayoutRoot: React.FC = observer(() => {
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* peek overview */}
|
||||
<IssuePeekOverview />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
@ -35,12 +35,9 @@ export type TIssuePeekOperations = {
|
||||
export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
const { is_archived = false, onIssueUpdate } = props;
|
||||
// hooks
|
||||
const {
|
||||
project: {},
|
||||
} = useMember();
|
||||
const { setToastAlert } = useToast();
|
||||
const {
|
||||
membership: { currentProjectRole },
|
||||
membership: { currentWorkspaceAllProjectsRole },
|
||||
} = useUser();
|
||||
const {
|
||||
issues: { removeIssue: removeArchivedIssue },
|
||||
@ -198,6 +195,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
|
||||
const issue = getIssueById(peekIssue.issueId) || undefined;
|
||||
|
||||
const currentProjectRole = currentWorkspaceAllProjectsRole?.[peekIssue?.projectId];
|
||||
// Check if issue is editable, based on user role
|
||||
const is_editable = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||
const isLoading = !issue || loader ? true : false;
|
||||
|
@ -5,7 +5,7 @@ import { observer } from "mobx-react-lite";
|
||||
// components
|
||||
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 { ProfileIssuesAppliedFiltersRoot } from "components/issues";
|
||||
import { IssuePeekOverview, ProfileIssuesAppliedFiltersRoot } from "components/issues";
|
||||
import { Spinner } from "@plane/ui";
|
||||
// hooks
|
||||
import { useIssues } from "hooks/store";
|
||||
@ -34,7 +34,7 @@ export const ProfileIssuesPage = observer((props: IProfileIssuesPage) => {
|
||||
async () => {
|
||||
if (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 />
|
||||
) : null}
|
||||
</div>
|
||||
{/* peek overview */}
|
||||
<IssuePeekOverview />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
@ -1,7 +1 @@
|
||||
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,
|
||||
} from "@plane/types";
|
||||
// constants
|
||||
import { isNil } from "constants/common";
|
||||
import { EIssueFilterType, EIssuesStoreType } from "constants/issue";
|
||||
// lib
|
||||
import { storage } from "lib/local-storage";
|
||||
@ -76,8 +75,8 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
|
||||
target_date: filters?.target_date || undefined,
|
||||
// display filters
|
||||
type: displayFilters?.type || undefined,
|
||||
sub_issue: isNil(displayFilters?.sub_issue) ? true : displayFilters?.sub_issue,
|
||||
start_target_date: isNil(displayFilters?.start_target_date) ? true : displayFilters?.start_target_date,
|
||||
sub_issue: displayFilters?.sub_issue ?? true,
|
||||
start_target_date: displayFilters?.start_target_date ?? true,
|
||||
};
|
||||
|
||||
const issueFiltersParams: Partial<Record<TIssueParams, boolean | string>> = {};
|
||||
@ -169,19 +168,19 @@ export class IssueFilterHelperStore implements IIssueFilterHelperStore {
|
||||
* @returns {IIssueDisplayProperties}
|
||||
*/
|
||||
computedDisplayProperties = (displayProperties: IIssueDisplayProperties): IIssueDisplayProperties => ({
|
||||
assignee: displayProperties?.assignee || false,
|
||||
start_date: displayProperties?.start_date || false,
|
||||
due_date: displayProperties?.due_date || false,
|
||||
labels: displayProperties?.labels || false,
|
||||
priority: displayProperties?.priority || false,
|
||||
state: displayProperties?.state || false,
|
||||
sub_issue_count: displayProperties?.sub_issue_count || false,
|
||||
attachment_count: displayProperties?.attachment_count || false,
|
||||
estimate: displayProperties?.estimate || false,
|
||||
link: displayProperties?.link || false,
|
||||
key: displayProperties?.key || false,
|
||||
created_on: displayProperties?.created_on || false,
|
||||
updated_on: displayProperties?.updated_on || false,
|
||||
assignee: displayProperties?.assignee ?? true,
|
||||
start_date: displayProperties?.start_date ?? true,
|
||||
due_date: displayProperties?.due_date ?? true,
|
||||
labels: displayProperties?.labels ?? true,
|
||||
priority: displayProperties?.priority ?? true,
|
||||
state: displayProperties?.state ?? true,
|
||||
sub_issue_count: displayProperties?.sub_issue_count ?? true,
|
||||
attachment_count: displayProperties?.attachment_count ?? true,
|
||||
link: displayProperties?.link ?? true,
|
||||
estimate: displayProperties?.estimate ?? true,
|
||||
key: displayProperties?.key ?? true,
|
||||
created_on: displayProperties?.created_on ?? true,
|
||||
updated_on: displayProperties?.updated_on ?? true,
|
||||
});
|
||||
|
||||
handleIssuesLocalFilters = {
|
||||
|
@ -183,10 +183,10 @@ export class ProfileIssuesFilter extends IssueFilterHelperStore implements IProf
|
||||
_filters.displayFilters.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) {
|
||||
_filters.displayFilters.group_by = "state";
|
||||
updatedDisplayFilters.group_by = "state";
|
||||
_filters.displayFilters.group_by = "priority";
|
||||
updatedDisplayFilters.group_by = "priority";
|
||||
}
|
||||
|
||||
runInAction(() => {
|
||||
|
@ -97,7 +97,9 @@ export class ProfileIssues extends IssueHelperStore implements IProfileIssues {
|
||||
const orderBy = displayFilters?.order_by;
|
||||
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);
|
||||
if (!_issues) return undefined;
|
||||
|
@ -123,6 +123,7 @@ export class IssueRootStore implements IIssueRootStore {
|
||||
moduleId: observable.ref,
|
||||
viewId: observable.ref,
|
||||
userId: observable.ref,
|
||||
globalViewId: observable.ref,
|
||||
states: observable,
|
||||
stateDetails: observable,
|
||||
labels: observable,
|
||||
|
Loading…
Reference in New Issue
Block a user