From 9fc43930bf4e62c04d081294e51b2646406e97b1 Mon Sep 17 00:00:00 2001 From: Nathan Hayfield Date: Thu, 11 Aug 2022 15:45:08 +0200 Subject: [PATCH] =?UTF-8?q?add=20front=20end=20support=20for=20optional=20?= =?UTF-8?q?first=20paragraph=20of=20markdown=20on=20err=E2=80=A6=20(#3546)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add front end support for optional first paragraph of markdown on error messgage --- ui/package.json | 1 + ui/src/components/ErrorPage.tsx | 8 ++++++++ ui/src/types/index.ts | 1 + ui/yarn.lock | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/ui/package.json b/ui/package.json index 12f39ead6..6b9dcf4a3 100644 --- a/ui/package.json +++ b/ui/package.json @@ -30,6 +30,7 @@ "@mui/icons-material": "^5.3.1", "@mui/material": "^5.4.0", "luxon": "^2.3.0", + "markdown-to-jsx": "^7.1.7", "react": "^17.0.2", "react-dom": "^17.0.2", "react-feather": "^2.0.9" diff --git a/ui/src/components/ErrorPage.tsx b/ui/src/components/ErrorPage.tsx index 8086b7917..84787a5f8 100644 --- a/ui/src/components/ErrorPage.tsx +++ b/ui/src/components/ErrorPage.tsx @@ -8,6 +8,7 @@ import Paper from "@mui/material/Paper"; import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; import React, { FC } from "react"; +import Markdown from "markdown-to-jsx"; export type ErrorPageProps = { data: ErrorPageData; @@ -26,6 +27,13 @@ export const ErrorPage: FC = ({ data }) => { {data?.error || "Internal Server Error"} + {!!data?.errorMessageFirstParagraph && ( + + + {data.errorMessageFirstParagraph} + + + )} {data?.requestId ? ( diff --git a/ui/src/types/index.ts b/ui/src/types/index.ts index a8bf7543a..83c3f4fc7 100644 --- a/ui/src/types/index.ts +++ b/ui/src/types/index.ts @@ -96,6 +96,7 @@ export type ErrorPageData = BasePageData & { requestId?: string; status?: number; statusText?: string; + errorMessageFirstParagraph?: string; }; export type UserInfoData = { diff --git a/ui/yarn.lock b/ui/yarn.lock index b7c323c3d..80c4d6c64 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -1873,6 +1873,11 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +markdown-to-jsx@^7.1.7: + version "7.1.7" + resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-7.1.7.tgz#a5f22102fb12241c8cea1ca6a4050bb76b23a25d" + integrity sha512-VI3TyyHlGkO8uFle0IOibzpO1c1iJDcXcS/zBrQrXQQvJ2tpdwVzVZ7XdKsyRz1NdRmre4dqQkMZzUHaKIG/1w== + merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"