From d5fc4f818c06eb5ce2314d27ef0140525d10bdf6 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:12:53 -0800 Subject: [PATCH 1/3] Show visible error messages when a dropped file is unused These are cases of user error and should be made apparent to the user. --- .../handleDroppedFiles.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/auspice_client_customisation/handleDroppedFiles.js b/auspice_client_customisation/handleDroppedFiles.js index 1d67656..57caaa2 100644 --- a/auspice_client_customisation/handleDroppedFiles.js +++ b/auspice_client_customisation/handleDroppedFiles.js @@ -108,7 +108,16 @@ async function collectDatasets(dispatch, files) { /* loop through files and, if a sidecar, load it into the associated `Dataset` object */ for (const file of files) { const nameLower = file.name.toLowerCase(); - if (filesSeen.has(nameLower) || !nameLower.endsWith("json")) continue; + if (filesSeen.has(nameLower)) continue; + + if (!nameLower.endsWith("json")) { + dispatch(errorNotification({ + message: `Failed to load ${file.name}.`, + details: "Please refer to the homepage for supported files, and check that your file is named properly." + })); + continue; + } + for (const [sidecarSuffix, sidecarPropName] of Object.entries(sidecarMappings)) { if (nameLower.endsWith(`_${sidecarSuffix}.json`)) { // filename looks like a sidecar file? filesSeen.add(nameLower); @@ -125,7 +134,10 @@ async function collectDatasets(dispatch, files) { } logs.push(`Read ${file.name} as a sidecar file of ${datasets[mainNameLower].name}`); } else { - logs.push(`Sidecar file ${file.name} has no associated main dataset file and has been skipped.`); + dispatch(errorNotification({ + message: `Failed to load ${file.name}.`, + details: "Does the file prefix match a corresponding dataset?" + })); } } } From 47bfed9633c6d322898f8d60cb82c93a2870248d Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:17:43 -0800 Subject: [PATCH 2/3] Use bold instead of quotes to emphasize file suffixes Easier to read. --- auspice_client_customisation/splash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auspice_client_customisation/splash.js b/auspice_client_customisation/splash.js index 32558e2..cdbb865 100644 --- a/auspice_client_customisation/splash.js +++ b/auspice_client_customisation/splash.js @@ -72,7 +72,7 @@ const SplashContent = (props) => {
  • A nextstrain narrative and associated datasets (JSONs) - see the Nextstrain docs for how author a narrative. Each dataset the narrative references should have a filename which is the - URL path but with forward slashes replaced with underscores ("/"→"_") and a ".json" suffix. + URL path but with forward slashes replaced with underscores ("/"→"_") and a .json suffix. Only one narrative can be dropped on at a time!
  • From c9000f29a8224cc89219d1aeca6602f59ac1c947 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:16:21 -0800 Subject: [PATCH 3/3] Clarify Newick and narrative file requirements The code checks for these files based on file extension, which should be communicated explicitly. --- auspice_client_customisation/splash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auspice_client_customisation/splash.js b/auspice_client_customisation/splash.js index cdbb865..9e341f5 100644 --- a/auspice_client_customisation/splash.js +++ b/auspice_client_customisation/splash.js @@ -69,7 +69,7 @@ const SplashContent = (props) => { for how to run the bioinformatics tools to generate these datasets. Note that it's possible to drag on multiple datasets, however at most two will be loaded, and it's not possible to control the ordering of these datasets!
  • -
  • A nextstrain narrative and associated datasets (JSONs) - see the +
  • A nextstrain narrative ending in .md and associated datasets (JSONs) - see the Nextstrain docs for how author a narrative. Each dataset the narrative references should have a filename which is the URL path but with forward slashes replaced with underscores ("/"→"_") and a .json suffix. @@ -77,7 +77,7 @@ const SplashContent = (props) => {
  • A phylogenetic tree in - Newick format + Newick format with name ending in .new, .nwk, or .newick.
  • Additional metadata as a CSV/TSV (drop this on once the tree has loaded).