mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix some build errors due to type changes
This commit is contained in:
parent
026bc9318f
commit
63b850f92f
2
packages/types/src/issues/issue.d.ts
vendored
2
packages/types/src/issues/issue.d.ts
vendored
@ -24,7 +24,7 @@ export type TBaseIssue = {
|
||||
project_id: string | null;
|
||||
parent_id: string | null;
|
||||
cycle_id: string | null;
|
||||
module_ids: string[];
|
||||
module_ids: string[] | null;
|
||||
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
@ -7,7 +7,7 @@ type TIssuePriorities = "urgent" | "high" | "medium" | "low" | "none";
|
||||
interface IPriorityIcon {
|
||||
className?: string;
|
||||
containerClassName?: string;
|
||||
priority: TIssuePriorities;
|
||||
priority: TIssuePriorities | undefined | null;
|
||||
size?: number;
|
||||
withContainer?: boolean;
|
||||
}
|
||||
@ -31,7 +31,7 @@ export const PriorityIcon: React.FC<IPriorityIcon> = (props) => {
|
||||
low: SignalLow,
|
||||
none: Ban,
|
||||
};
|
||||
const Icon = icons[priority];
|
||||
const Icon = icons[priority ?? "none"];
|
||||
|
||||
if (!Icon) return null;
|
||||
|
||||
@ -41,7 +41,7 @@ export const PriorityIcon: React.FC<IPriorityIcon> = (props) => {
|
||||
<div
|
||||
className={cn(
|
||||
"grid place-items-center border rounded p-0.5 flex-shrink-0",
|
||||
priorityClasses[priority],
|
||||
priorityClasses[priority ?? "none"],
|
||||
containerClassName
|
||||
)}
|
||||
>
|
||||
|
@ -25,7 +25,7 @@ export const AssignedUpcomingIssueListItem: React.FC<IssueListItemProps> = obser
|
||||
// derived values
|
||||
const issueDetails = getIssueById(issueId) as TWidgetIssue | undefined;
|
||||
|
||||
if (!issueDetails) return null;
|
||||
if (!issueDetails || !issueDetails.project_id) return null;
|
||||
|
||||
const projectDetails = getProjectById(issueDetails.project_id);
|
||||
|
||||
@ -75,7 +75,7 @@ export const AssignedOverdueIssueListItem: React.FC<IssueListItemProps> = observ
|
||||
// derived values
|
||||
const issueDetails = getIssueById(issueId) as TWidgetIssue | undefined;
|
||||
|
||||
if (!issueDetails) return null;
|
||||
if (!issueDetails || !issueDetails.project_id) return null;
|
||||
|
||||
const projectDetails = getProjectById(issueDetails.project_id);
|
||||
const blockedByIssues = issueDetails.issue_relation?.filter((issue) => issue.relation_type === "blocked_by") ?? [];
|
||||
@ -122,7 +122,7 @@ export const AssignedCompletedIssueListItem: React.FC<IssueListItemProps> = obse
|
||||
// derived values
|
||||
const issueDetails = getIssueById(issueId);
|
||||
|
||||
if (!issueDetails) return null;
|
||||
if (!issueDetails || !issueDetails.project_id) return null;
|
||||
|
||||
const projectDetails = getProjectById(issueDetails.project_id);
|
||||
|
||||
@ -154,7 +154,7 @@ export const CreatedUpcomingIssueListItem: React.FC<IssueListItemProps> = observ
|
||||
// derived values
|
||||
const issue = getIssueById(issueId);
|
||||
|
||||
if (!issue) return null;
|
||||
if (!issue || !issue.project_id) return null;
|
||||
|
||||
const projectDetails = getProjectById(issue.project_id);
|
||||
|
||||
@ -208,7 +208,7 @@ export const CreatedOverdueIssueListItem: React.FC<IssueListItemProps> = observe
|
||||
// derived values
|
||||
const issue = getIssueById(issueId);
|
||||
|
||||
if (!issue) return null;
|
||||
if (!issue || !issue.project_id) return null;
|
||||
|
||||
const projectDetails = getProjectById(issue.project_id);
|
||||
|
||||
@ -260,7 +260,7 @@ export const CreatedCompletedIssueListItem: React.FC<IssueListItemProps> = obser
|
||||
// derived values
|
||||
const issue = getIssueById(issueId);
|
||||
|
||||
if (!issue) return null;
|
||||
if (!issue || !issue.project_id) return null;
|
||||
|
||||
const projectDetails = getProjectById(issue.project_id);
|
||||
|
||||
|
@ -35,7 +35,7 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
||||
const { setPeekIssue } = useIssueDetail();
|
||||
|
||||
const handleIssuePeekOverview = (issue: TIssue) =>
|
||||
setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id });
|
||||
issue.project_id && setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id });
|
||||
|
||||
const filterParams = getRedirectionFilters(tab);
|
||||
|
||||
|
@ -24,7 +24,7 @@ type Props = TDropdownProps & {
|
||||
dropdownArrowClassName?: string;
|
||||
onChange: (val: string | null) => void;
|
||||
onClose?: () => void;
|
||||
projectId: string;
|
||||
projectId: string | undefined;
|
||||
value: string | null;
|
||||
};
|
||||
|
||||
@ -142,7 +142,7 @@ export const CycleDropdown: React.FC<Props> = observer((props) => {
|
||||
</button>
|
||||
)}
|
||||
</Combobox.Button>
|
||||
{isOpen && (
|
||||
{isOpen && projectId && (
|
||||
<CycleOptions isOpen={isOpen} projectId={projectId} placement={placement} referenceElement={referenceElement} />
|
||||
)}
|
||||
</Combobox>
|
||||
|
@ -23,7 +23,7 @@ type Props = TDropdownProps & {
|
||||
dropdownArrowClassName?: string;
|
||||
onChange: (val: number | null) => void;
|
||||
onClose?: () => void;
|
||||
projectId: string;
|
||||
projectId: string | undefined;
|
||||
value: number | null;
|
||||
};
|
||||
|
||||
@ -107,10 +107,10 @@ export const EstimateDropdown: React.FC<Props> = observer((props) => {
|
||||
const filteredOptions =
|
||||
query === "" ? options : options?.filter((o) => o.query.toLowerCase().includes(query.toLowerCase()));
|
||||
|
||||
const selectedEstimate = value !== null ? getEstimatePointValue(value, projectId) : null;
|
||||
const selectedEstimate = value !== null && projectId ? getEstimatePointValue(value, projectId) : null;
|
||||
|
||||
const onOpen = () => {
|
||||
if (!activeEstimate && workspaceSlug) fetchProjectEstimates(workspaceSlug, projectId);
|
||||
if (!activeEstimate && workspaceSlug && projectId) fetchProjectEstimates(workspaceSlug, projectId);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
|
@ -22,7 +22,7 @@ type Props = TDropdownProps & {
|
||||
button?: ReactNode;
|
||||
dropdownArrow?: boolean;
|
||||
dropdownArrowClassName?: string;
|
||||
projectId: string;
|
||||
projectId: string | undefined;
|
||||
showCount?: boolean;
|
||||
onClose?: () => void;
|
||||
} & (
|
||||
@ -272,7 +272,7 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
|
||||
</button>
|
||||
)}
|
||||
</Combobox.Button>
|
||||
{isOpen && (
|
||||
{isOpen && projectId && (
|
||||
<ModuleOptions
|
||||
isOpen={isOpen}
|
||||
projectId={projectId}
|
||||
|
@ -24,7 +24,7 @@ type Props = TDropdownProps & {
|
||||
highlightUrgent?: boolean;
|
||||
onChange: (val: TIssuePriorities) => void;
|
||||
onClose?: () => void;
|
||||
value: TIssuePriorities;
|
||||
value: TIssuePriorities | undefined | null;
|
||||
};
|
||||
|
||||
type ButtonProps = {
|
||||
@ -35,7 +35,7 @@ type ButtonProps = {
|
||||
hideText?: boolean;
|
||||
isActive?: boolean;
|
||||
highlightUrgent: boolean;
|
||||
priority: TIssuePriorities;
|
||||
priority: TIssuePriorities | undefined;
|
||||
showTooltip: boolean;
|
||||
};
|
||||
|
||||
@ -66,7 +66,7 @@ const BorderButton = (props: ButtonProps) => {
|
||||
<div
|
||||
className={cn(
|
||||
"h-full flex items-center gap-1.5 border-[0.5px] rounded text-xs px-2 py-0.5",
|
||||
priorityClasses[priority],
|
||||
priorityClasses[priority || "none"],
|
||||
{
|
||||
// compact the icons if text is hidden
|
||||
"px-0.5": hideText,
|
||||
@ -135,7 +135,7 @@ const BackgroundButton = (props: ButtonProps) => {
|
||||
<div
|
||||
className={cn(
|
||||
"h-full flex items-center gap-1.5 rounded text-xs px-2 py-0.5",
|
||||
priorityClasses[priority],
|
||||
priorityClasses[priority || "none"],
|
||||
{
|
||||
// compact the icons if text is hidden
|
||||
"px-0.5": hideText,
|
||||
@ -205,7 +205,7 @@ const TransparentButton = (props: ButtonProps) => {
|
||||
<div
|
||||
className={cn(
|
||||
"h-full flex items-center gap-1.5 rounded text-xs px-2 py-0.5 hover:bg-custom-background-80",
|
||||
priorityClasses[priority],
|
||||
priorityClasses[priority || "none"],
|
||||
{
|
||||
// compact the icons if text is hidden
|
||||
"px-0.5": hideText,
|
||||
@ -393,7 +393,7 @@ export const PriorityDropdown: React.FC<Props> = (props) => {
|
||||
onClick={handleOnClick}
|
||||
>
|
||||
<ButtonToRender
|
||||
priority={value}
|
||||
priority={value ?? undefined}
|
||||
className={cn(buttonClassName, {
|
||||
"text-white": resolvedTheme === "dark",
|
||||
})}
|
||||
|
@ -24,8 +24,8 @@ type Props = TDropdownProps & {
|
||||
dropdownArrowClassName?: string;
|
||||
onChange: (val: string) => void;
|
||||
onClose?: () => void;
|
||||
projectId: string;
|
||||
value: string;
|
||||
projectId: string | undefined;
|
||||
value: string | undefined | null;
|
||||
};
|
||||
|
||||
export const StateDropdown: React.FC<Props> = observer((props) => {
|
||||
@ -92,7 +92,7 @@ export const StateDropdown: React.FC<Props> = observer((props) => {
|
||||
const selectedState = getStateById(value);
|
||||
|
||||
const onOpen = () => {
|
||||
if (!statesList && workspaceSlug) fetchProjectStates(workspaceSlug, projectId);
|
||||
if (!statesList && workspaceSlug && projectId) fetchProjectStates(workspaceSlug, projectId);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
|
@ -73,7 +73,7 @@ export const DeleteInboxIssueModal: React.FC<Props> = observer(({ isOpen, onClos
|
||||
<p className="text-sm text-custom-text-200">
|
||||
Are you sure you want to delete issue{" "}
|
||||
<span className="break-words font-medium text-custom-text-100">
|
||||
{getProjectById(data?.project_id)?.identifier}-{data?.sequence_id}
|
||||
{getProjectById(data?.project_id ?? "")?.identifier}-{data?.sequence_id}
|
||||
</span>
|
||||
{""}? The issue will only be deleted from the inbox and this action cannot be undone.
|
||||
</p>
|
||||
|
@ -126,7 +126,7 @@ export const SelectDuplicateInboxIssueModal: React.FC<Props> = (props) => {
|
||||
<ul className="text-sm text-custom-text-100">
|
||||
{filteredIssues.map((issue) => {
|
||||
const stateColor =
|
||||
getProjectStates(issue?.project_id)?.find((state) => state?.id == issue?.state_id)
|
||||
getProjectStates(issue?.project_id ?? "")?.find((state) => state?.id == issue?.state_id)
|
||||
?.color || "";
|
||||
|
||||
return (
|
||||
|
@ -84,7 +84,7 @@ export const InboxIssueListItem: FC<TInboxIssueListItem> = observer((props) => {
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Tooltip tooltipHeading="Priority" tooltipContent={`${issue.priority ?? "None"}`}>
|
||||
<PriorityIcon priority={issue.priority ?? null} className="h-3.5 w-3.5" />
|
||||
<PriorityIcon priority={issue.priority} className="h-3.5 w-3.5" />
|
||||
</Tooltip>
|
||||
<Tooltip tooltipHeading="Created on" tooltipContent={`${renderFormattedDate(issue.created_at ?? "")}`}>
|
||||
<div className="flex items-center gap-1 rounded border border-custom-border-200 px-2 py-[0.19rem] text-xs text-custom-text-200 shadow-sm">
|
||||
|
@ -46,7 +46,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {
|
||||
}, [isSubmitting, setShowAlert, setIsSubmitting]);
|
||||
|
||||
const issue = issueId ? getIssueById(issueId) : undefined;
|
||||
if (!issue) return <></>;
|
||||
if (!issue || !issue.project_id) return <></>;
|
||||
|
||||
const currentIssueState = projectStates?.find((s) => s.id === issue.state_id);
|
||||
|
||||
|
@ -48,7 +48,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
||||
}, [isSubmitting, setShowAlert, setIsSubmitting]);
|
||||
|
||||
const issue = issueId ? getIssueById(issueId) : undefined;
|
||||
if (!issue) return <></>;
|
||||
if (!issue || !issue.project_id) return <></>;
|
||||
|
||||
const currentIssueState = projectStates?.find((s) => s.id === issue.state_id);
|
||||
|
||||
|
@ -26,7 +26,7 @@ export const IssueParentSiblings: FC<TIssueParentSiblings> = (props) => {
|
||||
? `ISSUE_PARENT_CHILD_ISSUES_${peekIssue?.workspaceSlug}_${parentIssue.project_id}_${parentIssue.id}`
|
||||
: null,
|
||||
peekIssue && parentIssue && parentIssue.project_id
|
||||
? () => fetchSubIssues(peekIssue?.workspaceSlug, parentIssue.project_id, parentIssue.id)
|
||||
? () => fetchSubIssues(peekIssue?.workspaceSlug, parentIssue.project_id!, parentIssue.id)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -30,6 +30,7 @@ export const IssueGanttBlock: React.FC<Props> = observer((props) => {
|
||||
workspaceSlug &&
|
||||
issueDetails &&
|
||||
!issueDetails.tempId &&
|
||||
issueDetails.project_id &&
|
||||
setPeekIssue({ workspaceSlug, projectId: issueDetails.project_id, issueId: issueDetails.id });
|
||||
|
||||
return (
|
||||
@ -82,6 +83,7 @@ export const IssueGanttSidebarBlock: React.FC<Props> = observer((props) => {
|
||||
const handleIssuePeekOverview = () =>
|
||||
workspaceSlug &&
|
||||
issueDetails &&
|
||||
issueDetails.project_id &&
|
||||
setPeekIssue({ workspaceSlug, projectId: issueDetails.project_id, issueId: issueDetails.id });
|
||||
|
||||
return (
|
||||
|
@ -118,7 +118,7 @@ export const KanbanIssueBlock: React.FC<IssueBlockProps> = memo((props) => {
|
||||
|
||||
if (!issue) return null;
|
||||
|
||||
const canEditIssueProperties = canEditProperties(issue.project_id);
|
||||
const canEditIssueProperties = canEditProperties(issue.project_id ?? undefined);
|
||||
|
||||
return (
|
||||
<Draggable
|
||||
|
@ -39,7 +39,7 @@ export const IssueBlock: React.FC<IssueBlockProps> = observer((props: IssueBlock
|
||||
|
||||
if (!issue) return null;
|
||||
|
||||
const canEditIssueProperties = canEditProperties(issue.project_id);
|
||||
const canEditIssueProperties = canEditProperties(issue.project_id ?? undefined);
|
||||
const projectIdentifier = getProjectIdentifierById(issue.project_id);
|
||||
|
||||
return (
|
||||
|
@ -30,7 +30,9 @@ import { WithDisplayPropertiesHOC } from "../properties/with-display-properties-
|
||||
|
||||
export interface IIssueProperties {
|
||||
issue: TIssue;
|
||||
updateIssue: ((projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>) | undefined;
|
||||
updateIssue:
|
||||
| ((projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => Promise<void>)
|
||||
| undefined;
|
||||
displayProperties: IIssueDisplayProperties | undefined;
|
||||
isReadOnly: boolean;
|
||||
className: string;
|
||||
@ -236,7 +238,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
|
||||
});
|
||||
};
|
||||
|
||||
if (!displayProperties) return null;
|
||||
if (!displayProperties || !issue.project_id) return null;
|
||||
|
||||
const defaultLabelOptions = issue?.label_ids?.map((id) => labelMap[id]) || [];
|
||||
|
||||
@ -267,7 +269,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
|
||||
<WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="priority">
|
||||
<div className="h-5">
|
||||
<PriorityDropdown
|
||||
value={issue?.priority || null}
|
||||
value={issue?.priority}
|
||||
onChange={handlePriority}
|
||||
disabled={isReadOnly}
|
||||
buttonVariant="border-without-text"
|
||||
|
@ -29,7 +29,7 @@ export const SpreadsheetAssigneeColumn: React.FC<Props> = observer((props: Props
|
||||
}
|
||||
);
|
||||
}}
|
||||
projectId={issue?.project_id}
|
||||
projectId={issue?.project_id ?? undefined}
|
||||
disabled={disabled}
|
||||
multiple
|
||||
placeholder="Assignees"
|
||||
|
@ -30,7 +30,7 @@ export const SpreadsheetCycleColumn: React.FC<Props> = observer((props) => {
|
||||
|
||||
const handleCycle = useCallback(
|
||||
async (cycleId: string | null) => {
|
||||
if (!workspaceSlug || !issue || issue.cycle_id === cycleId) return;
|
||||
if (!workspaceSlug || !issue || !issue.project_id || issue.cycle_id === cycleId) return;
|
||||
if (cycleId) await addIssueToCycle(workspaceSlug.toString(), issue.project_id, cycleId, [issue.id]);
|
||||
else await removeIssueFromCycle(workspaceSlug.toString(), issue.project_id, issue.cycle_id ?? "", issue.id);
|
||||
captureIssueEvent({
|
||||
@ -50,7 +50,7 @@ export const SpreadsheetCycleColumn: React.FC<Props> = observer((props) => {
|
||||
return (
|
||||
<div className="h-11 border-b-[0.5px] border-custom-border-200">
|
||||
<CycleDropdown
|
||||
projectId={issue.project_id}
|
||||
projectId={issue.project_id ?? undefined}
|
||||
value={issue.cycle_id}
|
||||
onChange={handleCycle}
|
||||
disabled={disabled}
|
||||
|
@ -39,9 +39,9 @@ export const SpreadsheetModuleColumn: React.FC<Props> = observer((props) => {
|
||||
for (const moduleId of updatedModuleIds)
|
||||
if (issue.module_ids.includes(moduleId)) modulesToRemove.push(moduleId);
|
||||
else modulesToAdd.push(moduleId);
|
||||
if (modulesToAdd.length > 0)
|
||||
if (issue.project_id && modulesToAdd.length > 0)
|
||||
addModulesToIssue(workspaceSlug.toString(), issue.project_id, issue.id, modulesToAdd);
|
||||
if (modulesToRemove.length > 0)
|
||||
if (issue.project_id && modulesToRemove.length > 0)
|
||||
removeModulesFromIssue(workspaceSlug.toString(), issue.project_id, issue.id, modulesToRemove);
|
||||
|
||||
captureIssueEvent({
|
||||
@ -61,7 +61,7 @@ export const SpreadsheetModuleColumn: React.FC<Props> = observer((props) => {
|
||||
return (
|
||||
<div className="h-11 border-b-[0.5px] border-custom-border-200">
|
||||
<ModuleDropdown
|
||||
projectId={issue?.project_id}
|
||||
projectId={issue?.project_id ?? undefined}
|
||||
value={issue?.module_ids ?? []}
|
||||
onChange={handleModule}
|
||||
disabled={disabled}
|
||||
|
@ -18,7 +18,7 @@ export const SpreadsheetStateColumn: React.FC<Props> = observer((props) => {
|
||||
return (
|
||||
<div className="h-11 border-b-[0.5px] border-custom-border-200">
|
||||
<StateDropdown
|
||||
projectId={issue.project_id}
|
||||
projectId={issue.project_id ?? undefined}
|
||||
value={issue.state_id}
|
||||
onChange={(data) => onChange(issue, { state_id: data }, { changed_property: "state", change_details: data })}
|
||||
disabled={disabled}
|
||||
|
@ -416,7 +416,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{envConfig?.has_openai_configured && (
|
||||
{envConfig?.has_openai_configured && projectId && (
|
||||
<GptAssistantPopover
|
||||
isOpen={gptAssistantModal}
|
||||
projectId={projectId}
|
||||
@ -486,7 +486,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
onChange(stateId);
|
||||
handleFormChange();
|
||||
}}
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
buttonVariant="border-with-text"
|
||||
tabIndex={getTabIndex("state_id")}
|
||||
/>
|
||||
@ -516,7 +516,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<div className="h-7">
|
||||
<MemberDropdown
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
value={value}
|
||||
onChange={(assigneeIds) => {
|
||||
onChange(assigneeIds);
|
||||
@ -543,7 +543,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
onChange(labelIds);
|
||||
handleFormChange();
|
||||
}}
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
tabIndex={getTabIndex("label_ids")}
|
||||
/>
|
||||
</div>
|
||||
@ -588,7 +588,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<div className="h-7">
|
||||
<CycleDropdown
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
onChange={(cycleId) => {
|
||||
onChange(cycleId);
|
||||
handleFormChange();
|
||||
@ -608,7 +608,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<div className="h-7">
|
||||
<ModuleDropdown
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
value={value ?? []}
|
||||
onChange={(moduleIds) => {
|
||||
onChange(moduleIds);
|
||||
@ -623,7 +623,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{areEstimatesEnabledForProject(projectId) && (
|
||||
{projectId && areEstimatesEnabledForProject(projectId) && (
|
||||
<Controller
|
||||
control={control}
|
||||
name="estimate_point"
|
||||
@ -635,7 +635,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
onChange(estimatePoint);
|
||||
handleFormChange();
|
||||
}}
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
buttonVariant="border-with-text"
|
||||
tabIndex={getTabIndex("estimate_point")}
|
||||
/>
|
||||
@ -702,7 +702,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
handleFormChange();
|
||||
setSelectedParentIssue(issue);
|
||||
}}
|
||||
projectId={projectId}
|
||||
projectId={projectId ?? undefined}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
@ -111,10 +111,10 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
|
||||
}, [data, projectId, workspaceProjectIds, isOpen, activeProjectId]);
|
||||
|
||||
const addIssueToCycle = async (issue: TIssue, cycleId: string) => {
|
||||
if (!workspaceSlug || !activeProjectId) return;
|
||||
if (!workspaceSlug || !issue.project_id) return;
|
||||
|
||||
await cycleIssues.addIssueToCycle(workspaceSlug, issue.project_id, cycleId, [issue.id]);
|
||||
fetchCycleDetails(workspaceSlug, activeProjectId, cycleId);
|
||||
fetchCycleDetails(workspaceSlug, issue.project_id, cycleId);
|
||||
};
|
||||
|
||||
const addIssueToModule = async (issue: TIssue, moduleIds: string[]) => {
|
||||
|
@ -18,7 +18,7 @@ type Props = {
|
||||
handleClose: () => void;
|
||||
value?: any;
|
||||
onChange: (issue: ISearchIssueResponse) => void;
|
||||
projectId: string;
|
||||
projectId: string | undefined;
|
||||
issueId?: string;
|
||||
};
|
||||
|
||||
|
@ -43,9 +43,9 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(
|
||||
}, [isSubmitting, setShowAlert, setIsSubmitting]);
|
||||
|
||||
const issue = issueId ? getIssueById(issueId) : undefined;
|
||||
if (!issue) return <></>;
|
||||
if (!issue || !issue.project_id) return <></>;
|
||||
|
||||
const projectDetails = getProjectById(issue?.project_id);
|
||||
const projectDetails = getProjectById(issue.project_id);
|
||||
|
||||
const issueDescription =
|
||||
issue.description_html !== undefined || issue.description_html !== null
|
||||
|
@ -16,7 +16,7 @@ type Props = {
|
||||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
value: string[];
|
||||
onChange: (value: string[]) => void;
|
||||
projectId: string;
|
||||
projectId: string | undefined;
|
||||
label?: JSX.Element;
|
||||
disabled?: boolean;
|
||||
tabIndex?: number;
|
||||
|
@ -176,6 +176,7 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
||||
<div
|
||||
className="invisible flex h-[22px] w-[22px] flex-shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-sm transition-all hover:bg-custom-background-80 group-hover:visible"
|
||||
onClick={() => {
|
||||
issue.project_id &&
|
||||
subIssueOperations.removeSubIssue(workspaceSlug, issue.project_id, parentIssueId, issue.id);
|
||||
}}
|
||||
>
|
||||
@ -187,7 +188,10 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{subIssueHelpers.issue_visibility.includes(issueId) && issue.sub_issues_count && issue.sub_issues_count > 0 && (
|
||||
{subIssueHelpers.issue_visibility.includes(issueId) &&
|
||||
issue.sub_issues_count &&
|
||||
issue.project_id &&
|
||||
issue.sub_issues_count > 0 && (
|
||||
<IssueList
|
||||
workspaceSlug={workspaceSlug}
|
||||
projectId={issue.project_id}
|
||||
|
@ -29,8 +29,9 @@ export const IssueProperty: React.FC<IIssueProperty> = (props) => {
|
||||
<div className="h-5 flex-shrink-0">
|
||||
<StateDropdown
|
||||
value={issue.state_id}
|
||||
projectId={issue.project_id}
|
||||
projectId={issue.project_id ?? undefined}
|
||||
onChange={(val) =>
|
||||
issue.project_id &&
|
||||
subIssueOperations.updateSubIssue(
|
||||
workspaceSlug,
|
||||
issue.project_id,
|
||||
@ -51,6 +52,7 @@ export const IssueProperty: React.FC<IIssueProperty> = (props) => {
|
||||
<PriorityDropdown
|
||||
value={issue.priority}
|
||||
onChange={(val) =>
|
||||
issue.project_id &&
|
||||
subIssueOperations.updateSubIssue(workspaceSlug, issue.project_id, parentIssueId, issueId, {
|
||||
priority: val,
|
||||
})
|
||||
@ -64,8 +66,9 @@ export const IssueProperty: React.FC<IIssueProperty> = (props) => {
|
||||
<div className="h-5 flex-shrink-0">
|
||||
<MemberDropdown
|
||||
value={issue.assignee_ids}
|
||||
projectId={issue.project_id}
|
||||
projectId={issue.project_id ?? undefined}
|
||||
onChange={(val) =>
|
||||
issue.project_id &&
|
||||
subIssueOperations.updateSubIssue(workspaceSlug, issue.project_id, parentIssueId, issueId, {
|
||||
assignee_ids: val,
|
||||
})
|
||||
|
@ -19,12 +19,12 @@ interface IssueActions {
|
||||
userViewId?: "assigned" | "created" | "subscribed"
|
||||
) => Promise<TIssuesResponse | undefined>;
|
||||
fetchNextIssues: () => Promise<TIssuesResponse | undefined>;
|
||||
removeIssue: (projectId: string, issueId: string) => Promise<void>;
|
||||
createIssue?: (projectId: string, data: Partial<TIssue>) => Promise<TIssue | undefined>;
|
||||
updateIssue?: (projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;
|
||||
removeIssueFromView?: (projectId: string, issueId: string) => Promise<void>;
|
||||
archiveIssue?: (projectId: string, issueId: string) => Promise<void>;
|
||||
restoreIssue?: (projectId: string, issueId: string) => Promise<void>;
|
||||
removeIssue: (projectId: string | undefined | null, issueId: string) => Promise<void>;
|
||||
createIssue?: (projectId: string | undefined | null, data: Partial<TIssue>) => Promise<TIssue | undefined>;
|
||||
updateIssue?: (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => Promise<void>;
|
||||
removeIssueFromView?: (projectId: string | undefined | null, issueId: string) => Promise<void>;
|
||||
archiveIssue?: (projectId: string | undefined | null, issueId: string) => Promise<void>;
|
||||
restoreIssue?: (projectId: string | undefined | null, issueId: string) => Promise<void>;
|
||||
updateFilters: (
|
||||
projectId: string,
|
||||
filterType: EIssueFilterType,
|
||||
@ -83,29 +83,29 @@ const useProjectIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, projectId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data);
|
||||
},
|
||||
[issues.createIssue, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
);
|
||||
const archiveIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.archiveIssue, workspaceSlug]
|
||||
@ -157,36 +157,36 @@ const useCycleIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, projectId, cycleId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!cycleId || !workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!cycleId || !workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data, cycleId);
|
||||
},
|
||||
[issues.createIssue, cycleId, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssueFromView = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!cycleId || !workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!cycleId || !workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
||||
},
|
||||
[issues.removeIssueFromCycle, cycleId, workspaceSlug]
|
||||
);
|
||||
const archiveIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.archiveIssue, workspaceSlug]
|
||||
@ -248,36 +248,36 @@ const useModuleIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, projectId, moduleId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!moduleId || !workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!moduleId || !workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data, moduleId);
|
||||
},
|
||||
[issues.createIssue, moduleId, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssueFromView = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!moduleId || !workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!moduleId || !workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssueFromModule(workspaceSlug, projectId, moduleId, issueId);
|
||||
},
|
||||
[issues.removeIssueFromModule, moduleId, workspaceSlug]
|
||||
);
|
||||
const archiveIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.archiveIssue, moduleId, workspaceSlug]
|
||||
@ -330,29 +330,29 @@ const useProfileIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, userId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data);
|
||||
},
|
||||
[issues.createIssue, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
);
|
||||
const archiveIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.archiveIssue, workspaceSlug]
|
||||
@ -404,29 +404,29 @@ const useProjectViewIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, projectId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data);
|
||||
},
|
||||
[issues.createIssue, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
);
|
||||
const archiveIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.archiveIssue, workspaceSlug]
|
||||
@ -478,22 +478,22 @@ const useDraftIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, projectId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data);
|
||||
},
|
||||
[issues.createIssue, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
@ -544,15 +544,15 @@ const useArchivedIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, projectId]);
|
||||
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue]
|
||||
);
|
||||
const restoreIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.restoreIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.restoreIssue]
|
||||
@ -601,22 +601,22 @@ const useGlobalIssueActions = () => {
|
||||
}, [issues.fetchIssues, workspaceSlug, globalViewId]);
|
||||
|
||||
const createIssue = useCallback(
|
||||
async (projectId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.createIssue(workspaceSlug, projectId, data);
|
||||
},
|
||||
[issues.createIssue, workspaceSlug]
|
||||
);
|
||||
const updateIssue = useCallback(
|
||||
async (projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string, data: Partial<TIssue>) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.updateIssue(workspaceSlug, projectId, issueId, data);
|
||||
},
|
||||
[issues.updateIssue, workspaceSlug]
|
||||
);
|
||||
const removeIssue = useCallback(
|
||||
async (projectId: string, issueId: string) => {
|
||||
if (!workspaceSlug) return;
|
||||
async (projectId: string | undefined | null, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
return await issues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
},
|
||||
[issues.removeIssue, workspaceSlug]
|
||||
|
@ -50,7 +50,7 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => {
|
||||
|
||||
// derived values
|
||||
const issue = archivedIssueId ? getIssueById(archivedIssueId.toString()) : undefined;
|
||||
const project = issue ? getProjectById(issue?.project_id) : undefined;
|
||||
const project = issue ? getProjectById(issue?.project_id ?? "") : undefined;
|
||||
const pageTitle = project && issue ? `${project?.identifier}-${issue?.sequence_id} ${issue?.name}` : undefined;
|
||||
// auth
|
||||
const canRestoreIssue = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||
@ -68,11 +68,9 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => {
|
||||
type: TOAST_TYPE.SUCCESS,
|
||||
title: "Success",
|
||||
message:
|
||||
issue &&
|
||||
`${getProjectById(issue.project_id)
|
||||
?.identifier}-${issue?.sequence_id} is restored successfully under the project ${getProjectById(
|
||||
issue.project_id
|
||||
)?.name}`,
|
||||
issue && project
|
||||
? `${project.identifier}-${issue.sequence_id} is restored successfully under the project ${project.name}`
|
||||
: `issue is restored successfully`,
|
||||
});
|
||||
router.push(`/${workspaceSlug}/projects/${projectId}/issues/${archivedIssueId}`);
|
||||
})
|
||||
|
@ -20,7 +20,7 @@ export interface IEstimateStore {
|
||||
areEstimatesEnabledForProject: (projectId: string) => boolean;
|
||||
getEstimatePointValue: (estimateKey: number | null, projectId: string | null) => string;
|
||||
getProjectEstimateById: (estimateId: string) => IEstimate | null;
|
||||
getProjectActiveEstimateDetails: (projectId: string) => IEstimate | null;
|
||||
getProjectActiveEstimateDetails: (projectId: string | undefined | null) => IEstimate | null;
|
||||
// fetch actions
|
||||
fetchProjectEstimates: (workspaceSlug: string, projectId: string) => Promise<IEstimate[]>;
|
||||
fetchWorkspaceEstimates: (workspaceSlug: string) => Promise<IEstimate[]>;
|
||||
@ -129,10 +129,15 @@ export class EstimateStore implements IEstimateStore {
|
||||
* @description returns the estimate details for the given estimate id
|
||||
* @param projectId
|
||||
*/
|
||||
getProjectActiveEstimateDetails = computedFn((projectId: string) => {
|
||||
getProjectActiveEstimateDetails = computedFn((projectId: string | undefined | null) => {
|
||||
const projectDetails = this.rootStore.projectRoot.project?.getProjectById(projectId);
|
||||
const worksapceSlug = this.rootStore.app.router.workspaceSlug || "";
|
||||
if (!projectDetails || !projectDetails?.estimate || !(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug]))
|
||||
if (
|
||||
!projectId ||
|
||||
!projectDetails ||
|
||||
!projectDetails?.estimate ||
|
||||
!(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug])
|
||||
)
|
||||
return null;
|
||||
return this.estimateMap?.[projectDetails?.estimate || ""] || null;
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ export interface ILabelStore {
|
||||
projectLabelsTree: IIssueLabelTree[] | undefined;
|
||||
workspaceLabels: IIssueLabel[] | undefined;
|
||||
//computed actions
|
||||
getProjectLabels: (projectId: string | null) => IIssueLabel[] | undefined;
|
||||
getProjectLabels: (projectId: string | undefined | null) => IIssueLabel[] | undefined;
|
||||
getLabelById: (labelId: string) => IIssueLabel | null;
|
||||
// fetch actions
|
||||
fetchWorkspaceLabels: (workspaceSlug: string) => Promise<IIssueLabel[]>;
|
||||
@ -110,9 +110,9 @@ export class LabelStore implements ILabelStore {
|
||||
return buildTree(this.projectLabels);
|
||||
}
|
||||
|
||||
getProjectLabels = computedFn((projectId: string | null) => {
|
||||
const worksapceSlug = this.rootStore.app.router.workspaceSlug || "";
|
||||
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug])) return;
|
||||
getProjectLabels = computedFn((projectId: string | undefined | null) => {
|
||||
const workspaceSlug = this.rootStore.app.router.workspaceSlug || "";
|
||||
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[workspaceSlug])) return;
|
||||
return sortBy(
|
||||
Object.values(this.labelMap).filter((label) => label.project_id === projectId),
|
||||
"sort_order"
|
||||
|
@ -23,8 +23,8 @@ export interface IProjectStore {
|
||||
currentProjectDetails: IProject | undefined;
|
||||
// actions
|
||||
setSearchQuery: (query: string) => void;
|
||||
getProjectById: (projectId: string) => IProject | null;
|
||||
getProjectIdentifierById: (projectId: string) => string;
|
||||
getProjectById: (projectId: string | undefined | null) => IProject | undefined;
|
||||
getProjectIdentifierById: (projectId: string | undefined | null) => string;
|
||||
// fetch actions
|
||||
fetchProjects: (workspaceSlug: string) => Promise<IProject[]>;
|
||||
fetchProjectDetails: (workspaceSlug: string, projectId: string) => Promise<any>;
|
||||
@ -206,8 +206,8 @@ export class ProjectStore implements IProjectStore {
|
||||
* @param projectId
|
||||
* @returns IProject | null
|
||||
*/
|
||||
getProjectById = computedFn((projectId: string) => {
|
||||
const projectInfo = this.projectMap[projectId] || null;
|
||||
getProjectById = computedFn((projectId: string | undefined | null) => {
|
||||
const projectInfo = this.projectMap[projectId ?? ""] || undefined;
|
||||
return projectInfo;
|
||||
});
|
||||
|
||||
@ -216,8 +216,8 @@ export class ProjectStore implements IProjectStore {
|
||||
* @param projectId
|
||||
* @returns string
|
||||
*/
|
||||
getProjectIdentifierById = computedFn((projectId: string) => {
|
||||
const projectInfo = this.projectMap?.[projectId];
|
||||
getProjectIdentifierById = computedFn((projectId: string | undefined | null) => {
|
||||
const projectInfo = this.projectMap?.[projectId ?? ""];
|
||||
return projectInfo?.identifier;
|
||||
});
|
||||
|
||||
|
@ -21,8 +21,8 @@ export interface IStateStore {
|
||||
projectStates: IState[] | undefined;
|
||||
groupedProjectStates: Record<string, IState[]> | undefined;
|
||||
// computed actions
|
||||
getStateById: (stateId: string) => IState | undefined;
|
||||
getProjectStates: (projectId: string) => IState[] | undefined;
|
||||
getStateById: (stateId: string | null | undefined) => IState | undefined;
|
||||
getProjectStates: (projectId: string | null | undefined) => IState[] | undefined;
|
||||
// fetch actions
|
||||
fetchProjectStates: (workspaceSlug: string, projectId: string) => Promise<IState[]>;
|
||||
fetchWorkspaceStates: (workspaceSlug: string) => Promise<IState[]>;
|
||||
@ -105,8 +105,8 @@ export class StateStore implements IStateStore {
|
||||
* @description returns state details using state id
|
||||
* @param stateId
|
||||
*/
|
||||
getStateById = computedFn((stateId: string) => {
|
||||
if (!this.stateMap) return;
|
||||
getStateById = computedFn((stateId: string | null | undefined) => {
|
||||
if (!this.stateMap || !stateId) return;
|
||||
return this.stateMap[stateId] ?? undefined;
|
||||
});
|
||||
|
||||
@ -115,7 +115,7 @@ export class StateStore implements IStateStore {
|
||||
* @param projectId
|
||||
* @returns IState[]
|
||||
*/
|
||||
getProjectStates = computedFn((projectId: string) => {
|
||||
getProjectStates = computedFn((projectId: string | null | undefined) => {
|
||||
const workspaceSlug = this.router.workspaceSlug || "";
|
||||
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[workspaceSlug])) return;
|
||||
return sortStates(Object.values(this.stateMap).filter((state) => state.project_id === projectId));
|
||||
|
Loading…
Reference in New Issue
Block a user