Skip to content

Commit

Permalink
NU-1826 provide a way to add comment to existing activity
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzuming committed Oct 24, 2024
1 parent 92c32ce commit d3f9b8c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ModifyExistingCommentDialog = (props: WindowContentProps<number, ModifyAct
const buttons: WindowButtonProps[] = useMemo(
() => [
{ 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],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ActivityItemCommentModify = ({ commentContent, scenarioActivityId,
const permittedModifyCommentTypes: ActivityType[] = ["SCENARIO_DEPLOYED", "SCENARIO_CANCELED", "SCENARIO_PAUSED"];

open<ModifyActivityCommentMeta>({
title: "Edit comment",
title: "Modify comment",
isModal: true,
shouldCloseOnEsc: true,
kind: WindowKind.modifyComment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ 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",
height: "16px",
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 }>(
Expand All @@ -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);
Expand Down Expand Up @@ -123,6 +130,20 @@ const HeaderActivity = ({
);
}

case "add_comment": {
if (activityComment.content.status === "AVAILABLE") {
return null;
}

return (
<ActivityItemCommentModify
commentContent={activityComment.content}
scenarioActivityId={scenarioActivityId}
activityType={activityType}
activityAction={activityAction}
/>
);
}
default: {
return null;
}
Expand Down Expand Up @@ -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}
/>
))}
</StyledHeaderActionRoot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d3f9b8c

Please sign in to comment.