diff --git a/src/components/ArtifactsPreview/ArtifactsPreview.js b/src/components/ArtifactsPreview/ArtifactsPreview.js index a7d81b23bd..fb43f498dd 100644 --- a/src/components/ArtifactsPreview/ArtifactsPreview.js +++ b/src/components/ArtifactsPreview/ArtifactsPreview.js @@ -21,10 +21,13 @@ import React, { useState } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' +import Accordion from '../../common/Accordion/Accordion' import ArtifactsPreviewView from './ArtifactsPreviewView' import Loader from '../../common/Loader/Loader' import NoData from '../../common/NoData/NoData' +import { ReactComponent as Arrow } from 'igz-controls/images/arrow.svg' + const ArtifactsPreview = ({ className, extraData, noData, preview, showExtraDataLoader }) => { const [showErrorBody, setShowErrorBody] = useState(false) const artifactsPreviewClasses = classnames('artifact-preview', className) @@ -50,14 +53,20 @@ const ArtifactsPreview = ({ className, extraData, noData, preview, showExtraData

Extra Data

{extraData.map((extraDataItem, index) => ( - + } + iconClassName="expand-icon" + alwaysOpened={false} + openByDefault={false} + > + + ))}
)} diff --git a/src/components/ArtifactsPreview/ArtifactsPreviewView.js b/src/components/ArtifactsPreview/ArtifactsPreviewView.js index f93b9bebf4..07762a9575 100644 --- a/src/components/ArtifactsPreview/ArtifactsPreviewView.js +++ b/src/components/ArtifactsPreview/ArtifactsPreviewView.js @@ -21,24 +21,15 @@ import React, { useMemo } from 'react' import PropTypes from 'prop-types' import Prism from 'prismjs' -import Accordion from '../../common/Accordion/Accordion' import DetailsResults from '../DetailsResults/DetailsResults' import PreviewError from './PreviewError/PreviewError' import { Tooltip, TextTooltipTemplate } from 'igz-controls/components' -import { ReactComponent as Arrow } from 'igz-controls/images/arrow.svg' - import { ARTIFACT_PREVIEW_TABLE_ROW_LIMIT } from '../../constants' import './artifactsPreview.scss' -const ArtifactsPreviewView = ({ - className, - preview, - setShowErrorBody, - showAccordion, - showErrorBody -}) => { +const ArtifactsPreviewView = ({ className, preview, setShowErrorBody, showErrorBody }) => { const content = useMemo( () => preview.data && preview.data.content @@ -49,127 +40,109 @@ const ArtifactsPreviewView = ({ return ( !preview?.hidden && ( - : null} - iconClassName="expand-icon" - alwaysOpened={!showAccordion} - openByDefault={!showAccordion} - > -
- {preview.header && ( -
-
{preview.header}
-
- )} -
- {preview?.type === 'error' ? ( - - ) : ( - <> - {preview?.type === 'table-results' && ( -
- +
+ {preview.header && ( +
+
{preview.header}
+
+ )} +
+ {preview?.type === 'error' ? ( + + ) : ( + <> + {preview?.type === 'table-results' && ( +
+ +
+ )} + {preview?.type === 'table' && ( +
+
+ {preview.data.headers.map((header, index) => { + return ( +
+ }> + {header} + +
+ ) + })}
- )} - {preview?.type === 'table' && ( -
-
- {preview.data.headers.map((header, index) => { - return ( -
- }> - {header} - -
- ) - })} -
-
- {content.map((contentItem, index) => ( -
- {Array.isArray(contentItem) ? ( - contentItem.map(value => ( - } - > - {typeof value === 'object' && value !== null - ? JSON.stringify(value) - : String(value)} - - )) - ) : ( +
+ {content.map((contentItem, index) => ( +
+ {Array.isArray(contentItem) ? ( + contentItem.map(value => ( } + key={`${value}${Math.random()}`} + template={} > - {contentItem} + {typeof value === 'object' && value !== null + ? JSON.stringify(value) + : String(value)} - )} -
- ))} -
-
- )} - {preview?.type === 'text' &&
{preview?.data.content}
} - {preview?.type === 'html' && ( -