diff --git a/compliance-api/src/compliance_api/schemas/continuation_report.py b/compliance-api/src/compliance_api/schemas/continuation_report.py index 9df97fca..ddb6a6e3 100644 --- a/compliance-api/src/compliance_api/schemas/continuation_report.py +++ b/compliance-api/src/compliance_api/schemas/continuation_report.py @@ -55,7 +55,7 @@ def post_dump_actions( ): # pylint: disable=no-self-use, unused-argument """Extract the value of key_context enum.""" if "key_context" in data and data["key_context"] is not None: - data["key_context"] = ContextEnum(data["key_context"]).name + data["key_context"] = ContextEnum(data["key_context"]).value else: data["key_context"] = "" return data @@ -87,7 +87,7 @@ def post_dump_actions( ): # pylint: disable=no-self-use, unused-argument """Extract the value of context enum.""" if "context_type" in data and data["context_type"] is not None: - data["context_type"] = ContextEnum(data["context_type"]).name + data["context_type"] = ContextEnum(data["context_type"]).value else: data["context_type"] = "" return data diff --git a/compliance-web/src/components/App/ContinuationReports/ContinuationReportTimeline.tsx b/compliance-web/src/components/App/ContinuationReports/ContinuationReportTimeline.tsx index b109ac3f..6117e821 100644 --- a/compliance-web/src/components/App/ContinuationReports/ContinuationReportTimeline.tsx +++ b/compliance-web/src/components/App/ContinuationReports/ContinuationReportTimeline.tsx @@ -1,21 +1,21 @@ +import { KC_USER_GROUPS, useIsRolesAllowed } from "@/hooks/useAuthorization"; +import { ContinuationReport } from "@/models/ContinuationReport"; +import { useModal } from "@/store/modalStore"; +import { notify } from "@/store/snackbarStore"; import dateUtils from "@/utils/dateUtils"; import Timeline from "@mui/lab/Timeline"; -import TimelineItem from "@mui/lab/TimelineItem"; -import TimelineSeparator from "@mui/lab/TimelineSeparator"; import TimelineConnector from "@mui/lab/TimelineConnector"; import TimelineDot from "@mui/lab/TimelineDot"; +import TimelineItem from "@mui/lab/TimelineItem"; import TimelineOppositeContent from "@mui/lab/TimelineOppositeContent"; +import TimelineSeparator from "@mui/lab/TimelineSeparator"; import { Stack, Typography } from "@mui/material"; -import { ContinuationReport } from "@/models/ContinuationReport"; -import ContinuationReportTimelineEntry from "./ContinuationReportTimelineEntry"; +import { useQueryClient } from "@tanstack/react-query"; import { BCDesignTokens } from "epic.theme"; import { useCallback } from "react"; -import { useModal } from "@/store/modalStore"; -import ContinuationReportEntryModal from "./ContinuationReportEntryModal"; -import { useQueryClient } from "@tanstack/react-query"; -import { notify } from "@/store/snackbarStore"; import { useAuth } from "react-oidc-context"; -import { useIsRolesAllowed, KC_USER_GROUPS } from "@/hooks/useAuthorization"; +import ContinuationReportEntryModal from "./ContinuationReportEntryModal"; +import ContinuationReportTimelineEntry from "./ContinuationReportTimelineEntry"; interface ContinuationReportTimelineProps { crtList: ContinuationReport[]; @@ -125,6 +125,7 @@ export default function ContinuationReportTimeline({ { + if (keys && keys.length > 0) { + keys.forEach((key) => { + const regEx = new RegExp(key.key, "gi"); + renderText = renderText.replace( + regEx, + `${key.key}` + ); + }); + } + return renderText; + }; const getFormattedText = () => { + renderText = applyNavigationLinks(); if (!searchText) return renderText; // Create a temporary DOM element to parse the HTML diff --git a/compliance-web/src/models/ContinuationReport.ts b/compliance-web/src/models/ContinuationReport.ts index 6a3e0cd2..4f32395c 100644 --- a/compliance-web/src/models/ContinuationReport.ts +++ b/compliance-web/src/models/ContinuationReport.ts @@ -15,7 +15,7 @@ export interface ContinuationReport { keys: CRKeys[]; } -interface CRKeys { +export interface CRKeys { key_context: string; id: number; key: string; diff --git a/compliance-web/src/utils/constants.ts b/compliance-web/src/utils/constants.ts index 31773c08..873f7bbe 100644 --- a/compliance-web/src/utils/constants.ts +++ b/compliance-web/src/utils/constants.ts @@ -25,4 +25,10 @@ export const CR_CONTEXT_TYPE = { CASEFILE: "Casefile", } +export const CR_CONTEXT_LINK: Record = { + "Inspection": "/ce-database/inspections", + "Complaint": "/ce-database/complaints", + "Casefile": "/ce-database/case-files", +} + export const FILE_PROFILE_CONTEXT = CR_CONTEXT_TYPE;