From d3f9b8c0a93eeb86e3727b49e33701c28897b505 Mon Sep 17 00:00:00 2001 From: Dawid Poliszak Date: Thu, 24 Oct 2024 13:21:59 +0200 Subject: [PATCH] NU-1826 provide a way to add comment to existing activity --- .../modals/ModifyExistingCommentDialog.tsx | 2 +- .../ActivityItemCommentModify.tsx | 2 +- .../ActivityItemHeader.tsx | 25 ++++++++++++++++++- .../components/toolbars/activities/types.ts | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/designer/client/src/components/modals/ModifyExistingCommentDialog.tsx b/designer/client/src/components/modals/ModifyExistingCommentDialog.tsx index 6cece5bc5c9..c18f6c6dd40 100644 --- a/designer/client/src/components/modals/ModifyExistingCommentDialog.tsx +++ b/designer/client/src/components/modals/ModifyExistingCommentDialog.tsx @@ -35,7 +35,7 @@ const ModifyExistingCommentDialog = (props: WindowContentProps [ { title: t("dialog.button.cancel", "Cancel"), action: () => props.close(), classname: LoadingButtonTypes.secondaryButton }, - { title: t("dialog.button.add", "Add"), action: () => confirmAction() }, + { title: t("dialog.button.modify", "Modify"), action: () => confirmAction() }, ], [confirmAction, props, t], ); diff --git a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx index 558d4d0a5a0..8b0010af0cd 100644 --- a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx +++ b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx @@ -19,7 +19,7 @@ export const ActivityItemCommentModify = ({ commentContent, scenarioActivityId, const permittedModifyCommentTypes: ActivityType[] = ["SCENARIO_DEPLOYED", "SCENARIO_CANCELED", "SCENARIO_PAUSED"]; open({ - title: "Edit comment", + title: "Modify comment", isModal: true, shouldCloseOnEsc: true, kind: WindowKind.modifyComment, diff --git a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx index da455ffaac9..a627d9f9bba 100644 --- a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx +++ b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx @@ -16,6 +16,7 @@ import { useTranslation } from "react-i18next"; import * as DialogMessages from "../../../../common/DialogMessages"; import { StyledActionIcon } from "./StyledActionIcon"; import { getScenarioActivities } from "../../../../actions/nk/scenarioActivities"; +import { ActivityItemCommentModify } from "./ActivityItemCommentModify"; const StyledHeaderIcon = styled(UrlIcon)(({ theme }) => ({ width: "16px", @@ -23,9 +24,10 @@ const StyledHeaderIcon = styled(UrlIcon)(({ theme }) => ({ color: theme.palette.primary.main, })); -const StyledHeaderActionRoot = styled("div")(() => ({ +const StyledHeaderActionRoot = styled("div")(({ theme }) => ({ display: "flex", marginLeft: "auto", + gap: theme.spacing(0.5), })); const StyledActivityItemHeader = styled("div")<{ isHighlighted: boolean; isRunning: boolean; isActiveFound: boolean }>( @@ -42,11 +44,16 @@ const HeaderActivity = ({ activityAction, scenarioVersionId, activityAttachment, + activityComment, + scenarioActivityId, + activityType, }: { activityAction: ActionMetadata; scenarioVersionId: number; activityAttachment: ActivityAttachment; activityComment: ActivityComment; + scenarioActivityId: string; + activityType: ActivityType; }) => { const { open, confirm } = useWindows(); const processName = useSelector(getProcessName); @@ -123,6 +130,20 @@ const HeaderActivity = ({ ); } + case "add_comment": { + if (activityComment.content.status === "AVAILABLE") { + return null; + } + + return ( + + ); + } default: { return null; } @@ -253,6 +274,8 @@ const ActivityItemHeader = ({ activity, isRunning, isFound, isActiveFound, searc scenarioVersionId={activity.scenarioVersionId} activityAttachment={activity.attachment} activityComment={activity.comment} + activityType={activity.type} + scenarioActivityId={activity.id} /> ))} diff --git a/designer/client/src/components/toolbars/activities/types.ts b/designer/client/src/components/toolbars/activities/types.ts index cca706905e9..5d8059a7303 100644 --- a/designer/client/src/components/toolbars/activities/types.ts +++ b/designer/client/src/components/toolbars/activities/types.ts @@ -25,7 +25,7 @@ export interface ActivityMetadata { } export interface ActionMetadata { - id: "compare" | "delete_comment" | "edit_comment" | "download_attachment" | "delete_attachment"; + id: "compare" | "delete_comment" | "add_comment" | "edit_comment" | "download_attachment" | "delete_attachment"; displayableName: string; icon: string; }