diff --git a/static-site/src/components/ListResources/IndividualResource.tsx b/static-site/src/components/ListResources/IndividualResource.tsx
index 3e7d276ae..eefd4a795 100644
--- a/static-site/src/components/ListResources/IndividualResource.tsx
+++ b/static-site/src/components/ListResources/IndividualResource.tsx
@@ -144,7 +144,7 @@ export const IndividualResource = ({resource, isMobile}: IndividualResourceProps
// add history if mobile and resource has version info
let history: React.JSX.Element | null = null
- if (!isMobile && resource.updateCadence && resource.nVersions) {
+ if (!isMobile && resource.updateCadence && resource.nVersions && resource.lastUpdated) {
history = (
Last known update on ${resource.lastUpdated}` +
@@ -158,12 +158,14 @@ export const IndividualResource = ({resource, isMobile}: IndividualResourceProps
)
}
+ const description = resource.lastUpdated ? `Last known update on ${resource.lastUpdated}` : "";
+
return (
-
+
setModalResource(resource)}>
diff --git a/static-site/src/components/ListResources/ResourceGroup.tsx b/static-site/src/components/ListResources/ResourceGroup.tsx
index 82a244ae6..4c89d1010 100644
--- a/static-site/src/components/ListResources/ResourceGroup.tsx
+++ b/static-site/src/components/ListResources/ResourceGroup.tsx
@@ -49,7 +49,7 @@ const ResourceGroupHeader = ({group, isMobile, setCollapsed, collapsible, isColl
(however there may have been a more recent update since we indexed the data)'}>
- {`Most recent snapshot: ${group.lastUpdated}`}
+ {group.lastUpdated && `Most recent snapshot: ${group.lastUpdated}`}
)}
diff --git a/static-site/src/components/ListResources/index.tsx b/static-site/src/components/ListResources/index.tsx
index 9e1581448..02e7e2b81 100644
--- a/static-site/src/components/ListResources/index.tsx
+++ b/static-site/src/components/ListResources/index.tsx
@@ -74,11 +74,17 @@ function ListResources({
return (
-
+ { showcaseCards.length > 0 && (
+
+ )}
-
+ { groups && groups[0]?.lastUpdated && (
+
+ ) || (
+
+ )}
diff --git a/static-site/src/components/ListResources/types.ts b/static-site/src/components/ListResources/types.ts
index 0a2a7ae15..d740fd18b 100644
--- a/static-site/src/components/ListResources/types.ts
+++ b/static-site/src/components/ListResources/types.ts
@@ -20,7 +20,7 @@ export interface Resource {
nameParts: string[]
sortingName: string
url: string
- lastUpdated: string // date
+ lastUpdated?: string // date
firstUpdated?: string // date
dates?: string[]
nVersions?: number
diff --git a/static-site/src/components/ListResources/useDataFetch.ts b/static-site/src/components/ListResources/useDataFetch.ts
index 2214524e9..ee00bb95c 100644
--- a/static-site/src/components/ListResources/useDataFetch.ts
+++ b/static-site/src/components/ListResources/useDataFetch.ts
@@ -64,9 +64,6 @@ function partitionByPathogen(pathVersions: PathVersions, pathPrefix: string, ver
return Object.entries(pathVersions).reduce((store: Partitions, [name, dates]) => {
const sortedDates = [...dates].sort();
- // do nothing if resource has no dates
- if (sortedDates.length < 1) return store
-
const nameParts = name.split('/');
// split() will always return at least 1 string
const groupName = nameParts[0]!;
@@ -77,11 +74,10 @@ function partitionByPathogen(pathVersions: PathVersions, pathPrefix: string, ver
nameParts,
sortingName: _sortableName(nameParts),
url: `/${pathPrefix}${name}`,
- lastUpdated: sortedDates.at(-1)!,
+ lastUpdated: sortedDates.at(-1),
};
if (versioned) {
resourceDetails.firstUpdated = sortedDates[0]!;
- resourceDetails.lastUpdated = sortedDates.at(-1)!;
resourceDetails.dates = sortedDates;
resourceDetails.nVersions = sortedDates.length;
resourceDetails.updateCadence = updateCadence(sortedDates.map((date)=> new Date(date)));
diff --git a/static-site/src/pages/groups.jsx b/static-site/src/pages/groups.jsx
index 1db066d54..0ae2a8062 100644
--- a/static-site/src/pages/groups.jsx
+++ b/static-site/src/pages/groups.jsx
@@ -4,23 +4,50 @@ import { SmallSpacer, HugeSpacer, FlexCenter } from "../layouts/generalComponent
import * as splashStyles from "../components/splash/styles";
import { fetchAndParseJSON } from "../util/datasetsHelpers";
import DatasetSelect from "../components/Datasets/dataset-select";
+import ListResources from "../components/ListResources/index";
import { GroupCards } from "../components/splash/groupCards";
import GenericPage from "../layouts/generic-page";
import { UserContext } from "../layouts/userDataWrapper";
import { DataFetchErrorParagraph } from "../components/splash/errorMessages";
import { groupsTitle, GroupsAbstract } from "../../data/SiteConfig";
-const datasetColumns = ({isNarrative}) => [
+const resourceListingCallback = async (response) => {
+ const sourceUrl = "/charon/getAvailable?prefix=/groups/";
+
+ try {
+ const response = await fetch(sourceUrl, {headers: {accept: "application/json"}});
+ if (response.status !== 200) {
+ throw new Error(`fetching data from "${sourceUrl}" returned status code ${response.status}`);
+ }
+ const datasets = (await response.json()).datasets;
+
+ // Use an empty array as the value side, to indicate that there
+ // are no dated versions associated with this data
+ const pathVersions = Object.assign(
+ ...datasets.map((ds) => ({
+ [ds.request.replace(/^\/groups\//, "")]: []
+ })),
+ );
+
+ return { pathPrefix: "groups/", pathVersions };
+ } catch (err) {
+ console.error(`Error while fetching data from "${sourceUrl}"`);
+ console.error(err);
+ return setDataFetchError(true);
+ }
+}
+
+const datasetColumns = [
{
- name: isNarrative ? "Narrative" : "Dataset",
+ name: "Narrative",
value: (d) => d.request.replace("/groups/", "").replace(/\//g, " / "),
- url: (d) => d.url
+ url: (d) => d.url,
},
{
name: "Group Name",
value: (d) => d.request.split("/")[2],
- url: (d) => `/groups/${d.request.split("/")[2]}`
- }
+ url: (d) => `/groups/${d.request.split("/")[2]}`,
+ },
];
const GroupListingInfo = () => {
@@ -92,31 +119,21 @@ class GroupsPage extends React.Component {
-
- Available Datasets
-
-
-
- {`Note that this listing is refreshed every ~6 hours.
- To see a current listing, visit the page for that group by clicking on that group's tile, above.`}
-
-
-
- {this.state.dataLoaded && (
-
- )}
+
+
+
Available Narratives
+
{this.state.dataLoaded && (
+ columns={datasetColumns}/>
)}
{ this.state.errorFetchingData && }