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;
|
||||
handleToggleExpand: (issueId: string) => void;
|
||||
properties: Properties;
|
||||
handleEditIssue: () => void;
|
||||
handleEditIssue: (issue: IIssue) => void;
|
||||
handleDeleteIssue: (issue: IIssue) => void;
|
||||
gridTemplateColumns: string;
|
||||
user: ICurrentUserResponse | undefined;
|
||||
@ -245,7 +245,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
|
||||
>
|
||||
{!isNotAllowed && (
|
||||
<CustomMenu width="auto" position="left" ellipsis>
|
||||
<CustomMenu.MenuItem onClick={handleEditIssue}>
|
||||
<CustomMenu.MenuItem onClick={() => handleEditIssue(issue)}>
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<PencilIcon className="h-4 w-4" />
|
||||
<span>Edit issue</span>
|
||||
|
@ -59,7 +59,7 @@ export const SpreadsheetIssues: React.FC<Props> = ({
|
||||
handleToggleExpand={handleToggleExpand}
|
||||
gridTemplateColumns={gridTemplateColumns}
|
||||
properties={properties}
|
||||
handleEditIssue={() => handleEditIssue(issue)}
|
||||
handleEditIssue={handleEditIssue}
|
||||
handleDeleteIssue={handleDeleteIssue}
|
||||
user={user}
|
||||
userAuth={userAuth}
|
||||
@ -78,7 +78,7 @@ export const SpreadsheetIssues: React.FC<Props> = ({
|
||||
setExpandedIssues={setExpandedIssues}
|
||||
gridTemplateColumns={gridTemplateColumns}
|
||||
properties={properties}
|
||||
handleEditIssue={() => handleEditIssue(subIssue)}
|
||||
handleEditIssue={handleEditIssue}
|
||||
handleDeleteIssue={handleDeleteIssue}
|
||||
user={user}
|
||||
userAuth={userAuth}
|
||||
|
@ -18,12 +18,13 @@ import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
// ui
|
||||
import { SecondaryButton, DangerButton } from "components/ui";
|
||||
// types
|
||||
import type { IIssue, ICurrentUserResponse } from "types";
|
||||
import type { IIssue, ICurrentUserResponse, ISubIssueResponse } from "types";
|
||||
// fetch-keys
|
||||
import {
|
||||
CYCLE_ISSUES_WITH_PARAMS,
|
||||
MODULE_ISSUES_WITH_PARAMS,
|
||||
PROJECT_ISSUES_LIST_WITH_PARAMS,
|
||||
SUB_ISSUES,
|
||||
VIEW_ISSUES,
|
||||
} from "constants/fetch-keys";
|
||||
|
||||
@ -84,12 +85,27 @@ export const DeleteIssueModal: React.FC<Props> = ({ isOpen, handleClose, data, u
|
||||
: viewId
|
||||
? VIEW_ISSUES(viewId.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);
|
||||
|
||||
return {
|
||||
...prevData,
|
||||
sub_issues: updatedArray,
|
||||
};
|
||||
},
|
||||
false
|
||||
);
|
||||
} else {
|
||||
mutate<IIssue[]>(
|
||||
spreadsheetFetchKey,
|
||||
(prevData) => (prevData ?? []).filter((p) => p.id !== data.id),
|
||||
false
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (cycleId) mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId 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 {
|
||||
if (issueView === "calendar") mutate(calendarFetchKey);
|
||||
if (issueView === "spreadsheet") mutate(spreadsheetFetchKey);
|
||||
if (payload.parent) mutate(SUB_ISSUES(payload.parent.toString()));
|
||||
mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(activeProject ?? "", params));
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ export const SPREADSHEET_COLUMN = [
|
||||
colName: "Due Date",
|
||||
colSize: "128px",
|
||||
icon: CalendarDaysIcon,
|
||||
ascendingOrder: "target_date",
|
||||
descendingOrder: "-target_date",
|
||||
ascendingOrder: "-target_date",
|
||||
descendingOrder: "target_date",
|
||||
},
|
||||
{
|
||||
propertyName: "estimate",
|
||||
|
Loading…
Reference in New Issue
Block a user