Skip to content

Commit

Permalink
Merge pull request #115 from mercedes-benz/develop
Browse files Browse the repository at this point in the history
Sprint 27 Release
  • Loading branch information
brahmprakashMishra committed May 7, 2024
2 parents eacc56e + 62eba33 commit 8f6c681
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/component/misc/DataGridExpandRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Box from '@mui/material/Box';
import { Paper, Popper, Typography } from '@mui/material';
import { GridRenderCellParams } from '@mui/x-data-grid';
import { useEffect } from 'react';
import { RenderString } from '../../report/ReportRecordProcessing';

interface GridCellExpandProps {
value: string;
Expand Down Expand Up @@ -106,14 +107,7 @@ const GridCellExpand = React.memo((props: GridCellExpandProps) => {

export function renderCellExpand(params: GridRenderCellParams<any, string>, lineBreakAfterListEntry: boolean) {
let value = params.value?.low ? params.value.low : params.value;
const displayLink = typeof value === 'string' || value instanceof String ? RenderString(value) : '';
return <GridCellExpand value={displayLink} width={params.colDef.computedWidth} />;

const stringifiedObj = value
? JSON.stringify(value)
.replaceAll(',', lineBreakAfterListEntry ? ',\r\n' : ', ') // TODO: Consolidate to a regex
.replaceAll(']', '')
.replaceAll('[', '')
.replaceAll('"', '')
: '';

return <GridCellExpand value={stringifiedObj || ''} width={params.colDef.computedWidth} />;
}
2 changes: 1 addition & 1 deletion src/report/ReportRecordProcessing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function RenderArray(value) {
return mapped;
}

function RenderString(value) {
export function RenderString(value) {
const str = value?.toString() || '';
if (str.startsWith('http') || str.startsWith('https')) {
return (
Expand Down

0 comments on commit 8f6c681

Please sign in to comment.