From 03387848febaae2e29b931e19728e124f62281df Mon Sep 17 00:00:00 2001 From: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:50:37 +0530 Subject: [PATCH] add functionality for addition of existing issues to modules and cycles (#2913) Co-authored-by: sriram veeraghanta --- .../issue-layouts/empty-states/cycle.tsx | 16 +++--- .../issue-layouts/empty-states/module.tsx | 26 +++++----- .../issue-layouts/kanban/base-kanban-root.tsx | 8 +++ .../issues/issue-layouts/kanban/default.tsx | 12 +++++ .../issue-layouts/kanban/headers/assignee.tsx | 4 ++ .../kanban/headers/created_by.tsx | 4 ++ .../kanban/headers/group-by-card.tsx | 36 +++----------- .../kanban/headers/group-by-root.tsx | 10 ++++ .../issue-layouts/kanban/headers/label.tsx | 4 ++ .../issue-layouts/kanban/headers/priority.tsx | 4 ++ .../issue-layouts/kanban/headers/project.tsx | 4 ++ .../kanban/headers/state-group.tsx | 4 ++ .../issue-layouts/kanban/headers/state.tsx | 4 ++ .../kanban/headers/sub-group-by-root.tsx | 9 ++++ .../issue-layouts/kanban/roots/cycle-root.tsx | 1 + .../kanban/roots/module-root.tsx | 1 + .../issues/issue-layouts/kanban/swimlanes.tsx | 15 ++++++ .../issue-layouts/list/base-list-root.tsx | 13 ++++- .../issues/issue-layouts/list/default.tsx | 13 +++++ .../issue-layouts/list/headers/assignee.tsx | 5 +- .../issue-layouts/list/headers/created-by.tsx | 5 +- .../list/headers/empty-group.tsx | 5 +- .../list/headers/group-by-card.tsx | 49 ++++++------------- .../list/headers/group-by-root.tsx | 13 ++++- .../issue-layouts/list/headers/label.tsx | 5 +- .../issue-layouts/list/headers/priority.tsx | 5 +- .../issue-layouts/list/headers/project.tsx | 5 +- .../list/headers/state-group.tsx | 5 +- .../issue-layouts/list/headers/state.tsx | 5 +- .../issue-layouts/list/roots/cycle-root.tsx | 1 + .../issue-layouts/list/roots/module-root.tsx | 1 + web/components/issues/modal.tsx | 6 +-- web/store/issues/profile/issue.store.ts | 2 + .../project-issues/cycle/issue.store.ts | 44 +++++++++++------ .../project-issues/module/issue.store.ts | 40 +++++++++------ 35 files changed, 259 insertions(+), 125 deletions(-) diff --git a/web/components/issues/issue-layouts/empty-states/cycle.tsx b/web/components/issues/issue-layouts/empty-states/cycle.tsx index 97e4dad8d..97fc5594c 100644 --- a/web/components/issues/issue-layouts/empty-states/cycle.tsx +++ b/web/components/issues/issue-layouts/empty-states/cycle.tsx @@ -28,7 +28,7 @@ export const CycleEmptyState: React.FC = observer((props) => { const [cycleIssuesListModal, setCycleIssuesListModal] = useState(false); const { - cycleIssue: cycleIssueStore, + cycleIssues: cycleIssueStore, commandPalette: commandPaletteStore, trackEvent: { setTrackElement }, } = useMobxStore(); @@ -40,15 +40,13 @@ export const CycleEmptyState: React.FC = observer((props) => { const issueIds = data.map((i) => i.id); - await cycleIssueStore - .addIssueToCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), issueIds) - .catch(() => { - setToastAlert({ - type: "error", - title: "Error!", - message: "Selected issues could not be added to the cycle. Please try again.", - }); + await cycleIssueStore.addIssueToCycle(workspaceSlug.toString(), cycleId.toString(), issueIds).catch(() => { + setToastAlert({ + type: "error", + title: "Error!", + message: "Selected issues could not be added to the cycle. Please try again.", }); + }); }; return ( diff --git a/web/components/issues/issue-layouts/empty-states/module.tsx b/web/components/issues/issue-layouts/empty-states/module.tsx index 4b8a069bf..a735a5785 100644 --- a/web/components/issues/issue-layouts/empty-states/module.tsx +++ b/web/components/issues/issue-layouts/empty-states/module.tsx @@ -22,7 +22,11 @@ export const ModuleEmptyState: React.FC = observer((props) => { // states const [moduleIssuesListModal, setModuleIssuesListModal] = useState(false); - const { moduleIssue: moduleIssueStore, commandPalette: commandPaletteStore, trackEvent: { setTrackElement } } = useMobxStore(); + const { + moduleIssues: moduleIssueStore, + commandPalette: commandPaletteStore, + trackEvent: { setTrackElement }, + } = useMobxStore(); const { setToastAlert } = useToast(); @@ -31,15 +35,13 @@ export const ModuleEmptyState: React.FC = observer((props) => { const issueIds = data.map((i) => i.id); - await moduleIssueStore - .addIssueToModule(workspaceSlug.toString(), projectId.toString(), moduleId.toString(), issueIds) - .catch(() => - setToastAlert({ - type: "error", - title: "Error!", - message: "Selected issues could not be added to the module. Please try again.", - }) - ); + await moduleIssueStore.addIssueToModule(workspaceSlug.toString(), moduleId.toString(), issueIds).catch(() => + setToastAlert({ + type: "error", + title: "Error!", + message: "Selected issues could not be added to the module. Please try again.", + }) + ); }; return ( @@ -60,8 +62,8 @@ export const ModuleEmptyState: React.FC = observer((props) => { icon: , onClick: () => { setTrackElement("MODULE_EMPTY_STATE"); - commandPaletteStore.toggleCreateIssueModal(true) - } + commandPaletteStore.toggleCreateIssueModal(true); + }, }} secondaryButton={