From 1994d2d540bf49eb58f8789c36f5e43b994b1b97 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 5 Nov 2024 13:30:57 -0800 Subject: [PATCH 1/3] handleDroppedFiles: Don't show error notification for `.md` files Fixes bug where all narrative `.md` files triggered the error notification that the file failed to load. --- auspice_client_customisation/handleDroppedFiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auspice_client_customisation/handleDroppedFiles.js b/auspice_client_customisation/handleDroppedFiles.js index 57caaa2..9825a76 100644 --- a/auspice_client_customisation/handleDroppedFiles.js +++ b/auspice_client_customisation/handleDroppedFiles.js @@ -110,7 +110,7 @@ async function collectDatasets(dispatch, files) { const nameLower = file.name.toLowerCase(); if (filesSeen.has(nameLower)) continue; - if (!nameLower.endsWith("json")) { + if (!nameLower.endsWith("json") && !nameLower.endsWith(".md")) { 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." From 2edcf502cedfd435a5fc27bcb293e566a524cc84 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Wed, 6 Nov 2024 15:44:48 -0800 Subject: [PATCH 2/3] Bump auspice from 2.59.1 to 2.60.0 --- package-lock.json | 15 ++++++++------- package.json | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 45f2690..dd5a1f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { - "auspice": "2.59.1", + "auspice": "2.60.0", "heroku-ssl-redirect": "0.0.4" }, "engines": { @@ -2572,9 +2572,10 @@ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, "node_modules/auspice": { - "version": "2.59.1", - "resolved": "https://registry.npmjs.org/auspice/-/auspice-2.59.1.tgz", - "integrity": "sha512-JdfCQ2waAY/BPeIZ58tAUIYWwopY28FuQ3JjG+esa5fPbp5+Ovbx4rl6LqWCscohyojdxgJvJX4l8a1Av2b9ZA==", + "version": "2.60.0", + "resolved": "https://registry.npmjs.org/auspice/-/auspice-2.60.0.tgz", + "integrity": "sha512-2kzfVOiO3h4jjKUlF8vWhyty8UBUoWVP1ES3G65C3XN/0q9xVHHyBH5xHz7KXW4i5MuoUre8xPxVgm9L7+AOxQ==", + "license": "AGPL-3.0-only", "dependencies": { "@babel/core": "^7.3.4", "@babel/plugin-proposal-class-properties": "^7.3.4", @@ -9682,9 +9683,9 @@ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, "auspice": { - "version": "2.59.1", - "resolved": "https://registry.npmjs.org/auspice/-/auspice-2.59.1.tgz", - "integrity": "sha512-JdfCQ2waAY/BPeIZ58tAUIYWwopY28FuQ3JjG+esa5fPbp5+Ovbx4rl6LqWCscohyojdxgJvJX4l8a1Av2b9ZA==", + "version": "2.60.0", + "resolved": "https://registry.npmjs.org/auspice/-/auspice-2.60.0.tgz", + "integrity": "sha512-2kzfVOiO3h4jjKUlF8vWhyty8UBUoWVP1ES3G65C3XN/0q9xVHHyBH5xHz7KXW4i5MuoUre8xPxVgm9L7+AOxQ==", "requires": { "@babel/core": "^7.3.4", "@babel/plugin-proposal-class-properties": "^7.3.4", diff --git a/package.json b/package.json index 57f477a..dfc3b66 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "develop": "auspice develop --verbose --extend ./auspice_client_customisation/config.json --handlers ./server/handlers.js" }, "dependencies": { - "auspice": "2.59.1", + "auspice": "2.60.0", "heroku-ssl-redirect": "0.0.4" } } From 418c03b7c64fd5f94e643cb52c3e297d8b0f480d Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 5 Nov 2024 13:12:31 -0800 Subject: [PATCH 3/3] Load measurements JSON with `createStateFromQueryOrJSONs` Updating to support upcoming changes in Auspice from --- auspice_client_customisation/handleDroppedFiles.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/auspice_client_customisation/handleDroppedFiles.js b/auspice_client_customisation/handleDroppedFiles.js index 9825a76..4bbd03b 100644 --- a/auspice_client_customisation/handleDroppedFiles.js +++ b/auspice_client_customisation/handleDroppedFiles.js @@ -1,7 +1,6 @@ import { createStateFromQueryOrJSONs } from "@auspice/actions/recomputeReduxState"; import { errorNotification, warningNotification } from "@auspice/actions/notifications"; import { Dataset, addEndOfNarrativeBlock, getDatasetNamesFromUrl } from "@auspice/actions/loadData"; -import { parseMeasurementsJSON } from "@auspice/actions/measurements"; import { parseMarkdownNarrativeFile } from "@auspice/util/parseNarrative"; import { parseMarkdown } from "@auspice/util/parseMarkdown"; import { isAcceptedFileType as isAuspiceAcceptedFileType } from "@auspice/actions/filesDropped/constants"; @@ -123,15 +122,7 @@ async function collectDatasets(dispatch, files) { filesSeen.add(nameLower); const mainNameLower = nameLower.replace(`_${sidecarSuffix}.json`, '.json'); if (datasets[mainNameLower]) { - // Parse measurements sidecars separately here. - // See https://github.com/nextstrain/auspice/pull/1663 - if (sidecarPropName === 'measurements') { - datasets[mainNameLower][sidecarPropName] = readFile(file) - .then((json) => parseMeasurementsJSON(json)) - .catch((err) => console.error("Failed to read and parse measurements sidecar", err)); - } else { - datasets[mainNameLower][sidecarPropName] = readFile(file); - } + datasets[mainNameLower][sidecarPropName] = readFile(file); logs.push(`Read ${file.name} as a sidecar file of ${datasets[mainNameLower].name}`); } else { dispatch(errorNotification({ @@ -204,6 +195,7 @@ async function loadDatasets(dispatch, datasets, narrative) { pathnameShouldBe: "", ...createStateFromQueryOrJSONs({ json: dataset1.main, + measurementsData: dataset1.measurements ? (await dataset1.measurements) : undefined, secondTreeDataset: dataset2 ? dataset2.main : null, query: {}, narrativeBlocks: narrative,