mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: spreadsheet view bug fixes (#1383)
* fix: due date sorting fix * fix: update and delete sub-issue fix
This commit is contained in:
parent
ddaa8df1c5
commit
5ada1e5397
@ -38,7 +38,7 @@ type Props = {
|
|||||||
expanded: boolean;
|
expanded: boolean;
|
||||||
handleToggleExpand: (issueId: string) => void;
|
handleToggleExpand: (issueId: string) => void;
|
||||||
properties: Properties;
|
properties: Properties;
|
||||||
handleEditIssue: () => void;
|
handleEditIssue: (issue: IIssue) => void;
|
||||||
handleDeleteIssue: (issue: IIssue) => void;
|
handleDeleteIssue: (issue: IIssue) => void;
|
||||||
gridTemplateColumns: string;
|
gridTemplateColumns: string;
|
||||||
user: ICurrentUserResponse | undefined;
|
user: ICurrentUserResponse | undefined;
|
||||||
@ -245,7 +245,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
|
|||||||
>
|
>
|
||||||
{!isNotAllowed && (
|
{!isNotAllowed && (
|
||||||
<CustomMenu width="auto" position="left" ellipsis>
|
<CustomMenu width="auto" position="left" ellipsis>
|
||||||
<CustomMenu.MenuItem onClick={handleEditIssue}>
|
<CustomMenu.MenuItem onClick={() => handleEditIssue(issue)}>
|
||||||
<div className="flex items-center justify-start gap-2">
|
<div className="flex items-center justify-start gap-2">
|
||||||
<PencilIcon className="h-4 w-4" />
|
<PencilIcon className="h-4 w-4" />
|
||||||
<span>Edit issue</span>
|
<span>Edit issue</span>
|
||||||
|
@ -59,7 +59,7 @@ export const SpreadsheetIssues: React.FC<Props> = ({
|
|||||||
handleToggleExpand={handleToggleExpand}
|
handleToggleExpand={handleToggleExpand}
|
||||||
gridTemplateColumns={gridTemplateColumns}
|
gridTemplateColumns={gridTemplateColumns}
|
||||||
properties={properties}
|
properties={properties}
|
||||||
handleEditIssue={() => handleEditIssue(issue)}
|
handleEditIssue={handleEditIssue}
|
||||||
handleDeleteIssue={handleDeleteIssue}
|
handleDeleteIssue={handleDeleteIssue}
|
||||||
user={user}
|
user={user}
|
||||||
userAuth={userAuth}
|
userAuth={userAuth}
|
||||||
@ -78,7 +78,7 @@ export const SpreadsheetIssues: React.FC<Props> = ({
|
|||||||
setExpandedIssues={setExpandedIssues}
|
setExpandedIssues={setExpandedIssues}
|
||||||
gridTemplateColumns={gridTemplateColumns}
|
gridTemplateColumns={gridTemplateColumns}
|
||||||
properties={properties}
|
properties={properties}
|
||||||
handleEditIssue={() => handleEditIssue(subIssue)}
|
handleEditIssue={handleEditIssue}
|
||||||
handleDeleteIssue={handleDeleteIssue}
|
handleDeleteIssue={handleDeleteIssue}
|
||||||
user={user}
|
user={user}
|
||||||
userAuth={userAuth}
|
userAuth={userAuth}
|
||||||
|
@ -18,12 +18,13 @@ import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
|||||||
// ui
|
// ui
|
||||||
import { SecondaryButton, DangerButton } from "components/ui";
|
import { SecondaryButton, DangerButton } from "components/ui";
|
||||||
// types
|
// types
|
||||||
import type { IIssue, ICurrentUserResponse } from "types";
|
import type { IIssue, ICurrentUserResponse, ISubIssueResponse } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import {
|
import {
|
||||||
CYCLE_ISSUES_WITH_PARAMS,
|
CYCLE_ISSUES_WITH_PARAMS,
|
||||||
MODULE_ISSUES_WITH_PARAMS,
|
MODULE_ISSUES_WITH_PARAMS,
|
||||||
PROJECT_ISSUES_LIST_WITH_PARAMS,
|
PROJECT_ISSUES_LIST_WITH_PARAMS,
|
||||||
|
SUB_ISSUES,
|
||||||
VIEW_ISSUES,
|
VIEW_ISSUES,
|
||||||
} from "constants/fetch-keys";
|
} from "constants/fetch-keys";
|
||||||
|
|
||||||
@ -84,12 +85,27 @@ export const DeleteIssueModal: React.FC<Props> = ({ isOpen, handleClose, data, u
|
|||||||
: viewId
|
: viewId
|
||||||
? VIEW_ISSUES(viewId.toString(), spreadsheetParams)
|
? VIEW_ISSUES(viewId.toString(), spreadsheetParams)
|
||||||
: PROJECT_ISSUES_LIST_WITH_PARAMS(projectId?.toString() ?? "", spreadsheetParams);
|
: PROJECT_ISSUES_LIST_WITH_PARAMS(projectId?.toString() ?? "", spreadsheetParams);
|
||||||
|
if (data.parent) {
|
||||||
|
mutate<ISubIssueResponse>(
|
||||||
|
SUB_ISSUES(data.parent.toString()),
|
||||||
|
(prevData) => {
|
||||||
|
if (!prevData) return prevData;
|
||||||
|
const updatedArray = (prevData.sub_issues ?? []).filter((i) => i.id !== data.id);
|
||||||
|
|
||||||
mutate<IIssue[]>(
|
return {
|
||||||
spreadsheetFetchKey,
|
...prevData,
|
||||||
(prevData) => (prevData ?? []).filter((p) => p.id !== data.id),
|
sub_issues: updatedArray,
|
||||||
false
|
};
|
||||||
);
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
mutate<IIssue[]>(
|
||||||
|
spreadsheetFetchKey,
|
||||||
|
(prevData) => (prevData ?? []).filter((p) => p.id !== data.id),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cycleId) mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params));
|
if (cycleId) mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params));
|
||||||
else if (moduleId) mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
|
else if (moduleId) mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
|
||||||
|
@ -276,6 +276,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = ({
|
|||||||
} else {
|
} else {
|
||||||
if (issueView === "calendar") mutate(calendarFetchKey);
|
if (issueView === "calendar") mutate(calendarFetchKey);
|
||||||
if (issueView === "spreadsheet") mutate(spreadsheetFetchKey);
|
if (issueView === "spreadsheet") mutate(spreadsheetFetchKey);
|
||||||
|
if (payload.parent) mutate(SUB_ISSUES(payload.parent.toString()));
|
||||||
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(activeProject ?? "", params));
|
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(activeProject ?? "", params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ export const SPREADSHEET_COLUMN = [
|
|||||||
colName: "Due Date",
|
colName: "Due Date",
|
||||||
colSize: "128px",
|
colSize: "128px",
|
||||||
icon: CalendarDaysIcon,
|
icon: CalendarDaysIcon,
|
||||||
ascendingOrder: "target_date",
|
ascendingOrder: "-target_date",
|
||||||
descendingOrder: "-target_date",
|
descendingOrder: "target_date",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
propertyName: "estimate",
|
propertyName: "estimate",
|
||||||
|
Loading…
Reference in New Issue
Block a user