From 8638170a98a26994ab929ff35ac97414f28b1d68 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 14 Apr 2023 19:40:00 +0530 Subject: [PATCH 01/20] fix: cycles and modules sidebar mutation (#831) --- .../core/existing-issues-list-modal.tsx | 17 ++- apps/app/components/core/issues-view.tsx | 2 +- apps/app/components/issues/modal.tsx | 12 +- .../issues/view-select/assignee.tsx | 4 +- .../issues/view-select/due-date.tsx | 83 ++++++------ .../issues/view-select/estimate.tsx | 21 +-- .../issues/view-select/priority.tsx | 127 +++++++++--------- .../components/issues/view-select/state.tsx | 4 +- 8 files changed, 153 insertions(+), 117 deletions(-) diff --git a/apps/app/components/core/existing-issues-list-modal.tsx b/apps/app/components/core/existing-issues-list-modal.tsx index 4d9ec5909..2e255ae19 100644 --- a/apps/app/components/core/existing-issues-list-modal.tsx +++ b/apps/app/components/core/existing-issues-list-modal.tsx @@ -19,7 +19,12 @@ import { LayerDiagonalIcon } from "components/icons"; // types import { IIssue } from "types"; // fetch-keys -import { CYCLE_ISSUES_WITH_PARAMS, MODULE_ISSUES_WITH_PARAMS } from "constants/fetch-keys"; +import { + CYCLE_DETAILS, + CYCLE_ISSUES_WITH_PARAMS, + MODULE_DETAILS, + MODULE_ISSUES_WITH_PARAMS, +} from "constants/fetch-keys"; type FormInput = { issues: string[]; @@ -76,8 +81,14 @@ export const ExistingIssuesListModal: React.FC = ({ } await handleOnSubmit(data); - if (cycleId) mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params)); - if (moduleId) mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); + if (cycleId) { + mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params)); + mutate(CYCLE_DETAILS(cycleId as string)); + } + if (moduleId) { + mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); + mutate(MODULE_DETAILS(moduleId as string)); + } handleClose(); diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index b8f2bd39c..c13dacf0a 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -234,7 +234,7 @@ export const IssuesView: React.FC = ({ ) trackEventServices.trackIssueMarkedAsDoneEvent({ workspaceSlug, - workspaceId: draggedItem.workspace_detail.id, + workspaceId: draggedItem.workspace, projectName: draggedItem.project_detail.name, projectIdentifier: draggedItem.project_detail.identifier, projectId, diff --git a/apps/app/components/issues/modal.tsx b/apps/app/components/issues/modal.tsx index ee2c9a89c..47fe6e871 100644 --- a/apps/app/components/issues/modal.tsx +++ b/apps/app/components/issues/modal.tsx @@ -29,6 +29,8 @@ import { PROJECT_ISSUES_LIST_WITH_PARAMS, CYCLE_ISSUES_WITH_PARAMS, MODULE_ISSUES_WITH_PARAMS, + CYCLE_DETAILS, + MODULE_DETAILS, } from "constants/fetch-keys"; export interface IssuesModalProps { @@ -101,7 +103,10 @@ export const CreateUpdateIssueModal: React.FC = ({ issues: [issueId], }) .then(() => { - mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId, params)); + if (cycleId) { + mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId, params)); + mutate(CYCLE_DETAILS(cycleId as string)); + } }); }; @@ -113,7 +118,10 @@ export const CreateUpdateIssueModal: React.FC = ({ issues: [issueId], }) .then(() => { - mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); + if (moduleId) { + mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); + mutate(MODULE_DETAILS(moduleId as string)); + } }); }; diff --git a/apps/app/components/issues/view-select/assignee.tsx b/apps/app/components/issues/view-select/assignee.tsx index 819b7b696..adfd078a6 100644 --- a/apps/app/components/issues/view-select/assignee.tsx +++ b/apps/app/components/issues/view-select/assignee.tsx @@ -75,8 +75,8 @@ export const ViewAssigneeSelect: React.FC = ({ trackEventServices.trackIssuePartialPropertyUpdateEvent( { - workspaceSlug: issue.workspace_detail.slug, - workspaceId: issue.workspace_detail.id, + workspaceSlug, + workspaceId: issue.workspace, projectId: issue.project_detail.id, projectIdentifier: issue.project_detail.identifier, projectName: issue.project_detail.name, diff --git a/apps/app/components/issues/view-select/due-date.tsx b/apps/app/components/issues/view-select/due-date.tsx index dd6d3302e..61aad5766 100644 --- a/apps/app/components/issues/view-select/due-date.tsx +++ b/apps/app/components/issues/view-select/due-date.tsx @@ -1,3 +1,5 @@ +import { useRouter } from "next/router"; + // ui import { CustomDatePicker, Tooltip } from "components/ui"; // helpers @@ -13,41 +15,46 @@ type Props = { isNotAllowed: boolean; }; -export const ViewDueDateSelect: React.FC = ({ issue, partialUpdateIssue, isNotAllowed }) => ( - -
- { - partialUpdateIssue({ - target_date: val, - priority: issue.priority, - state: issue.state, - }); - trackEventServices.trackIssuePartialPropertyUpdateEvent( - { - workspaceSlug: issue.workspace_detail.slug, - workspaceId: issue.workspace_detail.id, - projectId: issue.project_detail.id, - projectIdentifier: issue.project_detail.identifier, - projectName: issue.project_detail.name, - issueId: issue.id, - }, - "ISSUE_PROPERTY_UPDATE_DUE_DATE" - ); - }} - className={issue?.target_date ? "w-[6.5rem]" : "w-[3rem] text-center"} - disabled={isNotAllowed} - /> -
-
-); +export const ViewDueDateSelect: React.FC = ({ issue, partialUpdateIssue, isNotAllowed }) => { + const router = useRouter(); + const { workspaceSlug } = router.query; + + return ( + +
+ { + partialUpdateIssue({ + target_date: val, + priority: issue.priority, + state: issue.state, + }); + trackEventServices.trackIssuePartialPropertyUpdateEvent( + { + workspaceSlug, + workspaceId: issue.workspace, + projectId: issue.project_detail.id, + projectIdentifier: issue.project_detail.identifier, + projectName: issue.project_detail.name, + issueId: issue.id, + }, + "ISSUE_PROPERTY_UPDATE_DUE_DATE" + ); + }} + className={issue?.target_date ? "w-[6.5rem]" : "w-[3rem] text-center"} + disabled={isNotAllowed} + /> +
+
+ ); +}; diff --git a/apps/app/components/issues/view-select/estimate.tsx b/apps/app/components/issues/view-select/estimate.tsx index 5062950f3..e3dbb2028 100644 --- a/apps/app/components/issues/view-select/estimate.tsx +++ b/apps/app/components/issues/view-select/estimate.tsx @@ -1,17 +1,17 @@ import React from "react"; +import { useRouter } from "next/router"; + +// services +import trackEventServices from "services/track-event.service"; +// hooks +import useEstimateOption from "hooks/use-estimate-option"; // ui import { CustomSelect, Tooltip } from "components/ui"; // icons -import { getPriorityIcon } from "components/icons/priority-icon"; +import { PlayIcon } from "@heroicons/react/24/outline"; // types import { IIssue } from "types"; -// constants -import { PRIORITIES } from "constants/project"; -// services -import trackEventServices from "services/track-event.service"; -import useEstimateOption from "hooks/use-estimate-option"; -import { PlayIcon } from "@heroicons/react/24/outline"; type Props = { issue: IIssue; @@ -28,6 +28,9 @@ export const ViewEstimateSelect: React.FC = ({ selfPositioned = false, isNotAllowed, }) => { + const router = useRouter(); + const { workspaceSlug } = router.query; + const { isEstimateActive, estimatePoints } = useEstimateOption(issue.estimate_point); const estimateValue = estimatePoints?.find((e) => e.key === issue.estimate_point)?.value; @@ -41,8 +44,8 @@ export const ViewEstimateSelect: React.FC = ({ partialUpdateIssue({ estimate_point: val }); trackEventServices.trackIssuePartialPropertyUpdateEvent( { - workspaceSlug: issue.workspace_detail.slug, - workspaceId: issue.workspace_detail.id, + workspaceSlug, + workspaceId: issue.workspace, projectId: issue.project_detail.id, projectIdentifier: issue.project_detail.identifier, projectName: issue.project_detail.name, diff --git a/apps/app/components/issues/view-select/priority.tsx b/apps/app/components/issues/view-select/priority.tsx index 105978a04..11cd4e698 100644 --- a/apps/app/components/issues/view-select/priority.tsx +++ b/apps/app/components/issues/view-select/priority.tsx @@ -1,5 +1,7 @@ import React from "react"; +import { useRouter } from "next/router"; + // ui import { CustomSelect, Tooltip } from "components/ui"; // icons @@ -25,63 +27,68 @@ export const ViewPrioritySelect: React.FC = ({ position = "left", selfPositioned = false, isNotAllowed, -}) => ( - { - partialUpdateIssue({ priority: data }); - trackEventServices.trackIssuePartialPropertyUpdateEvent( - { - workspaceSlug: issue.workspace_detail.slug, - workspaceId: issue.workspace_detail.id, - projectId: issue.project_detail.id, - projectIdentifier: issue.project_detail.identifier, - projectName: issue.project_detail.name, - issueId: issue.id, - }, - "ISSUE_PROPERTY_UPDATE_PRIORITY" - ); - }} - maxHeight="md" - customButton={ - - } - noChevron - disabled={isNotAllowed} - position={position} - selfPositioned={selfPositioned} - > - {PRIORITIES?.map((priority) => ( - - <> - {getPriorityIcon(priority, "text-sm")} - {priority ?? "None"} - - - ))} - -); +}) => { + const router = useRouter(); + const { workspaceSlug } = router.query; + + return ( + { + partialUpdateIssue({ priority: data }); + trackEventServices.trackIssuePartialPropertyUpdateEvent( + { + workspaceSlug, + workspaceId: issue.workspace, + projectId: issue.project_detail.id, + projectIdentifier: issue.project_detail.identifier, + projectName: issue.project_detail.name, + issueId: issue.id, + }, + "ISSUE_PROPERTY_UPDATE_PRIORITY" + ); + }} + maxHeight="md" + customButton={ + + } + noChevron + disabled={isNotAllowed} + position={position} + selfPositioned={selfPositioned} + > + {PRIORITIES?.map((priority) => ( + + <> + {getPriorityIcon(priority, "text-sm")} + {priority ?? "None"} + + + ))} + + ); +}; diff --git a/apps/app/components/issues/view-select/state.tsx b/apps/app/components/issues/view-select/state.tsx index bd90ec080..34ce8c82c 100644 --- a/apps/app/components/issues/view-select/state.tsx +++ b/apps/app/components/issues/view-select/state.tsx @@ -67,8 +67,8 @@ export const ViewStateSelect: React.FC = ({ }); trackEventServices.trackIssuePartialPropertyUpdateEvent( { - workspaceSlug: issue.workspace_detail.slug, - workspaceId: issue.workspace_detail.id, + workspaceSlug, + workspaceId: issue.workspace, projectId: issue.project_detail.id, projectIdentifier: issue.project_detail.identifier, projectName: issue.project_detail.name, From 363c5c8ec4ede8bd04fc3bb42255d455c9c091e0 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:27:20 +0530 Subject: [PATCH 02/20] fix: join project mutation (#835) * fix: join project mutation * chore: remove imports --- .../auth-screens/project/join-project.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/app/components/auth-screens/project/join-project.tsx b/apps/app/components/auth-screens/project/join-project.tsx index 1c2018db0..402fff42b 100644 --- a/apps/app/components/auth-screens/project/join-project.tsx +++ b/apps/app/components/auth-screens/project/join-project.tsx @@ -5,15 +5,16 @@ import { useRouter } from "next/router"; import { mutate } from "swr"; +// services +import projectService from "services/project.service"; // ui import { PrimaryButton } from "components/ui"; -// icon +// icons import { AssignmentClipboardIcon } from "components/icons"; -// img +// images import JoinProjectImg from "public/auth/project-not-authorized.svg"; -import projectService from "services/project.service"; // fetch-keys -import { PROJECT_MEMBERS } from "constants/fetch-keys"; +import { USER_PROJECT_VIEW } from "constants/fetch-keys"; export const JoinProject: React.FC = () => { const [isJoiningProject, setIsJoiningProject] = useState(false); @@ -22,13 +23,16 @@ export const JoinProject: React.FC = () => { const { workspaceSlug, projectId } = router.query; const handleJoin = () => { + if (!workspaceSlug || !projectId) return; + setIsJoiningProject(true); projectService .joinProject(workspaceSlug as string, { project_ids: [projectId as string], }) - .then(() => { - mutate(PROJECT_MEMBERS(projectId as string)); + .then(async () => { + await mutate(USER_PROJECT_VIEW(workspaceSlug.toString())); + setIsJoiningProject(false); }) .catch((err) => { console.error(err); From 5a36a7931f9d36d01c254f43be1d548305bb3ac3 Mon Sep 17 00:00:00 2001 From: Kunal Vishwakarma <116634168+kunalv17@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:15:06 +0530 Subject: [PATCH 03/20] fix: removed extra spaces form estimate points brackets (#837) --- .../components/estimates/single-estimate.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/app/components/estimates/single-estimate.tsx b/apps/app/components/estimates/single-estimate.tsx index 005acb25d..ea41ae6b7 100644 --- a/apps/app/components/estimates/single-estimate.tsx +++ b/apps/app/components/estimates/single-estimate.tsx @@ -152,14 +152,16 @@ export const SingleEstimate: React.FC = ({ {estimatePoints && estimatePoints.length > 0 ? ( -
- Estimate points( - {estimatePoints.map((point, index) => ( -
- {point.value} - {index !== estimatePoints.length - 1 && ","}{" "} -
- ))} +
+ Estimate points ( + + {estimatePoints.map((point, index) => ( +
+ {point.value} + {index !== estimatePoints.length - 1 && ","}{" "} +
+ ))} +
)
) : ( From 61761fedc5ffdf435f66b3fc5ce8ba331f5175bc Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:15:38 +0530 Subject: [PATCH 04/20] chore: remove view filter validation while creating or updating view (#836) --- apiserver/plane/api/serializers/view.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/apiserver/plane/api/serializers/view.py b/apiserver/plane/api/serializers/view.py index 021bcfb72..076228ae0 100644 --- a/apiserver/plane/api/serializers/view.py +++ b/apiserver/plane/api/serializers/view.py @@ -25,22 +25,18 @@ class IssueViewSerializer(BaseSerializer): def create(self, validated_data): query_params = validated_data.get("query_data", {}) - - if not bool(query_params): - raise serializers.ValidationError( - {"query_data": ["Query data field cannot be empty"]} - ) - - validated_data["query"] = issue_filters(query_params, "POST") + if bool(query_params): + validated_data["query"] = issue_filters(query_params, "POST") + else: + validated_data["query"] = dict() return IssueView.objects.create(**validated_data) def update(self, instance, validated_data): query_params = validated_data.get("query_data", {}) - if not bool(query_params): - raise serializers.ValidationError( - {"query_data": ["Query data field cannot be empty"]} - ) - + if bool(query_params): + validated_data["query"] = issue_filters(query_params, "POST") + else: + validated_data["query"] = dict() validated_data["query"] = issue_filters(query_params, "PATCH") return super().update(instance, validated_data) From e23075b7b91debd57ccc0a1f14b5bea747a78548 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:30:48 +0530 Subject: [PATCH 05/20] chore: no estimates option, estimates activity (#838) --- apps/app/components/core/feeds.tsx | 12 +++-- apps/app/components/core/issues-view.tsx | 51 +++++++++---------- apps/app/components/issues/activity.tsx | 17 ++++++- apps/app/components/issues/form.tsx | 2 +- .../app/components/issues/select/estimate.tsx | 18 +++++-- .../issues/sidebar-select/estimate.tsx | 22 +++++--- apps/app/components/issues/sidebar.tsx | 2 +- .../issues/view-select/estimate.tsx | 21 ++++++-- apps/app/hooks/use-estimate-option.tsx | 2 +- .../projects/[projectId]/issues/[issueId].tsx | 1 + apps/app/types/issues.d.ts | 2 +- 11 files changed, 97 insertions(+), 53 deletions(-) diff --git a/apps/app/components/core/feeds.tsx b/apps/app/components/core/feeds.tsx index 1a8e6ca24..c16fcd10f 100644 --- a/apps/app/components/core/feeds.tsx +++ b/apps/app/components/core/feeds.tsx @@ -73,6 +73,10 @@ const activityDetails: { message: "updated the description.", icon: