Download table data#848
Conversation
|
Reviewed the PR again and haven't got much to add |
| }) | ||
| : cell; | ||
|
|
||
| dataForExport[rowIndex + 1].push(getReactNodeText(cellExportData)); |
There was a problem hiding this comment.
Don't you want to check here if cellExportData is a primitive (string / number), in which case you could push it into dataForExport directly?
There was a problem hiding this comment.
That's done. Previously it was getting checked inside getReactNodeText but not since we updated it.
| }); | ||
| } | ||
| }, 1000); | ||
| }; |
There was a problem hiding this comment.
Sorry, we messed up. There is now a second's delay when you click on "Cancel", which shouldn't be there.
Screen.Recording.2022-10-13.at.08.29.39.mov
| return ( | ||
| <div className={styles.downloadData}> | ||
| <span>{downloadFileName ?? 'table.csv'}</span> | ||
| <LoadingButton onClick={handleDownload}>Download</LoadingButton> |
There was a problem hiding this comment.
This is super minor, but since all data is already on the client, the download completes before the spinner stops:
Screen.Recording.2022-10-13.at.08.47.54.mov
It can be addressed by changing from LoadingButton to ControlledLoadingButton, and driving the state of that button from the DownloadData component. Or we can ignore this for now, and see how #841 pans out.
There was a problem hiding this comment.
I have addressed this issue in the latest commit.
|
The downloaded table isn't default-sorted (by e-value). Is this correct? @ens-st3 ? |
This is because I used |
| setTimeout(restoreDefaults, 1000); | ||
| } catch { | ||
| setDownloadState(LoadingState.ERROR); | ||
| setTimeout(() => setDownloadState(LoadingState.NOT_REQUESTED), 2000); |
There was a problem hiding this comment.
You should probably also check for allowComponentResetRef.current in the callback to this setTimeout function. You are changing component's state here.
| setTimeout(() => setDownloadState(LoadingState.NOT_REQUESTED), 2000); | ||
| } | ||
|
|
||
| return; |
There was a problem hiding this comment.
I'm not returning within the try block so this return here is required
There was a problem hiding this comment.
Oh, sorry, didn't see where the function ends 🙂




Description
The DataTable can either handle the download by itself by generating a csv or it can give the control over to the parent component using the
downloadHandlerprop.Related JIRA Issue(s)
https://www.ebi.ac.uk/panda/jira/browse/ENSWBSITES-1736
Deployment URL(s)
http://datatable-export.review.ensembl.org