1- import { Text , IconContainer , IconButton , LinkButton , FlexRow } from '@epam/loveship' ;
1+ import { Text , IconContainer , IconButton , LinkButton , FlexRow } from '@epam/loveship' ;
22import { ErrorModal } from './ErrorModal' ;
3+ import { AttachmentModal } from './AttachmentModal' ;
4+ import { ResponseModal } from './ResponseModal' ;
5+ import { LogsModal } from './LogsModal' ;
6+ import { TimeLabel } from './TimeLabel' ;
7+ import { FlexSpacer } from '@epam/uui' ;
8+
39import { ReactComponent as PassedIcon } from '@epam/assets/icons/common/notification-done-24.svg' ;
410import { ReactComponent as FailedIcon } from '@epam/assets/icons/common/navigation-close-24.svg' ;
511import { ReactComponent as SkippedIcon } from '@epam/assets/icons/common/navigation-chevron-right_right-24.svg' ;
@@ -9,15 +15,15 @@ import { ReactComponent as PendingIcon } from '@epam/assets/icons/common/navigat
915import { ReactComponent as ErrorIcon } from '@epam/assets/icons/common/notification-info-fill-24.svg' ;
1016import { ReactComponent as AttachmentIcon } from '@epam/assets/icons/common/file-attachment-24.svg' ;
1117import { ReactComponent as LogsIcon } from '@epam/assets/icons/common/content-code-24.svg' ;
18+ import { ReactComponent as ResponseIcon } from '@epam/assets/icons/common/content-code_braces-24.svg' ;
1219
1320import css from '../App.module.scss' ;
1421import { useUuiContext } from '@epam/uui-core' ;
15- import { AttachmentModal } from './AttachmentModal' ;
1622import { supportedMimeTypes } from '../utils/supportedMimeTypes' ;
1723import { openInNewTab } from '../utils/openInNewTab' ;
18- import { LogsModal } from './LogsModal' ;
19- import { TimeLabel } from './TimeLabel ';
20- import { FlexSpacer } from '@epam/uui ';
24+
25+ const logPlainMimeType = 'text/x.cucumber.log+plain ';
26+ const responseMimeType = 'text/x.response.json ';
2127
2228const icon = ( status : string ) => {
2329 switch ( status ) {
@@ -69,11 +75,15 @@ const handleLogsClick = (logs: any[], svc: any) => {
6975 return ( ) => svc . uuiModals . show ( ( props : any ) => < LogsModal { ...props } logs = { logs } /> )
7076}
7177
78+ const handleResponseClick = ( response : any , svc : any ) => {
79+ return ( ) => svc . uuiModals . show ( ( props : any ) => < ResponseModal { ...props } response = { response } /> )
80+ }
81+
7282export const Step = ( { step} : { step : any } ) => {
7383 const svc = useUuiContext ( ) ;
74- const logs = step . embeddings
75- ? step . embeddings . filter ( ( embedding : any ) => embedding . mime_type === 'text/x.cucumber.log+plain' )
76- : [ ] ;
84+ const logs = step . embeddings ?. filter ( ( embedding : any ) => embedding . mime_type === logPlainMimeType ) ?? [ ] ;
85+ const responses = step . embeddings ? .filter ( ( embedding : any ) => embedding . mime_type === responseMimeType ) ?? [ ] ;
86+ const attachments = step . embeddings ?. filter ( ( embedding : any ) => ! [ logPlainMimeType , responseMimeType ] . includes ( embedding . mime_type ) ) ?? [ ] ;
7787 return < div >
7888 < FlexRow >
7989 { icon ( step . result . status ) }
@@ -88,10 +98,17 @@ export const Step = ({step}: {step: any}) => {
8898 caption = 'Logs'
8999 onClick = { handleLogsClick ( logs , svc ) }
90100 /> }
91- { step . embeddings && step . embeddings
92- . filter ( ( embedding : any ) => embedding . mime_type !== 'text/x.cucumber.log+plain' )
101+ { responses
102+ . map ( ( embedding : any , index : any ) => < LinkButton
103+ key = { `response-${ index } ` }
104+ icon = { ResponseIcon }
105+ caption = 'Response'
106+ onClick = { handleResponseClick ( embedding , svc ) }
107+ /> )
108+ }
109+ { attachments
93110 . map ( ( embedding : any , index : any ) => < LinkButton
94- key = { index }
111+ key = { `attachment- ${ index } ` }
95112 icon = { AttachmentIcon }
96113 caption = { embedding . fileName ?? embedding . mime_type }
97114 onClick = { handleAttachmentClick ( embedding , svc ) }
0 commit comments