From f0c2296fd3ced83adc6ae3eb4cb7988c3973c516 Mon Sep 17 00:00:00 2001 From: Andrew Baldwin Date: Tue, 22 Oct 2024 13:07:28 +0200 Subject: [PATCH] Override markdown link with mui link --- locust/webui/src/components/Markdown/Markdown.tsx | 15 +++++++++++++++ locust/webui/src/components/Table/Table.tsx | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 locust/webui/src/components/Markdown/Markdown.tsx diff --git a/locust/webui/src/components/Markdown/Markdown.tsx b/locust/webui/src/components/Markdown/Markdown.tsx new file mode 100644 index 0000000000..03eb4b3272 --- /dev/null +++ b/locust/webui/src/components/Markdown/Markdown.tsx @@ -0,0 +1,15 @@ +import { Link } from '@mui/material'; +import ReactMarkdown from 'react-markdown'; + +type CustomMarkdownLink = (props: { + href?: string; + children?: React.ReactNode; +}) => React.ReactElement; + +export default function Markdown({ content }: { content: string }) { + return ( + + {content} + + ); +} diff --git a/locust/webui/src/components/Table/Table.tsx b/locust/webui/src/components/Table/Table.tsx index 0d06515cbd..edb10cbb77 100644 --- a/locust/webui/src/components/Table/Table.tsx +++ b/locust/webui/src/components/Table/Table.tsx @@ -7,8 +7,8 @@ import { TableHead, TableRow, } from '@mui/material'; -import Markdown from 'react-markdown'; +import Markdown from 'components/Markdown/Markdown'; import useSortByField, { ISortByFieldOptions } from 'hooks/useSortByField'; import { ITableStructure } from 'types/table.types'; import { roundToDecimalPlaces } from 'utils/number'; @@ -44,7 +44,7 @@ function TableRowContent({ content, formatter, round, markdown }: ITableRowConte } if (markdown) { - return {content as string}; + return ; } return content;