Skip to content

Commit

Permalink
workaround: file open for each data harmonizer
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethbruskiewicz committed Mar 7, 2024
1 parent 30f00b2 commit d993733
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class Toolbar {
const $fileInput = $('#open-file-input');

$fileInput.on('change', function () {
const dh = self.context.getCurrentDataHarmonizer()
const file = $fileInput[0].files[0];
const ext = file.name.split('.').pop();
const acceptedExts = ['xlsx', 'xls', 'tsv', 'csv', 'json'];
Expand All @@ -123,18 +122,18 @@ class Toolbar {
$('#open-err-msg').text(errMsg);
$('#open-error-modal').modal('show');
} else {
dh.invalid_cells = {};
// open for all data harmonizers
// TODO: refactor to context function, there's too much redundant work being done here
Object.values(self.context.dhs).forEach(dh => {
dh.invalid_cells = {};
dh.runBehindLoadingScreen(dh.openFile.bind(dh), [file]);
dh.current_selection = [null, null, null, null];
})
$('#file_name_display').text(file.name);
}
// Allow consecutive uploads of the same file
$fileInput[0].value = '';

self.hideValidationResultButtons();
dh.current_selection = [null, null, null, null];
});

// File -> Save
Expand Down

0 comments on commit d993733

Please sign in to comment.