forked from github/plane
chore: validation added to cycle issue transfer button (#3760)
This commit is contained in:
parent
02182e05c4
commit
9b54fe80a8
@ -16,12 +16,13 @@ import { CYCLE_DETAILS } from "constants/fetch-keys";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
handleClick: () => void;
|
handleClick: () => void;
|
||||||
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cycleService = new CycleService();
|
const cycleService = new CycleService();
|
||||||
|
|
||||||
export const TransferIssues: React.FC<Props> = (props) => {
|
export const TransferIssues: React.FC<Props> = (props) => {
|
||||||
const { handleClick } = props;
|
const { handleClick, disabled = false } = props;
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId, cycleId } = router.query;
|
const { workspaceSlug, projectId, cycleId } = router.query;
|
||||||
@ -46,7 +47,12 @@ export const TransferIssues: React.FC<Props> = (props) => {
|
|||||||
|
|
||||||
{isEmpty(cycleDetails?.progress_snapshot) && transferableIssuesCount > 0 && (
|
{isEmpty(cycleDetails?.progress_snapshot) && transferableIssuesCount > 0 && (
|
||||||
<div>
|
<div>
|
||||||
<Button variant="primary" prependIcon={<TransferIcon color="white" />} onClick={handleClick}>
|
<Button
|
||||||
|
variant="primary"
|
||||||
|
prependIcon={<TransferIcon color="white" />}
|
||||||
|
onClick={handleClick}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
Transfer Issues
|
Transfer Issues
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,7 @@ import { useRouter } from "next/router";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import size from "lodash/size";
|
import size from "lodash/size";
|
||||||
|
import isEmpty from "lodash/isEmpty";
|
||||||
// hooks
|
// hooks
|
||||||
import { useCycle, useIssues } from "hooks/store";
|
import { useCycle, useIssues } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
@ -89,7 +90,12 @@ export const CycleLayoutRoot: React.FC = observer(() => {
|
|||||||
<>
|
<>
|
||||||
<TransferIssuesModal handleClose={() => setTransferIssuesModal(false)} isOpen={transferIssuesModal} />
|
<TransferIssuesModal handleClose={() => setTransferIssuesModal(false)} isOpen={transferIssuesModal} />
|
||||||
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
||||||
{cycleStatus === "completed" && <TransferIssues handleClick={() => setTransferIssuesModal(true)} />}
|
{cycleStatus === "completed" && (
|
||||||
|
<TransferIssues
|
||||||
|
handleClick={() => setTransferIssuesModal(true)}
|
||||||
|
disabled={!isEmpty(cycleDetails?.progress_snapshot) ?? false}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<CycleAppliedFiltersRoot />
|
<CycleAppliedFiltersRoot />
|
||||||
|
|
||||||
{issues?.groupedIssueIds?.length === 0 ? (
|
{issues?.groupedIssueIds?.length === 0 ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user