feat: rm view mode logic
This commit is contained in:
@@ -59,8 +59,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
|
|
||||||
const [expandedView, setExpandedView] = useState<string | null>(null);
|
const [expandedView, setExpandedView] = useState<string | null>(null);
|
||||||
|
|
||||||
const [viewMode, setViewMode] = useState<'horizontal' | 'vertical'>('vertical');
|
|
||||||
|
|
||||||
const [legacyData, setLegacyData] = useState<any[]>([]);
|
const [legacyData, setLegacyData] = useState<any[]>([]);
|
||||||
const [legacyColumns, setLegacyColumns] = useState<string[]>([]);
|
const [legacyColumns, setLegacyColumns] = useState<string[]>([]);
|
||||||
const [isLegacyData, setIsLegacyData] = useState<boolean>(false);
|
const [isLegacyData, setIsLegacyData] = useState<boolean>(false);
|
||||||
@@ -754,93 +752,34 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
{hasData && (
|
{hasData && (
|
||||||
<Box sx={{ mb: 3 }}>
|
<Box sx={{ mb: 3 }}>
|
||||||
{isLegacyData && (
|
{isLegacyData && (
|
||||||
viewMode === 'vertical' ? (
|
renderDataTable(
|
||||||
renderDataTable(
|
legacyData,
|
||||||
legacyData,
|
legacyColumns,
|
||||||
legacyColumns,
|
t('run_content.captured_data.title'),
|
||||||
t('run_content.captured_data.title'),
|
'data.csv',
|
||||||
'data.csv',
|
'data.json'
|
||||||
'data.json'
|
|
||||||
)
|
|
||||||
) : (
|
|
||||||
<Grid container spacing={3}>
|
|
||||||
<Grid item xs={12} md={12}>
|
|
||||||
{renderDataCard(
|
|
||||||
legacyData,
|
|
||||||
legacyColumns,
|
|
||||||
t('run_content.captured_data.title'),
|
|
||||||
'legacy',
|
|
||||||
'data.csv',
|
|
||||||
'data.json'
|
|
||||||
)}
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isLegacyData && (
|
{!isLegacyData && (
|
||||||
viewMode === 'vertical' ? (
|
<>
|
||||||
<>
|
{renderDataTable(
|
||||||
{renderDataTable(
|
schemaData,
|
||||||
schemaData,
|
schemaColumns,
|
||||||
schemaColumns,
|
t('run_content.captured_data.schema_title'),
|
||||||
t('run_content.captured_data.schema_title'),
|
'schema_data.csv',
|
||||||
'schema_data.csv',
|
'schema_data.json'
|
||||||
'schema_data.json'
|
)}
|
||||||
)}
|
|
||||||
|
|
||||||
{listData.length > 0 && renderDataTable(
|
{listData.length > 0 && renderDataTable(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
t('run_content.captured_data.list_title'),
|
t('run_content.captured_data.list_title'),
|
||||||
'list_data.csv',
|
'list_data.csv',
|
||||||
'list_data.json',
|
'list_data.json',
|
||||||
true
|
true
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
|
||||||
<Grid container spacing={3}>
|
|
||||||
{(() => {
|
|
||||||
const dataCategoriesCount = [
|
|
||||||
schemaData.length > 0,
|
|
||||||
listData.length > 0,
|
|
||||||
].filter(Boolean).length;
|
|
||||||
|
|
||||||
const columnWidth = dataCategoriesCount === 1 ? 12 : dataCategoriesCount === 2 ? 6 : 4;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{schemaData.length > 0 && (
|
|
||||||
<Grid item xs={12} md={columnWidth} sx={{ display: 'flex' }}>
|
|
||||||
{renderDataCard(
|
|
||||||
schemaData,
|
|
||||||
schemaColumns,
|
|
||||||
t('run_content.captured_data.schema_title'),
|
|
||||||
'schema',
|
|
||||||
'schema_data.csv',
|
|
||||||
'schema_data.json'
|
|
||||||
)}
|
|
||||||
</Grid>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{listData.length > 0 && (
|
|
||||||
<Grid item xs={12} md={columnWidth} sx={{ display: 'flex' }}>
|
|
||||||
{renderDataCard(
|
|
||||||
[],
|
|
||||||
[],
|
|
||||||
t('run_content.captured_data.list_title'),
|
|
||||||
'list',
|
|
||||||
'list_data.csv',
|
|
||||||
'list_data.json',
|
|
||||||
true
|
|
||||||
)}
|
|
||||||
</Grid>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
})()}
|
|
||||||
</Grid>
|
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{renderExpandedView('schema')}
|
{renderExpandedView('schema')}
|
||||||
@@ -850,120 +789,11 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasScreenshots && (
|
{/* {hasScreenshots && (
|
||||||
<>
|
<>
|
||||||
{viewMode === 'vertical' ? (
|
{renderPaginatedScreenshots()}
|
||||||
<>
|
|
||||||
{Object.keys(row.binaryOutput).map((key, index) => {
|
|
||||||
try {
|
|
||||||
const imageUrl = row.binaryOutput[key];
|
|
||||||
return (
|
|
||||||
<Accordion defaultExpanded sx={{ mb: 2 }} key={`screenshot-${key}`}>
|
|
||||||
<AccordionSummary
|
|
||||||
expandIcon={<ExpandMoreIcon />}
|
|
||||||
aria-controls={`screenshot-${key}-content`}
|
|
||||||
id={`screenshot-${key}-header`}
|
|
||||||
>
|
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
|
||||||
<ImageIcon sx={{ color: '#FF00C3' }} />
|
|
||||||
<Typography variant='h6' sx={{ ml: 2 }}>
|
|
||||||
Screenshot {index + 1}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
</AccordionSummary>
|
|
||||||
<AccordionDetails>
|
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 2 }}>
|
|
||||||
<ButtonGroup size="small" variant="outlined">
|
|
||||||
<Button
|
|
||||||
startIcon={<DownloadIcon />}
|
|
||||||
href={imageUrl}
|
|
||||||
download={key}
|
|
||||||
sx={{ borderColor: '#FF00C3', color: '#FF00C3' }}
|
|
||||||
>
|
|
||||||
{t('run_content.captured_screenshot.download')}
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<img
|
|
||||||
src={imageUrl}
|
|
||||||
alt={`Screenshot ${key}`}
|
|
||||||
style={{
|
|
||||||
maxWidth: '100%',
|
|
||||||
height: 'auto',
|
|
||||||
border: '1px solid #e0e0e0',
|
|
||||||
borderRadius: '4px'
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</AccordionDetails>
|
|
||||||
</Accordion>
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
return (
|
|
||||||
<Typography key={`screenshot-error-${key}`} color="error">
|
|
||||||
{key}: {t('run_content.captured_screenshot.render_failed')}
|
|
||||||
</Typography>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Grid container spacing={3}>
|
|
||||||
{Object.keys(row.binaryOutput).map((key) => {
|
|
||||||
try {
|
|
||||||
const imageUrl = row.binaryOutput[key];
|
|
||||||
return (
|
|
||||||
<Grid item xs={12} md={6} key={`screenshot-${key}`}>
|
|
||||||
<Card sx={{ height: '100%', boxShadow: 3 }}>
|
|
||||||
<CardHeader
|
|
||||||
avatar={<ImageIcon sx={{ color: '#FF00C3' }} />}
|
|
||||||
title={`Screenshot ${key}`}
|
|
||||||
action={
|
|
||||||
<IconButton
|
|
||||||
size="small"
|
|
||||||
href={imageUrl}
|
|
||||||
download={key}
|
|
||||||
title={t('run_content.captured_screenshot.download')}
|
|
||||||
>
|
|
||||||
<DownloadIcon />
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<CardContent sx={{ p: 1 }}>
|
|
||||||
<Box sx={{ position: 'relative', width: '100%', height: 'auto', overflow: 'hidden' }}>
|
|
||||||
<img
|
|
||||||
src={imageUrl}
|
|
||||||
alt={`Screenshot ${key}`}
|
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
height: 'auto',
|
|
||||||
objectFit: 'contain',
|
|
||||||
border: '1px solid #e0e0e0',
|
|
||||||
borderRadius: '4px'
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Grid>
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
return (
|
|
||||||
<Box key={`screenshot-error-${key}`}>
|
|
||||||
<Typography color="error">
|
|
||||||
{key}: {t('run_content.captured_screenshot.render_failed')}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</Grid>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)} */}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabContext>
|
</TabContext>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user