From 7be1da06aea22aa1bcf7a1082be1b72f70922ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=BCller?= Date: Tue, 7 May 2024 19:41:00 +0200 Subject: [PATCH] Status.tsx: show as many different error types as possible (HMS-1442) --- src/Components/ImagesTable/Status.tsx | 45 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/Components/ImagesTable/Status.tsx b/src/Components/ImagesTable/Status.tsx index b696419e2..06299eaf7 100644 --- a/src/Components/ImagesTable/Status.tsx +++ b/src/Components/ImagesTable/Status.tsx @@ -4,11 +4,14 @@ import './ImageBuildStatus.scss'; import { Alert, Button, + CodeBlock, + CodeBlockCode, Flex, Panel, PanelMain, Popover, Skeleton, + Text, } from '@patternfly/react-core'; import { CheckCircleIcon, @@ -288,19 +291,24 @@ type ErrorStatusPropTypes = { const ErrorStatus = ({ icon, text, error }: ErrorStatusPropTypes) => { let reason = ''; + const detailsArray: string[] = []; if (typeof error === 'string') { reason = error; } else { if (error.reason) { reason = error.reason; } - if (error.details?.reason) { - if (reason !== '') { - reason = `${reason}\n\n${error.details?.reason}`; - } else { - reason = error.details.reason; + if (Array.isArray(error.details)) { + for (const line in error.details) { + detailsArray.push(`${error.details[line]}`); } } + if (typeof error.details === 'string') { + detailsArray.push(error.details); + } + if (error.details?.reason) { + detailsArray.push(`${error.details.reason}`); + } } return ( @@ -309,24 +317,29 @@ const ErrorStatus = ({ icon, text, error }: ErrorStatusPropTypes) => { + {reason} -
-

{reason}

- -
+ + {detailsArray.join('\n')} +
+ } >