Merge pull request #625 from getmaxun/download-fix
fix: download csv and json list data
This commit is contained in:
@@ -248,7 +248,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
|
|
||||||
const renderDataTable = (
|
const renderDataTable = (
|
||||||
data: any[],
|
data: any[],
|
||||||
columns: string[],
|
columns: any[],
|
||||||
title: string,
|
title: string,
|
||||||
csvFilename: string,
|
csvFilename: string,
|
||||||
jsonFilename: string,
|
jsonFilename: string,
|
||||||
@@ -262,6 +262,9 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
|
|
||||||
if (!currentData || currentData.length === 0) return null;
|
if (!currentData || currentData.length === 0) return null;
|
||||||
|
|
||||||
|
const downloadData = isPaginatedList ? currentData : data;
|
||||||
|
const downloadColumns = isPaginatedList ? currentColumns : columns;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Accordion defaultExpanded sx={{ mb: 2 }}>
|
<Accordion defaultExpanded sx={{ mb: 2 }}>
|
||||||
<AccordionSummary
|
<AccordionSummary
|
||||||
@@ -280,7 +283,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
<Box>
|
<Box>
|
||||||
<Button
|
<Button
|
||||||
component="a"
|
component="a"
|
||||||
onClick={() => downloadJSON(data, jsonFilename)}
|
onClick={() => downloadJSON(downloadData, jsonFilename)}
|
||||||
sx={{
|
sx={{
|
||||||
color: '#FF00C3',
|
color: '#FF00C3',
|
||||||
textTransform: 'none',
|
textTransform: 'none',
|
||||||
@@ -299,7 +302,7 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
component="a"
|
component="a"
|
||||||
onClick={() => downloadCSV(data, columns, csvFilename)}
|
onClick={() => downloadCSV(downloadData, downloadColumns, csvFilename)}
|
||||||
sx={{
|
sx={{
|
||||||
color: '#FF00C3',
|
color: '#FF00C3',
|
||||||
textTransform: 'none',
|
textTransform: 'none',
|
||||||
@@ -481,8 +484,8 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{listData.length > 0 && renderDataTable(
|
{listData.length > 0 && renderDataTable(
|
||||||
[],
|
listData,
|
||||||
[],
|
listColumns,
|
||||||
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',
|
||||||
|
|||||||
Reference in New Issue
Block a user