fix: lint

This commit is contained in:
amhsirak
2025-04-30 19:57:38 +05:30
parent f1d0cbdaae
commit f1c148817a
2 changed files with 137 additions and 138 deletions

View File

@@ -50,7 +50,6 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"loglevel": "^1.8.0", "loglevel": "^1.8.0",
"loglevel-plugin-remote": "^0.6.8", "loglevel-plugin-remote": "^0.6.8",
"maxun-core": "^0.0.15",
"minio": "^8.0.1", "minio": "^8.0.1",
"moment-timezone": "^0.5.45", "moment-timezone": "^0.5.45",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",

View File

@@ -38,16 +38,16 @@ interface RunContentProps {
export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRef, abortRunHandler }: RunContentProps) => { export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRef, abortRunHandler }: RunContentProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [tab, setTab] = React.useState<string>('output'); const [tab, setTab] = React.useState<string>('output');
const [schemaData, setSchemaData] = useState<any[]>([]); const [schemaData, setSchemaData] = useState<any[]>([]);
const [schemaColumns, setSchemaColumns] = useState<string[]>([]); const [schemaColumns, setSchemaColumns] = useState<string[]>([]);
const [listData, setListData] = useState<any[][]>([]); const [listData, setListData] = useState<any[][]>([]);
const [listColumns, setListColumns] = useState<string[][]>([]); const [listColumns, setListColumns] = useState<string[][]>([]);
const [currentListIndex, setCurrentListIndex] = useState<number>(0); const [currentListIndex, setCurrentListIndex] = useState<number>(0);
const [expandedView, setExpandedView] = useState<string | null>(null); const [expandedView, setExpandedView] = useState<string | null>(null);
const [viewMode, setViewMode] = useState<'horizontal' | 'vertical'>('vertical'); const [viewMode, setViewMode] = useState<'horizontal' | 'vertical'>('vertical');
const [legacyData, setLegacyData] = useState<any[]>([]); const [legacyData, setLegacyData] = useState<any[]>([]);
@@ -61,10 +61,10 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
useEffect(() => { useEffect(() => {
if (!row.serializableOutput) return; if (!row.serializableOutput) return;
if (!row.serializableOutput.scrapeSchema && if (!row.serializableOutput.scrapeSchema &&
!row.serializableOutput.scrapeList && !row.serializableOutput.scrapeList &&
Object.keys(row.serializableOutput).length > 0) { Object.keys(row.serializableOutput).length > 0) {
setIsLegacyData(true); setIsLegacyData(true);
processLegacyData(row.serializableOutput); processLegacyData(row.serializableOutput);
return; return;
@@ -75,7 +75,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
if (row.serializableOutput.scrapeSchema && Object.keys(row.serializableOutput.scrapeSchema).length > 0) { if (row.serializableOutput.scrapeSchema && Object.keys(row.serializableOutput.scrapeSchema).length > 0) {
processDataCategory(row.serializableOutput.scrapeSchema, setSchemaData, setSchemaColumns); processDataCategory(row.serializableOutput.scrapeSchema, setSchemaData, setSchemaColumns);
} }
if (row.serializableOutput.scrapeList) { if (row.serializableOutput.scrapeList) {
processScrapeList(row.serializableOutput.scrapeList); processScrapeList(row.serializableOutput.scrapeList);
} }
@@ -83,7 +83,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
const processLegacyData = (legacyOutput: Record<string, any>) => { const processLegacyData = (legacyOutput: Record<string, any>) => {
let allData: any[] = []; let allData: any[] = [];
Object.keys(legacyOutput).forEach(key => { Object.keys(legacyOutput).forEach(key => {
const data = legacyOutput[key]; const data = legacyOutput[key];
if (Array.isArray(data)) { if (Array.isArray(data)) {
@@ -93,13 +93,13 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
allData = [...allData, ...filteredData]; allData = [...allData, ...filteredData];
} }
}); });
if (allData.length > 0) { if (allData.length > 0) {
const allColumns = new Set<string>(); const allColumns = new Set<string>();
allData.forEach(item => { allData.forEach(item => {
Object.keys(item).forEach(key => allColumns.add(key)); Object.keys(item).forEach(key => allColumns.add(key));
}); });
setLegacyData(allData); setLegacyData(allData);
setLegacyColumns(Array.from(allColumns)); setLegacyColumns(Array.from(allColumns));
} }
@@ -111,7 +111,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
setColumns: React.Dispatch<React.SetStateAction<string[]>> setColumns: React.Dispatch<React.SetStateAction<string[]>>
) => { ) => {
let allData: any[] = []; let allData: any[] = [];
Object.keys(categoryData).forEach(key => { Object.keys(categoryData).forEach(key => {
const data = categoryData[key]; const data = categoryData[key];
if (Array.isArray(data)) { if (Array.isArray(data)) {
@@ -121,13 +121,13 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
allData = [...allData, ...filteredData]; allData = [...allData, ...filteredData];
} }
}); });
if (allData.length > 0) { if (allData.length > 0) {
const allColumns = new Set<string>(); const allColumns = new Set<string>();
allData.forEach(item => { allData.forEach(item => {
Object.keys(item).forEach(key => allColumns.add(key)); Object.keys(item).forEach(key => allColumns.add(key));
}); });
setData(allData); setData(allData);
setColumns(Array.from(allColumns)); setColumns(Array.from(allColumns));
} }
@@ -136,22 +136,22 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
const processScrapeList = (scrapeListData: any) => { const processScrapeList = (scrapeListData: any) => {
const tablesList: any[][] = []; const tablesList: any[][] = [];
const columnsList: string[][] = []; const columnsList: string[][] = [];
if (Array.isArray(scrapeListData)) { if (Array.isArray(scrapeListData)) {
scrapeListData.forEach(tableData => { scrapeListData.forEach(tableData => {
if (Array.isArray(tableData) && tableData.length > 0) { if (Array.isArray(tableData) && tableData.length > 0) {
const filteredData = tableData.filter(row => const filteredData = tableData.filter(row =>
Object.values(row).some(value => value !== undefined && value !== "") Object.values(row).some(value => value !== undefined && value !== "")
); );
if (filteredData.length > 0) { if (filteredData.length > 0) {
tablesList.push(filteredData); tablesList.push(filteredData);
const tableColumns = new Set<string>(); const tableColumns = new Set<string>();
filteredData.forEach(item => { filteredData.forEach(item => {
Object.keys(item).forEach(key => tableColumns.add(key)); Object.keys(item).forEach(key => tableColumns.add(key));
}); });
columnsList.push(Array.from(tableColumns)); columnsList.push(Array.from(tableColumns));
} }
} }
@@ -163,21 +163,21 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
const filteredData = tableData.filter(row => const filteredData = tableData.filter(row =>
Object.values(row).some(value => value !== undefined && value !== "") Object.values(row).some(value => value !== undefined && value !== "")
); );
if (filteredData.length > 0) { if (filteredData.length > 0) {
tablesList.push(filteredData); tablesList.push(filteredData);
const tableColumns = new Set<string>(); const tableColumns = new Set<string>();
filteredData.forEach(item => { filteredData.forEach(item => {
Object.keys(item).forEach(key => tableColumns.add(key)); Object.keys(item).forEach(key => tableColumns.add(key));
}); });
columnsList.push(Array.from(tableColumns)); columnsList.push(Array.from(tableColumns));
} }
} }
}); });
} }
setListData(tablesList); setListData(tablesList);
setListColumns(columnsList); setListColumns(columnsList);
setCurrentListIndex(0); setCurrentListIndex(0);
@@ -217,7 +217,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
setTimeout(() => { setTimeout(() => {
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
}, 100); }, 100);
@@ -225,7 +225,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
const downloadAllJSON = () => { const downloadAllJSON = () => {
let allData; let allData;
if (isLegacyData) { if (isLegacyData) {
allData = { data: legacyData }; allData = { data: legacyData };
} else { } else {
@@ -234,7 +234,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
list: listData.flat(), list: listData.flat(),
}; };
} }
const blob = new Blob([JSON.stringify(allData, null, 2)], { type: 'application/json;charset=utf-8;' }); const blob = new Blob([JSON.stringify(allData, null, 2)], { type: 'application/json;charset=utf-8;' });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
@@ -265,12 +265,12 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
) => { ) => {
if (!isPaginatedList && data.length === 0) return null; if (!isPaginatedList && data.length === 0) return null;
if (isPaginatedList && (listData.length === 0 || currentListIndex >= listData.length)) return null; if (isPaginatedList && (listData.length === 0 || currentListIndex >= listData.length)) return null;
const currentData = isPaginatedList ? listData[currentListIndex] : data; const currentData = isPaginatedList ? listData[currentListIndex] : data;
const currentColumns = isPaginatedList ? listColumns[currentListIndex] : columns; const currentColumns = isPaginatedList ? listColumns[currentListIndex] : columns;
if (!currentData || currentData.length === 0) return null; if (!currentData || currentData.length === 0) return null;
return ( return (
<Accordion defaultExpanded sx={{ mb: 2 }}> <Accordion defaultExpanded sx={{ mb: 2 }}>
<AccordionSummary <AccordionSummary
@@ -284,19 +284,19 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
{title} {title}
</Typography> </Typography>
{isPaginatedList ? ( {isPaginatedList ? (
<Chip <Chip
label={listData.length > 1 label={listData.length > 1
? `Table ${currentListIndex + 1} of ${listData.length} (${currentData.length} ${currentData.length === 1 ? 'item' : 'items'})` ? `Table ${currentListIndex + 1} of ${listData.length} (${currentData.length} ${currentData.length === 1 ? 'item' : 'items'})`
: `${currentData.length} ${currentData.length === 1 ? 'item' : 'items'}` : `${currentData.length} ${currentData.length === 1 ? 'item' : 'items'}`
} }
size="small" size="small"
sx={{ ml: 2, backgroundColor: '#FF00C3', color: 'white' }} sx={{ ml: 2, backgroundColor: '#FF00C3', color: 'white' }}
/> />
) : ( ) : (
<Chip <Chip
label={`${data.length} ${data.length === 1 ? 'item' : 'items'}`} label={`${data.length} ${data.length === 1 ? 'item' : 'items'}`}
size="small" size="small"
sx={{ ml: 2, backgroundColor: '#FF00C3', color: 'white' }} sx={{ ml: 2, backgroundColor: '#FF00C3', color: 'white' }}
/> />
)} )}
</Box> </Box>
@@ -308,7 +308,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
startIcon={<DownloadIcon />} startIcon={<DownloadIcon />}
onClick={() => { onClick={() => {
if (isPaginatedList) { if (isPaginatedList) {
downloadCSV(currentData, currentColumns, `list_table_${currentListIndex+1}.csv`); downloadCSV(currentData, currentColumns, `list_table_${currentListIndex + 1}.csv`);
} else { } else {
downloadCSV(data, columns, csvFilename); downloadCSV(data, columns, csvFilename);
} }
@@ -321,7 +321,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
startIcon={<DataObjectIcon />} startIcon={<DataObjectIcon />}
onClick={() => { onClick={() => {
if (isPaginatedList) { if (isPaginatedList) {
downloadJSON(currentData, `list_table_${currentListIndex+1}.json`); downloadJSON(currentData, `list_table_${currentListIndex + 1}.json`);
} else { } else {
downloadJSON(data, jsonFilename); downloadJSON(data, jsonFilename);
} }
@@ -331,14 +331,14 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
JSON JSON
</Button> </Button>
</ButtonGroup> </ButtonGroup>
{isPaginatedList && listData.length > 1 && ( {isPaginatedList && listData.length > 1 && (
<ButtonGroup size="small"> <ButtonGroup size="small">
<Button <Button
onClick={() => navigateListTable('prev')} onClick={() => navigateListTable('prev')}
disabled={currentListIndex === 0} disabled={currentListIndex === 0}
sx={{ sx={{
borderColor: '#FF00C3', borderColor: '#FF00C3',
color: currentListIndex === 0 ? 'gray' : '#FF00C3', color: currentListIndex === 0 ? 'gray' : '#FF00C3',
'&.Mui-disabled': { '&.Mui-disabled': {
borderColor: 'rgba(0, 0, 0, 0.12)' borderColor: 'rgba(0, 0, 0, 0.12)'
@@ -350,7 +350,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<Button <Button
onClick={() => navigateListTable('next')} onClick={() => navigateListTable('next')}
disabled={currentListIndex === listData.length - 1} disabled={currentListIndex === listData.length - 1}
sx={{ sx={{
color: currentListIndex === listData.length - 1 ? 'gray' : '#FF00C3', color: currentListIndex === listData.length - 1 ? 'gray' : '#FF00C3',
'&.Mui-disabled': { '&.Mui-disabled': {
borderColor: 'rgba(0, 0, 0, 0.12)' borderColor: 'rgba(0, 0, 0, 0.12)'
@@ -401,20 +401,20 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
) => { ) => {
if (!isPaginatedList && data.length === 0) return null; if (!isPaginatedList && data.length === 0) return null;
if (isPaginatedList && (listData.length === 0 || currentListIndex >= listData.length)) return null; if (isPaginatedList && (listData.length === 0 || currentListIndex >= listData.length)) return null;
const currentData = isPaginatedList ? listData[currentListIndex] : data; const currentData = isPaginatedList ? listData[currentListIndex] : data;
const currentColumns = isPaginatedList ? listColumns[currentListIndex] : columns; const currentColumns = isPaginatedList ? listColumns[currentListIndex] : columns;
if (!currentData || currentData.length === 0) return null; if (!currentData || currentData.length === 0) return null;
const previewData = currentData.slice(0, 1); const previewData = currentData.slice(0, 1);
const previewColumns = currentColumns.slice(0, 3); const previewColumns = currentColumns.slice(0, 3);
const showMoreColumns = currentColumns.length > 3; const showMoreColumns = currentColumns.length > 3;
return ( return (
<Card sx={{ <Card sx={{
width: '100%', width: '100%',
mb: 3, mb: 3,
height: '100%', height: '100%',
display: 'flex', display: 'flex',
@@ -426,11 +426,11 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
title={title} title={title}
action={ action={
<Box> <Box>
<IconButton <IconButton
size="small" size="small"
onClick={() => { onClick={() => {
if (isPaginatedList) { if (isPaginatedList) {
downloadCSV(currentData, currentColumns, `list_table_${currentListIndex+1}.csv`); downloadCSV(currentData, currentColumns, `list_table_${currentListIndex + 1}.csv`);
} else { } else {
downloadCSV(data, columns, csvFilename); downloadCSV(data, columns, csvFilename);
} }
@@ -439,11 +439,11 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
> >
<DownloadIcon /> <DownloadIcon />
</IconButton> </IconButton>
<IconButton <IconButton
size="small" size="small"
onClick={() => { onClick={() => {
if (isPaginatedList) { if (isPaginatedList) {
downloadJSON(currentData, `list_table_${currentListIndex+1}.json`); downloadJSON(currentData, `list_table_${currentListIndex + 1}.json`);
} else { } else {
downloadJSON(data, jsonFilename); downloadJSON(data, jsonFilename);
} }
@@ -453,7 +453,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
> >
<DataObjectIcon /> <DataObjectIcon />
</IconButton> </IconButton>
<IconButton <IconButton
size="small" size="small"
onClick={() => { onClick={() => {
if (isPaginatedList) { if (isPaginatedList) {
@@ -473,29 +473,29 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<CardContent sx={{ pt: 0, pb: 1, flexGrow: 1 }}> <CardContent sx={{ pt: 0, pb: 1, flexGrow: 1 }}>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 2 }}> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 2 }}>
{isPaginatedList ? ( {isPaginatedList ? (
<Chip <Chip
label={listData.length > 1 label={listData.length > 1
? `Table ${currentListIndex + 1} of ${listData.length} (${currentData.length} ${currentData.length === 1 ? 'item' : 'items'})` ? `Table ${currentListIndex + 1} of ${listData.length} (${currentData.length} ${currentData.length === 1 ? 'item' : 'items'})`
: `${currentData.length} ${currentData.length === 1 ? 'item' : 'items'}` : `${currentData.length} ${currentData.length === 1 ? 'item' : 'items'}`
} }
size="small" size="small"
sx={{ backgroundColor: '#FF00C3', color: 'white' }} sx={{ backgroundColor: '#FF00C3', color: 'white' }}
/> />
) : ( ) : (
<Chip <Chip
label={`${data.length} ${data.length === 1 ? 'item' : 'items'}`} label={`${data.length} ${data.length === 1 ? 'item' : 'items'}`}
size="small" size="small"
sx={{ backgroundColor: '#FF00C3', color: 'white' }} sx={{ backgroundColor: '#FF00C3', color: 'white' }}
/> />
)} )}
{isPaginatedList && listData.length > 1 && ( {isPaginatedList && listData.length > 1 && (
<ButtonGroup size="small"> <ButtonGroup size="small">
<Button <Button
onClick={() => navigateListTable('prev')} onClick={() => navigateListTable('prev')}
disabled={currentListIndex === 0} disabled={currentListIndex === 0}
sx={{ sx={{
borderColor: '#FF00C3', borderColor: '#FF00C3',
color: currentListIndex === 0 ? 'gray' : '#FF00C3', color: currentListIndex === 0 ? 'gray' : '#FF00C3',
'&.Mui-disabled': { '&.Mui-disabled': {
borderColor: 'rgba(0, 0, 0, 0.12)' borderColor: 'rgba(0, 0, 0, 0.12)'
@@ -509,8 +509,8 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<Button <Button
onClick={() => navigateListTable('next')} onClick={() => navigateListTable('next')}
disabled={currentListIndex === listData.length - 1} disabled={currentListIndex === listData.length - 1}
sx={{ sx={{
borderColor: '#FF00C3', borderColor: '#FF00C3',
color: currentListIndex === listData.length - 1 ? 'gray' : '#FF00C3', color: currentListIndex === listData.length - 1 ? 'gray' : '#FF00C3',
'&.Mui-disabled': { '&.Mui-disabled': {
borderColor: 'rgba(0, 0, 0, 0.12)' borderColor: 'rgba(0, 0, 0, 0.12)'
@@ -548,8 +548,8 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
{currentData.length > 1 && ( {currentData.length > 1 && (
<TableRow> <TableRow>
<TableCell colSpan={previewColumns.length + (showMoreColumns ? 1 : 0)} align="center"> <TableCell colSpan={previewColumns.length + (showMoreColumns ? 1 : 0)} align="center">
<Button <Button
size="small" size="small"
onClick={() => { onClick={() => {
if (isPaginatedList) { if (isPaginatedList) {
setExpandedView(`list-${currentListIndex}`); setExpandedView(`list-${currentListIndex}`);
@@ -584,13 +584,13 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
if (dataTypeWithIndex.startsWith('list-')) { if (dataTypeWithIndex.startsWith('list-')) {
const indexStr = dataTypeWithIndex.split('-')[1]; const indexStr = dataTypeWithIndex.split('-')[1];
const index = parseInt(indexStr, 10); const index = parseInt(indexStr, 10);
if (index >= 0 && index < listData.length) { if (index >= 0 && index < listData.length) {
data = listData[index]; data = listData[index];
columns = listColumns[index]; columns = listColumns[index];
title = `${t('run_content.captured_data.list_title')} - Table ${index+1}`; title = `${t('run_content.captured_data.list_title')} - Table ${index + 1}`;
csvFilename = `list_table_${index+1}.csv`; csvFilename = `list_table_${index + 1}.csv`;
jsonFilename = `list_table_${index+1}.json`; jsonFilename = `list_table_${index + 1}.json`;
} }
} else { } else {
switch (dataTypeWithIndex) { switch (dataTypeWithIndex) {
@@ -621,25 +621,25 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
} }
return ( return (
<Box sx={{ <Box sx={{
position: 'fixed', position: 'fixed',
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,
backgroundColor: 'rgba(0,0,0,0.7)', backgroundColor: 'rgba(0,0,0,0.7)',
zIndex: 9999, zIndex: 9999,
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
p: 4 p: 4
}}> }}>
<Box sx={{ <Box sx={{
bgcolor: 'background.paper', bgcolor: 'background.paper',
borderRadius: 1, borderRadius: 1,
boxShadow: 24, boxShadow: 24,
p: 4, p: 4,
width: '90%', width: '90%',
maxWidth: '1200px', maxWidth: '1200px',
maxHeight: '90vh', maxHeight: '90vh',
overflow: 'auto' overflow: 'auto'
@@ -648,29 +648,29 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<Typography variant="h5">{title}</Typography> <Typography variant="h5">{title}</Typography>
<Box> <Box>
<ButtonGroup variant="outlined" size="small" sx={{ mr: 2 }}> <ButtonGroup variant="outlined" size="small" sx={{ mr: 2 }}>
<Button <Button
onClick={() => downloadCSV(data, columns, csvFilename)} onClick={() => downloadCSV(data, columns, csvFilename)}
startIcon={<DownloadIcon />} startIcon={<DownloadIcon />}
> >
CSV CSV
</Button> </Button>
<Button <Button
onClick={() => downloadJSON(data, jsonFilename)} onClick={() => downloadJSON(data, jsonFilename)}
startIcon={<DataObjectIcon />} startIcon={<DataObjectIcon />}
> >
JSON JSON
</Button> </Button>
</ButtonGroup> </ButtonGroup>
<Button <Button
variant="outlined" variant="outlined"
color="secondary" color="secondary"
onClick={() => setExpandedView(null)} onClick={() => setExpandedView(null)}
> >
Close Close
</Button> </Button>
</Box> </Box>
</Box> </Box>
<TableContainer component={Paper} sx={{ maxHeight: 'calc(90vh - 150px)' }}> <TableContainer component={Paper} sx={{ maxHeight: 'calc(90vh - 150px)' }}>
<Table stickyHeader aria-label="expanded data table"> <Table stickyHeader aria-label="expanded data table">
<TableHead> <TableHead>
@@ -780,7 +780,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
{t('run_content.loading')} {t('run_content.loading')}
</Box> </Box>
) : (!hasData && !hasScreenshots ) : (!hasData && !hasScreenshots
? <Typography>{t('run_content.empty_output')}</Typography> ? <Typography>{t('run_content.empty_output')}</Typography>
: null)} : null)}
{hasData && ( {hasData && (
@@ -791,23 +791,23 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
{t('run_content.captured_data.title')} {t('run_content.captured_data.title')}
</Typography> </Typography>
<Box> <Box>
<IconButton <IconButton
onClick={() => setViewMode('horizontal')} onClick={() => setViewMode('horizontal')}
color={viewMode === 'horizontal' ? 'primary' : 'default'} color={viewMode === 'horizontal' ? 'primary' : 'default'}
sx={{ color: viewMode === 'horizontal' ? '#FF00C3' : 'inherit' }} sx={{ color: viewMode === 'horizontal' ? '#FF00C3' : 'inherit' }}
> >
<ViewModuleIcon /> <ViewModuleIcon />
</IconButton> </IconButton>
<IconButton <IconButton
onClick={() => setViewMode('vertical')} onClick={() => setViewMode('vertical')}
color={viewMode === 'vertical' ? 'primary' : 'default'} color={viewMode === 'vertical' ? 'primary' : 'default'}
sx={{ color: viewMode === 'vertical' ? '#FF00C3' : 'inherit' }} sx={{ color: viewMode === 'vertical' ? '#FF00C3' : 'inherit' }}
> >
<ViewListIcon /> <ViewListIcon />
</IconButton> </IconButton>
<Button <Button
variant="outlined" variant="outlined"
size="small" size="small"
onClick={downloadAllJSON} onClick={downloadAllJSON}
startIcon={<CloudDownloadIcon />} startIcon={<CloudDownloadIcon />}
sx={{ borderColor: '#FF00C3', color: '#FF00C3', ml: 1 }} sx={{ borderColor: '#FF00C3', color: '#FF00C3', ml: 1 }}
@@ -816,7 +816,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
</Button> </Button>
</Box> </Box>
</Box> </Box>
{isLegacyData && ( {isLegacyData && (
viewMode === 'vertical' ? ( viewMode === 'vertical' ? (
renderDataTable( renderDataTable(
@@ -843,7 +843,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
</Grid> </Grid>
) )
)} )}
{!isLegacyData && ( {!isLegacyData && (
viewMode === 'vertical' ? ( viewMode === 'vertical' ? (
<> <>
@@ -855,27 +855,27 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
'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'),
<ListIcon sx={{ color: '#FF00C3' }} />, <ListIcon sx={{ color: '#FF00C3' }} />,
'list_data.csv', 'list_data.csv',
'list_data.json', 'list_data.json',
true true
)} )}
</> </>
) : ( ) : (
<Grid container spacing={3}> <Grid container spacing={3}>
{(() => { {(() => {
const dataCategoriesCount = [ const dataCategoriesCount = [
schemaData.length > 0, schemaData.length > 0,
listData.length > 0, listData.length > 0,
].filter(Boolean).length; ].filter(Boolean).length;
const columnWidth = dataCategoriesCount === 1 ? 12 : dataCategoriesCount === 2 ? 6 : 4; const columnWidth = dataCategoriesCount === 1 ? 12 : dataCategoriesCount === 2 ? 6 : 4;
return ( return (
<> <>
{schemaData.length > 0 && ( {schemaData.length > 0 && (
@@ -891,18 +891,18 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
)} )}
</Grid> </Grid>
)} )}
{listData.length > 0 && ( {listData.length > 0 && (
<Grid item xs={12} md={columnWidth} sx={{ display: 'flex' }}> <Grid item xs={12} md={columnWidth} sx={{ display: 'flex' }}>
{renderDataCard( {renderDataCard(
[], [],
[], [],
t('run_content.captured_data.list_title'), t('run_content.captured_data.list_title'),
<ListIcon sx={{ color: '#FF00C3' }} />, <ListIcon sx={{ color: '#FF00C3' }} />,
'list', 'list',
'list_data.csv', 'list_data.csv',
'list_data.json', 'list_data.json',
true true
)} )}
</Grid> </Grid>
)} )}
@@ -912,14 +912,14 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
</Grid> </Grid>
) )
)} )}
{renderExpandedView('schema')} {renderExpandedView('schema')}
{renderExpandedView('legacy')} {renderExpandedView('legacy')}
{listData.map((_, index) => renderExpandedView(`list-${index}`))} {listData.map((_, index) => renderExpandedView(`list-${index}`))}
</Box> </Box>
)} )}
{hasScreenshots && ( {hasScreenshots && (
<> <>
<Box sx={{ mb: 3 }}> <Box sx={{ mb: 3 }}>
@@ -927,21 +927,21 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<Typography variant='h6' sx={{ display: 'flex', alignItems: 'center' }}> <Typography variant='h6' sx={{ display: 'flex', alignItems: 'center' }}>
<ImageIcon sx={{ marginRight: '15px' }} /> <ImageIcon sx={{ marginRight: '15px' }} />
{t('run_content.captured_screenshot.title')} {t('run_content.captured_screenshot.title')}
<Chip <Chip
label={`${Object.keys(row.binaryOutput).length} ${Object.keys(row.binaryOutput).length === 1 ? 'item' : 'items'}`} label={`${Object.keys(row.binaryOutput).length} ${Object.keys(row.binaryOutput).length === 1 ? 'item' : 'items'}`}
size="small" size="small"
sx={{ ml: 2, backgroundColor: '#FF00C3', color: 'white' }} sx={{ ml: 2, backgroundColor: '#FF00C3', color: 'white' }}
/> />
</Typography> </Typography>
<Box> <Box>
<IconButton <IconButton
onClick={() => setViewMode('horizontal')} onClick={() => setViewMode('horizontal')}
color={viewMode === 'horizontal' ? 'primary' : 'default'} color={viewMode === 'horizontal' ? 'primary' : 'default'}
sx={{ color: viewMode === 'horizontal' ? '#FF00C3' : 'inherit' }} sx={{ color: viewMode === 'horizontal' ? '#FF00C3' : 'inherit' }}
> >
<ViewModuleIcon /> <ViewModuleIcon />
</IconButton> </IconButton>
<IconButton <IconButton
onClick={() => setViewMode('vertical')} onClick={() => setViewMode('vertical')}
color={viewMode === 'vertical' ? 'primary' : 'default'} color={viewMode === 'vertical' ? 'primary' : 'default'}
sx={{ color: viewMode === 'vertical' ? '#FF00C3' : 'inherit' }} sx={{ color: viewMode === 'vertical' ? '#FF00C3' : 'inherit' }}
@@ -951,7 +951,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
</Box> </Box>
</Box> </Box>
</Box> </Box>
{viewMode === 'vertical' ? ( {viewMode === 'vertical' ? (
<> <>
{Object.keys(row.binaryOutput).map((key, index) => { {Object.keys(row.binaryOutput).map((key, index) => {
@@ -967,7 +967,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
<Box sx={{ display: 'flex', alignItems: 'center' }}> <Box sx={{ display: 'flex', alignItems: 'center' }}>
<ImageIcon sx={{ color: '#FF00C3' }} /> <ImageIcon sx={{ color: '#FF00C3' }} />
<Typography variant='h6' sx={{ ml: 2 }}> <Typography variant='h6' sx={{ ml: 2 }}>
Screenshot {index+1} Screenshot {index + 1}
</Typography> </Typography>
</Box> </Box>
</AccordionSummary> </AccordionSummary>
@@ -985,15 +985,15 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
</ButtonGroup> </ButtonGroup>
</Box> </Box>
<Box> <Box>
<img <img
src={imageUrl} src={imageUrl}
alt={`Screenshot ${key}`} alt={`Screenshot ${key}`}
style={{ style={{
maxWidth: '100%', maxWidth: '100%',
height: 'auto', height: 'auto',
border: '1px solid #e0e0e0', border: '1px solid #e0e0e0',
borderRadius: '4px' borderRadius: '4px'
}} }}
/> />
</Box> </Box>
</AccordionDetails> </AccordionDetails>
@@ -1033,16 +1033,16 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
/> />
<CardContent sx={{ p: 1 }}> <CardContent sx={{ p: 1 }}>
<Box sx={{ position: 'relative', width: '100%', height: 'auto', overflow: 'hidden' }}> <Box sx={{ position: 'relative', width: '100%', height: 'auto', overflow: 'hidden' }}>
<img <img
src={imageUrl} src={imageUrl}
alt={`Screenshot ${key}`} alt={`Screenshot ${key}`}
style={{ style={{
width: '100%', width: '100%',
height: 'auto', height: 'auto',
objectFit: 'contain', objectFit: 'contain',
border: '1px solid #e0e0e0', border: '1px solid #e0e0e0',
borderRadius: '4px' borderRadius: '4px'
}} }}
/> />
</Box> </Box>
</CardContent> </CardContent>