From b7c165bac7a942e2b17e5a3f5a6646809407915b Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 30 Jul 2024 17:34:12 -0700 Subject: [PATCH] Only support downloading Auspice JSONs if dataset name can be parsed Resolves --- src/components/download/downloadButtons.js | 9 +++++++-- src/components/download/helperFunctions.js | 12 ++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/download/downloadButtons.js b/src/components/download/downloadButtons.js index 69fa93309..c4e7a6bb8 100644 --- a/src/components/download/downloadButtons.js +++ b/src/components/download/downloadButtons.js @@ -6,6 +6,7 @@ import { materialButton } from "../../globalStyles"; import * as helpers from "./helperFunctions"; import { getFullAuthorInfoFromNode } from "../../util/treeMiscHelpers"; import { getNumSelectedTips } from "../../util/treeVisibilityHelpers"; +import { getDatasetNamesFromUrl } from "../../actions/loadData"; const RectangularTreeIcon = withTheme(icons.RectangularTree); const PanelsGridIcon = withTheme(icons.PanelsGrid); @@ -35,6 +36,10 @@ export const DownloadButtons = ({dispatch, t, tree, entropy, metadata, colorBy, } } } + /* Verify that we can parse dataset name from URL to support Auspice JSON download */ + const datasetNames = getDatasetNamesFromUrl(window.location.pathname); + const supportAuspiceJsonDownload = !gisaidProvenance && datasetNames.some(Boolean); + const entropyBar = entropy?.selectedCds===nucleotide_gene ? "nucleotide" : "codon"; return ( @@ -48,12 +53,12 @@ export const DownloadButtons = ({dispatch, t, tree, entropy, metadata, colorBy,

{partialData ? `Currently ${selectedTipsCount}/${totalTipCount} tips are displayed and will be downloaded.` : `Currently the entire dataset (${totalTipCount} tips) will be downloaded.`} - {!gisaidProvenance && ( + {supportAuspiceJsonDownload && (