feat: del empty rows
This commit is contained in:
@@ -31,18 +31,23 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
setTab(tab);
|
setTab(tab);
|
||||||
}, [interpretationInProgress]);
|
}, [interpretationInProgress]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (row.serializableOutput && Object.keys(row.serializableOutput).length > 0) {
|
if (row.serializableOutput && Object.keys(row.serializableOutput).length > 0) {
|
||||||
const firstKey = Object.keys(row.serializableOutput)[0];
|
const firstKey = Object.keys(row.serializableOutput)[0];
|
||||||
const data = row.serializableOutput[firstKey];
|
const data = row.serializableOutput[firstKey];
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
setTableData(data);
|
// Filter out completely empty rows
|
||||||
if (data.length > 0) {
|
const filteredData = data.filter(row =>
|
||||||
setColumns(Object.keys(data[0]));
|
Object.values(row).some(value => value !== undefined && value !== "")
|
||||||
}
|
);
|
||||||
|
setTableData(filteredData);
|
||||||
|
if (filteredData.length > 0) {
|
||||||
|
setColumns(Object.keys(filteredData[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [row.serializableOutput]);
|
}
|
||||||
|
}, [row.serializableOutput]);
|
||||||
|
|
||||||
|
|
||||||
// Function to convert table data to CSV format
|
// Function to convert table data to CSV format
|
||||||
const convertToCSV = (data: any[], columns: string[]): string => {
|
const convertToCSV = (data: any[], columns: string[]): string => {
|
||||||
|
|||||||
Reference in New Issue
Block a user