mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: handle cross project issues in the sub-issues. (#2357)
This commit is contained in:
parent
d0a51d75f6
commit
48c65c9c95
@ -1,7 +1,8 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
// next imports
|
// next imports
|
||||||
import Link from "next/link";
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
// swr
|
||||||
|
import { mutate } from "swr";
|
||||||
// lucide icons
|
// lucide icons
|
||||||
import {
|
import {
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
@ -13,6 +14,7 @@ import {
|
|||||||
Loader,
|
Loader,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
// components
|
// components
|
||||||
|
import { IssuePeekOverview } from "components/issues/peek-overview";
|
||||||
import { SubIssuesRootList } from "./issues-list";
|
import { SubIssuesRootList } from "./issues-list";
|
||||||
import { IssueProperty } from "./properties";
|
import { IssueProperty } from "./properties";
|
||||||
// ui
|
// ui
|
||||||
@ -20,6 +22,8 @@ import { Tooltip, CustomMenu } from "components/ui";
|
|||||||
// types
|
// types
|
||||||
import { ICurrentUserResponse, IIssue } from "types";
|
import { ICurrentUserResponse, IIssue } from "types";
|
||||||
import { ISubIssuesRootLoaders, ISubIssuesRootLoadersHandler } from "./root";
|
import { ISubIssuesRootLoaders, ISubIssuesRootLoadersHandler } from "./root";
|
||||||
|
// fetch keys
|
||||||
|
import { SUB_ISSUES } from "constants/fetch-keys";
|
||||||
|
|
||||||
export interface ISubIssues {
|
export interface ISubIssues {
|
||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
@ -38,7 +42,6 @@ export interface ISubIssues {
|
|||||||
issueId: string,
|
issueId: string,
|
||||||
issue?: IIssue | null
|
issue?: IIssue | null
|
||||||
) => void;
|
) => void;
|
||||||
setPeekParentId: (id: string) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SubIssues: React.FC<ISubIssues> = ({
|
export const SubIssues: React.FC<ISubIssues> = ({
|
||||||
@ -54,14 +57,12 @@ export const SubIssues: React.FC<ISubIssues> = ({
|
|||||||
handleIssuesLoader,
|
handleIssuesLoader,
|
||||||
copyText,
|
copyText,
|
||||||
handleIssueCrudOperation,
|
handleIssueCrudOperation,
|
||||||
setPeekParentId,
|
|
||||||
}) => {
|
}) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { query } = router;
|
||||||
|
const { peekIssue } = query as { peekIssue: string };
|
||||||
|
|
||||||
const openPeekOverview = (issue_id: string) => {
|
const openPeekOverview = (issue_id: string) => {
|
||||||
const { query } = router;
|
|
||||||
|
|
||||||
setPeekParentId(parentIssue?.id);
|
|
||||||
router.push({
|
router.push({
|
||||||
pathname: router.pathname,
|
pathname: router.pathname,
|
||||||
query: { ...query, peekIssue: issue_id },
|
query: { ...query, peekIssue: issue_id },
|
||||||
@ -199,7 +200,17 @@ export const SubIssues: React.FC<ISubIssues> = ({
|
|||||||
handleIssuesLoader={handleIssuesLoader}
|
handleIssuesLoader={handleIssuesLoader}
|
||||||
copyText={copyText}
|
copyText={copyText}
|
||||||
handleIssueCrudOperation={handleIssueCrudOperation}
|
handleIssueCrudOperation={handleIssueCrudOperation}
|
||||||
setPeekParentId={setPeekParentId}
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{peekIssue && peekIssue === issue?.id && (
|
||||||
|
<IssuePeekOverview
|
||||||
|
handleMutation={() =>
|
||||||
|
parentIssue && parentIssue?.id && mutate(SUB_ISSUES(parentIssue?.id))
|
||||||
|
}
|
||||||
|
projectId={issue?.project ?? ""}
|
||||||
|
workspaceSlug={workspaceSlug ?? ""}
|
||||||
|
readOnly={!editable}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,6 @@ export interface ISubIssuesRootList {
|
|||||||
issueId: string,
|
issueId: string,
|
||||||
issue?: IIssue | null
|
issue?: IIssue | null
|
||||||
) => void;
|
) => void;
|
||||||
setPeekParentId: (id: string) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SubIssuesRootList: React.FC<ISubIssuesRootList> = ({
|
export const SubIssuesRootList: React.FC<ISubIssuesRootList> = ({
|
||||||
@ -42,7 +41,6 @@ export const SubIssuesRootList: React.FC<ISubIssuesRootList> = ({
|
|||||||
handleIssuesLoader,
|
handleIssuesLoader,
|
||||||
copyText,
|
copyText,
|
||||||
handleIssueCrudOperation,
|
handleIssueCrudOperation,
|
||||||
setPeekParentId,
|
|
||||||
}) => {
|
}) => {
|
||||||
const { data: issues, isLoading } = useSWR(
|
const { data: issues, isLoading } = useSWR(
|
||||||
workspaceSlug && projectId && parentIssue && parentIssue?.id
|
workspaceSlug && projectId && parentIssue && parentIssue?.id
|
||||||
@ -83,7 +81,6 @@ export const SubIssuesRootList: React.FC<ISubIssuesRootList> = ({
|
|||||||
handleIssuesLoader={handleIssuesLoader}
|
handleIssuesLoader={handleIssuesLoader}
|
||||||
copyText={copyText}
|
copyText={copyText}
|
||||||
handleIssueCrudOperation={handleIssueCrudOperation}
|
handleIssueCrudOperation={handleIssueCrudOperation}
|
||||||
setPeekParentId={setPeekParentId}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import { ExistingIssuesListModal } from "components/core";
|
|||||||
import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
||||||
import { SubIssuesRootList } from "./issues-list";
|
import { SubIssuesRootList } from "./issues-list";
|
||||||
import { ProgressBar } from "./progressbar";
|
import { ProgressBar } from "./progressbar";
|
||||||
import { IssuePeekOverview } from "components/issues/peek-overview";
|
|
||||||
// ui
|
// ui
|
||||||
import { CustomMenu } from "components/ui";
|
import { CustomMenu } from "components/ui";
|
||||||
// hooks
|
// hooks
|
||||||
@ -60,8 +59,6 @@ export const SubIssuesRoot: React.FC<ISubIssuesRoot> = ({ parentIssue, user }) =
|
|||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
const [peekParentId, setPeekParentId] = React.useState<string | null>("");
|
|
||||||
|
|
||||||
const [issuesLoader, setIssuesLoader] = React.useState<ISubIssuesRootLoaders>({
|
const [issuesLoader, setIssuesLoader] = React.useState<ISubIssuesRootLoaders>({
|
||||||
visibility: [parentIssue?.id],
|
visibility: [parentIssue?.id],
|
||||||
delete: [],
|
delete: [],
|
||||||
@ -237,7 +234,6 @@ export const SubIssuesRoot: React.FC<ISubIssuesRoot> = ({ parentIssue, user }) =
|
|||||||
handleIssuesLoader={handleIssuesLoader}
|
handleIssuesLoader={handleIssuesLoader}
|
||||||
copyText={copyText}
|
copyText={copyText}
|
||||||
handleIssueCrudOperation={handleIssueCrudOperation}
|
handleIssueCrudOperation={handleIssueCrudOperation}
|
||||||
setPeekParentId={setPeekParentId}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -363,13 +359,6 @@ export const SubIssuesRoot: React.FC<ISubIssuesRoot> = ({ parentIssue, user }) =
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<IssuePeekOverview
|
|
||||||
handleMutation={() => peekParentId && peekIssue && mutateSubIssues(peekParentId)}
|
|
||||||
projectId={projectId ?? ""}
|
|
||||||
workspaceSlug={workspaceSlug ?? ""}
|
|
||||||
readOnly={!isEditable}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user