Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

chore: archival of modules, cycles and issues enhancement. (#4100)

Prateek Shourya4c97098218d9
diff --git a/web/components/cycles/archived-cycles/modal.tsx b/web/components/cycles/archived-cycles/modal.tsx
index 6e0ddef35b..b613d0de9d 100644
--- a/web/components/cycles/archived-cycles/modal.tsx
+++ b/web/components/cycles/archived-cycles/modal.tsx
@@ -41,7 +41,7 @@ export const ArchiveCycleModal: React.FC<Props> = (props) => {
message: "Your archives can be found in project archives.",
});
onClose();
- router.push(`/${workspaceSlug}/projects/${projectId}/archives/cycles?peekCycle=${cycleId}`);
+ router.push(`/${workspaceSlug}/projects/${projectId}/cycles`);
})
.catch(() =>
setToast({
diff --git a/web/components/cycles/quick-actions.tsx b/web/components/cycles/quick-actions.tsx
index 215f07beff..bf9aefc879 100644
--- a/web/components/cycles/quick-actions.tsx
+++ b/web/components/cycles/quick-actions.tsx
@@ -78,7 +78,7 @@ export const CycleQuickActions: React.FC<Props> = observer((props) => {
title: "Restore success",
message: "Your cycle can be found in project cycles.",
});
- router.push(`/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}`);
+ router.push(`/${workspaceSlug}/projects/${projectId}/archives/cycles`);
})
.catch(() =>
setToast({
diff --git a/web/components/cycles/sidebar.tsx b/web/components/cycles/sidebar.tsx
index e333564ee7..b72f9fd0d0 100644
--- a/web/components/cycles/sidebar.tsx
+++ b/web/components/cycles/sidebar.tsx
@@ -129,7 +129,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
title: "Restore success",
message: "Your cycle can be found in project cycles.",
});
- router.push(`/${workspaceSlug.toString()}/projects/${projectId.toString()}/cycles/${cycleId}`);
+ router.push(`/${workspaceSlug.toString()}/projects/${projectId.toString()}/archives/cycles`);
})
.catch(() =>
setToast({
diff --git a/web/components/issues/archive-issue-modal.tsx b/web/components/issues/archive-issue-modal.tsx
index 8ea747ffc7..92bbdc6778 100644
--- a/web/components/issues/archive-issue-modal.tsx
+++ b/web/components/issues/archive-issue-modal.tsx
@@ -39,7 +39,14 @@ export const ArchiveIssueModal: React.FC<Props> = (props) => {
setIsArchiving(true);
await onSubmit()
- .then(() => onClose())
+ .then(() => {
+ setToast({
+ type: TOAST_TYPE.SUCCESS,
+ title: "Archive success",
+ message: "Your archives can be found in project archives.",
+ });
+ onClose();
+ })
.catch(() =>
setToast({
type: TOAST_TYPE.ERROR,
diff --git a/web/components/issues/issue-detail/root.tsx b/web/components/issues/issue-detail/root.tsx
index 53e8d87071..fdd848a2da 100644
--- a/web/components/issues/issue-detail/root.tsx
+++ b/web/components/issues/issue-detail/root.tsx
@@ -144,22 +144,12 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
archive: async (workspaceSlug: string, projectId: string, issueId: string) => {
try {
await archiveIssue(workspaceSlug, projectId, issueId);
- setToast({
- type: TOAST_TYPE.SUCCESS,
- title: "Success!",
- message: "Issue archived successfully.",
- });
captureIssueEvent({
eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "SUCCESS", element: "Issue details page" },
path: router.asPath,
});
} catch (error) {
- setToast({
- type: TOAST_TYPE.ERROR,
- title: "Error!",
- message: "Issue could not be archived. Please try again.",
- });
captureIssueEvent({
eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "FAILED", element: "Issue details page" },
diff --git a/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx b/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx
index d996ee5988..8a49ec9b47 100644
--- a/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx
+++ b/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx
@@ -1,22 +1,23 @@
import { useState } from "react";
+import { observer } from "mobx-react";
import { useRouter } from "next/router";
+// icons
import { ArchiveRestoreIcon, ExternalLink, Link, Trash2 } from "lucide-react";
-// hooks
-import { CustomMenu, TOAST_TYPE, setToast } from "@plane/ui";
-
-import { DeleteIssueModal } from "@/components/issues";
// ui
+import { CustomMenu, TOAST_TYPE, setToast } from "@plane/ui";
// components
+import { DeleteIssueModal } from "@/components/issues";
+// constants
import { EIssuesStoreType } from "@/constants/issue";
import { EUserProjectRoles } from "@/constants/project";
+// helpers
import { copyUrlToClipboard } from "@/helpers/string.helper";
+// hooks
import { useEventTracker, useIssues, useUser } from "@/hooks/store";
-// components
-// helpers
// types
import { IQuickActionProps } from "../list/list-view-types";
-export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
+export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = observer((props) => {
const { issue, handleDelete, handleRestore, customActionButton, portalElement, readOnly = false } = props;
// states
const [deleteIssueModal, setDeleteIssueModal] = useState(false);
@@ -46,6 +47,24 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
message: "Issue link copied to clipboard",
})
);
+ const handleIssueRestore = async () => {
+ if (!handleRestore) return;
+ await handleRestore()
+ .then(() => {
+ setToast({
+ type: TOAST_TYPE.SUCCESS,
+ title: "Restore success",
+ message: "Your issue can be found in project issues.",
+ });
+ })
+ .catch(() => {
+ setToast({
+ type: TOAST_TYPE.ERROR,
+ title: "Error!",
+ message: "Issue could not be restored. Please try again.",
+ });
+ });
+ };
return (
<>
@@ -65,7 +84,7 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
ellipsis
>
{isRestoringAllowed && (
- <CustomMenu.MenuItem onClick={handleRestore}>
+ <CustomMenu.MenuItem onClick={handleIssueRestore}>
<div className="flex items-center gap-2">
<ArchiveRestoreIcon className="h-3 w-3" />
Restore
@@ -100,4 +119,4 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
</CustomMenu>
</>
);
-};
+});
diff --git a/web/components/issues/peek-overview/root.tsx b/web/components/issues/peek-overview/root.tsx
index a7f7b23d7a..4d85bd73cd 100644
--- a/web/components/issues/peek-overview/root.tsx
+++ b/web/components/issues/peek-overview/root.tsx
@@ -135,22 +135,12 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
archive: async (workspaceSlug: string, projectId: string, issueId: string) => {
try {
await archiveIssue(workspaceSlug, projectId, issueId);
- setToast({
- type: TOAST_TYPE.SUCCESS,
- title: "Success!",
- message: "Issue archived successfully.",
- });
captureIssueEvent({
eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" },
path: router.asPath,
});
} catch (error) {
- setToast({
- type: TOAST_TYPE.ERROR,
- title: "Error!",
- message: "Issue could not be archived. Please try again.",
- });
captureIssueEvent({
eventName: ISSUE_ARCHIVED,
payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" },
@@ -163,8 +153,8 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
await restoreIssue(workspaceSlug, projectId, issueId);
setToast({
type: TOAST_TYPE.SUCCESS,
- title: "Success!",
- message: "Issue restored successfully.",
+ title: "Restore success",
+ message: "Your issue can be found in project issues.",
});
captureIssueEvent({
eventName: ISSUE_RESTORED,
diff --git a/web/components/modules/archived-modules/modal.tsx b/web/components/modules/archived-modules/modal.tsx
index f922e0ba9c..abfb084f08 100644
--- a/web/components/modules/archived-modules/modal.tsx
+++ b/web/components/modules/archived-modules/modal.tsx
@@ -41,7 +41,7 @@ export const ArchiveModuleModal: React.FC<Props> = (props) => {
message: "Your archives can be found in project archives.",
});
onClose();
- router.push(`/${workspaceSlug}/projects/${projectId}/archives/modules?peekModule=${moduleId}`);
+ router.push(`/${workspaceSlug}/projects/${projectId}/modules`);
})
.catch(() =>
setToast({
diff --git a/web/components/modules/quick-actions.tsx b/web/components/modules/quick-actions.tsx
index b7972d6124..5decec4ecc 100644
--- a/web/components/modules/quick-actions.tsx
+++ b/web/components/modules/quick-actions.tsx
@@ -79,7 +79,7 @@ export const ModuleQuickActions: React.FC<Props> = observer((props) => {
title: "Restore success",
message: "Your module can be found in project modules.",
});
- router.push(`/${workspaceSlug}/projects/${projectId}/modules/${moduleId}`);
+ router.push(`/${workspaceSlug}/projects/${projectId}/archives/modules`);
})
.catch(() =>
setToast({
diff --git a/web/components/modules/sidebar.tsx b/web/components/modules/sidebar.tsx
index 38618023dc..de6e3d02fd 100644
--- a/web/components/modules/sidebar.tsx
+++ b/web/components/modules/sidebar.tsx
@@ -227,7 +227,7 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
title: "Restore success",
message: "Your module can be found in project modules.",
});
- router.push(`/${workspaceSlug}/projects/${projectId}/modules/${moduleId}`);
+ router.push(`/${workspaceSlug}/projects/${projectId}/archives/modules`);
})
.catch(() =>
setToast({
diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx
index 12b0c83917..0ff7d7fc50 100644
--- a/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx
+++ b/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx
@@ -66,13 +66,8 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => {
.then(() => {
setToast({
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}`,
+ title: "Restore success",
+ message: "Your issue can be found in project issues.",
});
router.push(`/${workspaceSlug}/projects/${projectId}/issues/${archivedIssueId}`);
})
@@ -80,7 +75,7 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => {
setToast({
type: TOAST_TYPE.ERROR,
title: "Error!",
- message: "Something went wrong. Please try again.",
+ message: "Issue could not be restored. Please try again.",
});
})
.finally(() => setIsRestoring(false));