feat: rm other actions logic
This commit is contained in:
@@ -96,17 +96,6 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
|
||||
const tabIndex = availableTabs.findIndex(tab => tab.id === 'captureText');
|
||||
if (tabIndex !== -1) setActiveTab(tabIndex);
|
||||
}
|
||||
} else if (type === 'other') {
|
||||
if (Array.isArray(data)) {
|
||||
setOtherData(prev => [...prev, data]);
|
||||
} else {
|
||||
setOtherData(prev => [...prev, [data]]);
|
||||
}
|
||||
if (otherData.length === 0) {
|
||||
const availableTabs = getAvailableTabs();
|
||||
const tabIndex = availableTabs.findIndex(tab => tab.id === 'other');
|
||||
if (tabIndex !== -1) setActiveTab(tabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
scrollLogToBottom();
|
||||
@@ -178,10 +167,6 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
|
||||
tabs.push({ id: 'captureScreenshot', label: 'Screenshots' });
|
||||
}
|
||||
|
||||
if (otherData.length > 0) {
|
||||
tabs.push({ id: 'other', label: 'Other' });
|
||||
}
|
||||
|
||||
return tabs;
|
||||
}, [captureListData.length, captureTextData.length, screenshotData.length, otherData.length]);
|
||||
|
||||
@@ -464,87 +449,6 @@ export const InterpretationLog: React.FC<InterpretationLogProps> = ({ isOpen, se
|
||||
</Table>
|
||||
</TableContainer>
|
||||
)}
|
||||
|
||||
{activeTab === availableTabs.findIndex(tab => tab.id === 'other') && otherData.length > 0 && (
|
||||
<Box>
|
||||
{otherData.length > 1 && (
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
mb: 2,
|
||||
mt: 2
|
||||
}}>
|
||||
<Typography variant="body2">
|
||||
{`Dataset ${otherPage + 1} of ${otherData.length}`}
|
||||
</Typography>
|
||||
<Box>
|
||||
<Button
|
||||
onClick={() => setOtherPage(prev => Math.max(0, prev - 1))}
|
||||
disabled={otherPage === 0}
|
||||
size="small"
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setOtherPage(prev => Math.min(otherData.length - 1, prev + 1))}
|
||||
disabled={otherPage >= otherData.length - 1}
|
||||
size="small"
|
||||
sx={{ ml: 1 }}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
<TableContainer component={Paper} sx={{ boxShadow: 'none', borderRadius: 0 }}>
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
{otherData[otherPage] && otherData[otherPage].length > 0 &&
|
||||
Object.keys(otherData[otherPage][0]).map((column) => (
|
||||
<TableCell
|
||||
key={column}
|
||||
sx={{
|
||||
borderBottom: '1px solid',
|
||||
borderColor: darkMode ? '#3a4453' : '#dee2e6',
|
||||
backgroundColor: darkMode ? '#2a3441' : '#f8f9fa'
|
||||
}}
|
||||
>
|
||||
{column}
|
||||
</TableCell>
|
||||
))
|
||||
}
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{otherData[otherPage] &&
|
||||
otherData[otherPage].map((row: any, idx: any) => (
|
||||
<TableRow
|
||||
key={idx}
|
||||
sx={{
|
||||
borderBottom: '1px solid',
|
||||
borderColor: darkMode ? '#3a4453' : '#dee2e6'
|
||||
}}
|
||||
>
|
||||
{Object.keys(row).map((column) => (
|
||||
<TableCell
|
||||
key={column}
|
||||
sx={{
|
||||
borderBottom: 'none',
|
||||
py: 2
|
||||
}}
|
||||
>
|
||||
{row[column]}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -45,9 +45,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
const [listData, setListData] = useState<any[][]>([]);
|
||||
const [listColumns, setListColumns] = useState<string[][]>([]);
|
||||
const [currentListIndex, setCurrentListIndex] = useState<number>(0);
|
||||
|
||||
const [otherData, setOtherData] = useState<any[]>([]);
|
||||
const [otherColumns, setOtherColumns] = useState<string[]>([]);
|
||||
|
||||
const [expandedView, setExpandedView] = useState<string | null>(null);
|
||||
|
||||
@@ -66,7 +63,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
|
||||
if (!row.serializableOutput.scrapeSchema &&
|
||||
!row.serializableOutput.scrapeList &&
|
||||
!row.serializableOutput.other &&
|
||||
Object.keys(row.serializableOutput).length > 0) {
|
||||
|
||||
setIsLegacyData(true);
|
||||
@@ -83,10 +79,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
if (row.serializableOutput.scrapeList) {
|
||||
processScrapeList(row.serializableOutput.scrapeList);
|
||||
}
|
||||
|
||||
if (row.serializableOutput.other && Object.keys(row.serializableOutput.other).length > 0) {
|
||||
processDataCategory(row.serializableOutput.other, setOtherData, setOtherColumns);
|
||||
}
|
||||
}, [row.serializableOutput]);
|
||||
|
||||
const processLegacyData = (legacyOutput: Record<string, any>) => {
|
||||
@@ -240,7 +232,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
allData = {
|
||||
schema: schemaData,
|
||||
list: listData.flat(),
|
||||
other: otherData
|
||||
};
|
||||
}
|
||||
|
||||
@@ -619,13 +610,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
csvFilename = 'list_data.csv';
|
||||
jsonFilename = 'list_data.json';
|
||||
break;
|
||||
case 'other':
|
||||
data = otherData;
|
||||
columns = otherColumns;
|
||||
title = t('run_content.captured_data.other_title');
|
||||
csvFilename = 'other_data.csv';
|
||||
jsonFilename = 'other_data.json';
|
||||
break;
|
||||
case 'legacy':
|
||||
data = legacyData;
|
||||
columns = legacyColumns;
|
||||
@@ -714,7 +698,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
);
|
||||
};
|
||||
|
||||
const hasData = schemaData.length > 0 || listData.length > 0 || otherData.length > 0 || legacyData.length > 0;
|
||||
const hasData = schemaData.length > 0 || listData.length > 0 || legacyData.length > 0;
|
||||
const hasScreenshots = row.binaryOutput && Object.keys(row.binaryOutput).length > 0;
|
||||
|
||||
return (
|
||||
@@ -881,15 +865,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
'list_data.json',
|
||||
true
|
||||
)}
|
||||
|
||||
{renderDataTable(
|
||||
otherData,
|
||||
otherColumns,
|
||||
t('run_content.captured_data.other_title'),
|
||||
<MoreHorizIcon sx={{ color: '#FF00C3' }} />,
|
||||
'other_data.csv',
|
||||
'other_data.json'
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Grid container spacing={3}>
|
||||
@@ -897,7 +872,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
const dataCategoriesCount = [
|
||||
schemaData.length > 0,
|
||||
listData.length > 0,
|
||||
otherData.length > 0
|
||||
].filter(Boolean).length;
|
||||
|
||||
const columnWidth = dataCategoriesCount === 1 ? 12 : dataCategoriesCount === 2 ? 6 : 4;
|
||||
@@ -932,20 +906,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
)}
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
{otherData.length > 0 && (
|
||||
<Grid item xs={12} md={columnWidth} sx={{ display: 'flex' }}>
|
||||
{renderDataCard(
|
||||
otherData,
|
||||
otherColumns,
|
||||
t('run_content.captured_data.other_title'),
|
||||
<MoreHorizIcon sx={{ color: '#FF00C3' }} />,
|
||||
'other',
|
||||
'other_data.csv',
|
||||
'other_data.json'
|
||||
)}
|
||||
</Grid>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
})()}
|
||||
@@ -954,7 +914,6 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
||||
)}
|
||||
|
||||
{renderExpandedView('schema')}
|
||||
{renderExpandedView('other')}
|
||||
{renderExpandedView('legacy')}
|
||||
|
||||
{listData.map((_, index) => renderExpandedView(`list-${index}`))}
|
||||
|
||||
Reference in New Issue
Block a user