diff options
author | Frederick Muriuki Muriithi | 2025-01-06 11:26:06 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-01-06 11:26:06 -0600 |
commit | 3e71a2eec8507f900e51dd3962d76aa4ba272fbb (patch) | |
tree | 5e2d939154e1dd3c774c18c9216c87384375fa09 /uploader/templates/phenotypes | |
parent | 568fee5a9dd8d7b689af5e0486990f307c59287c (diff) | |
download | gn-uploader-3e71a2eec8507f900e51dd3962d76aa4ba272fbb.tar.gz |
Make the preview updater more generic
Build the preview-updater in a function call to ease maintenance.
Diffstat (limited to 'uploader/templates/phenotypes')
-rw-r--r-- | uploader/templates/phenotypes/add-phenotypes-raw-files.html | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html index 3eb042e..8a7463a 100644 --- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html +++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html @@ -400,6 +400,16 @@ } }; + var makePreviewUpdater = (preview_table) => { + return (data) => { + update_preview( + preview_table, + data, + filesMetadata(), + PREVIEW_ROWS); + }; + }; + var preview_tables_to_elements_map = { "#tbl-preview-pheno-desc": "#finput-phenotype-descriptions", "#tbl-preview-pheno-data": "#finput-phenotype-data", @@ -426,12 +436,7 @@ readFirstNLines( file_input[0].files[0], 10, - [(data) => { - update_preview( - $(mapentry[0]), - data, - files_metadata(), - PREVIEW_ROWS);}]); + [makePreviewUpdater(preview_table)]); } }); }; @@ -454,13 +459,8 @@ readFirstNLines( event.target.files[0], 10, - [(data) => { - update_preview( - $("#" + event.target.getAttribute("data-preview-table")), - data, - files_metadata(), - PREVIEW_ROWS); - }]); + [makePreviewUpdater( + $("#" + event.target.getAttribute("data-preview-table")))]); }); }); |