mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: issue with peek view properties not editable and options not being shown in all workspace issues
. (#3100)
* fix: issue with peek view properties not editable and options not being shown in `all workspace issues`.. * refactor: use projectId from props instead of router query. fix: issue in add to module/ cycle not working properly.
This commit is contained in:
parent
18c86bd8cc
commit
37df0bcdd8
@ -47,7 +47,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
} = useMobxStore();
|
} = useMobxStore();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, peekProjectId: projectId } = router.query;
|
||||||
|
|
||||||
const handleState = (_state: string) => {
|
const handleState = (_state: string) => {
|
||||||
issueUpdate({ ...issue, state: _state });
|
issueUpdate({ ...issue, state: _state });
|
||||||
@ -116,7 +116,12 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
<p>State</p>
|
<p>State</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<SidebarStateSelect value={issue?.state || ""} onChange={handleState} disabled={disableUserActions} />
|
<SidebarStateSelect
|
||||||
|
value={issue?.state || ""}
|
||||||
|
projectId={projectId as string}
|
||||||
|
onChange={handleState}
|
||||||
|
disabled={disableUserActions}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -129,6 +134,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
<div>
|
<div>
|
||||||
<SidebarAssigneeSelect
|
<SidebarAssigneeSelect
|
||||||
value={issue.assignees || []}
|
value={issue.assignees || []}
|
||||||
|
projectId={projectId as string}
|
||||||
onChange={handleAssignee}
|
onChange={handleAssignee}
|
||||||
disabled={disableUserActions}
|
disabled={disableUserActions}
|
||||||
/>
|
/>
|
||||||
@ -210,7 +216,12 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
<p>Parent</p>
|
<p>Parent</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<SidebarParentSelect onChange={handleParent} issueDetails={issue} disabled={disableUserActions} />
|
<SidebarParentSelect
|
||||||
|
onChange={handleParent}
|
||||||
|
issueDetails={issue}
|
||||||
|
projectId={projectId as string}
|
||||||
|
disabled={disableUserActions}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -226,6 +237,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
<div>
|
<div>
|
||||||
<SidebarCycleSelect
|
<SidebarCycleSelect
|
||||||
issueDetail={issue}
|
issueDetail={issue}
|
||||||
|
projectId={projectId as string}
|
||||||
disabled={disableUserActions}
|
disabled={disableUserActions}
|
||||||
handleIssueUpdate={handleCycleOrModuleChange}
|
handleIssueUpdate={handleCycleOrModuleChange}
|
||||||
/>
|
/>
|
||||||
@ -240,6 +252,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
<div>
|
<div>
|
||||||
<SidebarModuleSelect
|
<SidebarModuleSelect
|
||||||
issueDetail={issue}
|
issueDetail={issue}
|
||||||
|
projectId={projectId as string}
|
||||||
disabled={disableUserActions}
|
disabled={disableUserActions}
|
||||||
handleIssueUpdate={handleCycleOrModuleChange}
|
handleIssueUpdate={handleCycleOrModuleChange}
|
||||||
/>
|
/>
|
||||||
@ -253,6 +266,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
|
|||||||
<div className="flex w-full flex-col gap-3">
|
<div className="flex w-full flex-col gap-3">
|
||||||
<SidebarLabelSelect
|
<SidebarLabelSelect
|
||||||
issueDetails={issue}
|
issueDetails={issue}
|
||||||
|
projectId={projectId as string}
|
||||||
labelList={issue.labels}
|
labelList={issue.labels}
|
||||||
submitChanges={handleLabels}
|
submitChanges={handleLabels}
|
||||||
isNotAllowed={disableUserActions}
|
isNotAllowed={disableUserActions}
|
||||||
|
@ -31,7 +31,6 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
|||||||
const { peekIssueId } = router.query;
|
const { peekIssueId } = router.query;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
user: { currentProjectRole },
|
|
||||||
issueDetail: {
|
issueDetail: {
|
||||||
createIssueComment,
|
createIssueComment,
|
||||||
updateIssueComment,
|
updateIssueComment,
|
||||||
@ -58,6 +57,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
|||||||
},
|
},
|
||||||
archivedIssues: { deleteArchivedIssue },
|
archivedIssues: { deleteArchivedIssue },
|
||||||
project: { currentProjectDetails },
|
project: { currentProjectDetails },
|
||||||
|
workspaceMember: { currentWorkspaceUserProjectsRole },
|
||||||
} = useMobxStore();
|
} = useMobxStore();
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
@ -146,7 +146,8 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const userRole = currentProjectRole ?? EUserWorkspaceRoles.GUEST;
|
const userRole =
|
||||||
|
(currentWorkspaceUserProjectsRole && currentWorkspaceUserProjectsRole[projectId]) ?? EUserWorkspaceRoles.GUEST;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@ -10,6 +10,7 @@ import { PROJECT_MEMBERS } from "constants/fetch-keys";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: string[];
|
value: string[];
|
||||||
|
projectId: string;
|
||||||
onChange: (val: string[]) => void;
|
onChange: (val: string[]) => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
@ -17,9 +18,9 @@ type Props = {
|
|||||||
// services
|
// services
|
||||||
const projectMemberService = new ProjectMemberService();
|
const projectMemberService = new ProjectMemberService();
|
||||||
|
|
||||||
export const SidebarAssigneeSelect: React.FC<Props> = ({ value, onChange, disabled = false }) => {
|
export const SidebarAssigneeSelect: React.FC<Props> = ({ value, projectId, onChange, disabled = false }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
const { data: members } = useSWR(
|
const { data: members } = useSWR(
|
||||||
workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null,
|
workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null,
|
||||||
|
@ -14,6 +14,7 @@ import { CYCLE_ISSUES, INCOMPLETE_CYCLES_LIST, ISSUE_DETAILS } from "constants/f
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
issueDetail: IIssue | undefined;
|
issueDetail: IIssue | undefined;
|
||||||
|
projectId: string;
|
||||||
handleCycleChange?: (cycleId: string) => void;
|
handleCycleChange?: (cycleId: string) => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
handleIssueUpdate?: () => void;
|
handleIssueUpdate?: () => void;
|
||||||
@ -26,7 +27,7 @@ export const SidebarCycleSelect: React.FC<Props> = (props) => {
|
|||||||
const { issueDetail, disabled = false, handleIssueUpdate, handleCycleChange } = props;
|
const { issueDetail, disabled = false, handleIssueUpdate, handleCycleChange } = props;
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId: _projectId, peekProjectId } = router.query;
|
||||||
// mobx store
|
// mobx store
|
||||||
const {
|
const {
|
||||||
cycleIssues: { removeIssueFromCycle, addIssueToCycle },
|
cycleIssues: { removeIssueFromCycle, addIssueToCycle },
|
||||||
@ -34,6 +35,8 @@ export const SidebarCycleSelect: React.FC<Props> = (props) => {
|
|||||||
|
|
||||||
const [isUpdating, setIsUpdating] = useState(false);
|
const [isUpdating, setIsUpdating] = useState(false);
|
||||||
|
|
||||||
|
const projectId = _projectId ?? peekProjectId;
|
||||||
|
|
||||||
const { data: incompleteCycles } = useSWR(
|
const { data: incompleteCycles } = useSWR(
|
||||||
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
|
@ -18,6 +18,7 @@ import { IIssue, IIssueLabel } from "types";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
issueDetails: IIssue | undefined;
|
issueDetails: IIssue | undefined;
|
||||||
|
projectId: string;
|
||||||
labelList: string[];
|
labelList: string[];
|
||||||
submitChanges: (formData: any) => void;
|
submitChanges: (formData: any) => void;
|
||||||
isNotAllowed: boolean;
|
isNotAllowed: boolean;
|
||||||
@ -30,12 +31,12 @@ const defaultValues: Partial<IIssueLabel> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const SidebarLabelSelect: React.FC<Props> = observer((props) => {
|
export const SidebarLabelSelect: React.FC<Props> = observer((props) => {
|
||||||
const { issueDetails, labelList, submitChanges, isNotAllowed, uneditable } = props;
|
const { issueDetails, projectId, labelList, submitChanges, isNotAllowed, uneditable } = props;
|
||||||
// states
|
// states
|
||||||
const [createLabelForm, setCreateLabelForm] = useState(false);
|
const [createLabelForm, setCreateLabelForm] = useState(false);
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
// toast
|
// toast
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
// mobx store
|
// mobx store
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { mutate } from "swr";
|
import useSWR, { mutate } from "swr";
|
||||||
// mobx store
|
// mobx store
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// ui
|
// ui
|
||||||
@ -9,28 +9,40 @@ import { CustomSearchSelect, DiceIcon, Spinner, Tooltip } from "@plane/ui";
|
|||||||
// types
|
// types
|
||||||
import { IIssue } from "types";
|
import { IIssue } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { ISSUE_DETAILS, MODULE_ISSUES } from "constants/fetch-keys";
|
import { ISSUE_DETAILS, MODULE_ISSUES, MODULE_LIST } from "constants/fetch-keys";
|
||||||
|
// services
|
||||||
|
import { ModuleService } from "services/module.service";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
issueDetail: IIssue | undefined;
|
issueDetail: IIssue | undefined;
|
||||||
|
projectId: string;
|
||||||
handleModuleChange?: (moduleId: string) => void;
|
handleModuleChange?: (moduleId: string) => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
handleIssueUpdate?: () => void;
|
handleIssueUpdate?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// services
|
||||||
|
const moduleService = new ModuleService();
|
||||||
|
|
||||||
export const SidebarModuleSelect: React.FC<Props> = observer((props) => {
|
export const SidebarModuleSelect: React.FC<Props> = observer((props) => {
|
||||||
const { issueDetail, disabled = false, handleIssueUpdate, handleModuleChange } = props;
|
const { issueDetail, projectId, disabled = false, handleIssueUpdate, handleModuleChange } = props;
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
// mobx store
|
// mobx store
|
||||||
const {
|
const {
|
||||||
module: { projectModules },
|
|
||||||
moduleIssues: { removeIssueFromModule, addIssueToModule },
|
moduleIssues: { removeIssueFromModule, addIssueToModule },
|
||||||
} = useMobxStore();
|
} = useMobxStore();
|
||||||
|
|
||||||
const [isUpdating, setIsUpdating] = useState(false);
|
const [isUpdating, setIsUpdating] = useState(false);
|
||||||
|
|
||||||
|
const { data: projectModules } = useSWR(
|
||||||
|
workspaceSlug && projectId ? MODULE_LIST(projectId as string) : null,
|
||||||
|
workspaceSlug && projectId
|
||||||
|
? () => moduleService.getModules(workspaceSlug as string, projectId as string)
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
|
||||||
const handleModuleStoreChange = async (moduleId: string) => {
|
const handleModuleStoreChange = async (moduleId: string) => {
|
||||||
if (!workspaceSlug || !issueDetail || !moduleId) return;
|
if (!workspaceSlug || !issueDetail || !moduleId) return;
|
||||||
|
|
||||||
|
@ -12,15 +12,16 @@ import { IIssue, ISearchIssueResponse } from "types";
|
|||||||
type Props = {
|
type Props = {
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
issueDetails: IIssue | undefined;
|
issueDetails: IIssue | undefined;
|
||||||
|
projectId: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SidebarParentSelect: React.FC<Props> = ({ onChange, issueDetails, disabled = false }) => {
|
export const SidebarParentSelect: React.FC<Props> = ({ onChange, issueDetails, projectId, disabled = false }) => {
|
||||||
const [isParentModalOpen, setIsParentModalOpen] = useState(false);
|
const [isParentModalOpen, setIsParentModalOpen] = useState(false);
|
||||||
const [selectedParentIssue, setSelectedParentIssue] = useState<ISearchIssueResponse | null>(null);
|
const [selectedParentIssue, setSelectedParentIssue] = useState<ISearchIssueResponse | null>(null);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { projectId, issueId } = router.query;
|
const { issueId } = router.query;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -15,6 +15,7 @@ import { STATES_LIST } from "constants/fetch-keys";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: string;
|
value: string;
|
||||||
|
projectId: string;
|
||||||
onChange: (val: string) => void;
|
onChange: (val: string) => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
@ -22,9 +23,9 @@ type Props = {
|
|||||||
// services
|
// services
|
||||||
const stateService = new ProjectStateService();
|
const stateService = new ProjectStateService();
|
||||||
|
|
||||||
export const SidebarStateSelect: React.FC<Props> = ({ value, onChange, disabled = false }) => {
|
export const SidebarStateSelect: React.FC<Props> = ({ value, projectId, onChange, disabled = false }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId, inboxIssueId } = router.query;
|
const { workspaceSlug, inboxIssueId } = router.query;
|
||||||
|
|
||||||
const { data: states } = useSWR(
|
const { data: states } = useSWR(
|
||||||
workspaceSlug && projectId ? STATES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? STATES_LIST(projectId as string) : null,
|
||||||
|
@ -290,6 +290,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
render={({ field: { value } }) => (
|
render={({ field: { value } }) => (
|
||||||
<SidebarStateSelect
|
<SidebarStateSelect
|
||||||
value={value}
|
value={value}
|
||||||
|
projectId={projectId as string}
|
||||||
onChange={(val: string) => submitChanges({ state: val })}
|
onChange={(val: string) => submitChanges({ state: val })}
|
||||||
disabled={!isAllowed || uneditable}
|
disabled={!isAllowed || uneditable}
|
||||||
/>
|
/>
|
||||||
@ -311,6 +312,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
render={({ field: { value } }) => (
|
render={({ field: { value } }) => (
|
||||||
<SidebarAssigneeSelect
|
<SidebarAssigneeSelect
|
||||||
value={value}
|
value={value}
|
||||||
|
projectId={projectId as string}
|
||||||
onChange={(val: string[]) => submitChanges({ assignees: val })}
|
onChange={(val: string[]) => submitChanges({ assignees: val })}
|
||||||
disabled={!isAllowed || uneditable}
|
disabled={!isAllowed || uneditable}
|
||||||
/>
|
/>
|
||||||
@ -382,6 +384,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
onChange(val);
|
onChange(val);
|
||||||
}}
|
}}
|
||||||
issueDetails={issueDetail}
|
issueDetails={issueDetail}
|
||||||
|
projectId={projectId as string}
|
||||||
disabled={!isAllowed || uneditable}
|
disabled={!isAllowed || uneditable}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -536,6 +539,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<SidebarCycleSelect
|
<SidebarCycleSelect
|
||||||
issueDetail={issueDetail}
|
issueDetail={issueDetail}
|
||||||
|
projectId={projectId as string}
|
||||||
handleCycleChange={handleCycleChange}
|
handleCycleChange={handleCycleChange}
|
||||||
disabled={!isAllowed || uneditable}
|
disabled={!isAllowed || uneditable}
|
||||||
/>
|
/>
|
||||||
@ -551,6 +555,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<SidebarModuleSelect
|
<SidebarModuleSelect
|
||||||
issueDetail={issueDetail}
|
issueDetail={issueDetail}
|
||||||
|
projectId={projectId as string}
|
||||||
handleModuleChange={handleModuleChange}
|
handleModuleChange={handleModuleChange}
|
||||||
disabled={!isAllowed || uneditable}
|
disabled={!isAllowed || uneditable}
|
||||||
/>
|
/>
|
||||||
@ -569,6 +574,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
<div className="space-y-1 sm:w-1/2">
|
<div className="space-y-1 sm:w-1/2">
|
||||||
<SidebarLabelSelect
|
<SidebarLabelSelect
|
||||||
issueDetails={issueDetail}
|
issueDetails={issueDetail}
|
||||||
|
projectId={projectId as string}
|
||||||
labelList={issueDetail?.labels ?? []}
|
labelList={issueDetail?.labels ?? []}
|
||||||
submitChanges={submitChanges}
|
submitChanges={submitChanges}
|
||||||
isNotAllowed={!isAllowed}
|
isNotAllowed={!isAllowed}
|
||||||
|
Loading…
Reference in New Issue
Block a user