Skip to content

Commit

Permalink
/groups/:groupName not found behavior;
Browse files Browse the repository at this point in the history
Show a message saying the group
doesnt exist yet. Also don't make the
getAvailable request unnecessarily.
  • Loading branch information
eharkins committed May 6, 2021
1 parent 7b29d4a commit ce29c44
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions static-site/src/sections/individual-group-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,23 @@ class Index extends React.Component {
})
.catch((err) => {
console.error("Cannot find group.", err.message);
this.setState({groupNotFound: true});
this.setState({groupName, groupNotFound: true});
})
.then((sourceInfo) => {
if (sourceInfo.showDatasets || sourceInfo.showNarratives) {
if (sourceInfo && (sourceInfo.showDatasets || sourceInfo.showNarratives)) {
return fetchAndParseJSON(`/charon/getAvailable?prefix=/groups/${groupName}/`);
}
return undefined;
})
.then((availableDataJson) => {
this.setState({
datasets: this.createDatasetListing(availableDataJson.datasets, groupName),
narratives: this.createDatasetListing(availableDataJson.narratives, groupName),
dataLoaded: true,
groupName
});
if (availableDataJson) {
this.setState({
datasets: this.createDatasetListing(availableDataJson.datasets, groupName),
narratives: this.createDatasetListing(availableDataJson.narratives, groupName),
dataLoaded: true,
groupName
});
}
})
.catch((err) => {
console.error("Error fetching / parsing data.", err.message);
Expand Down Expand Up @@ -194,6 +196,13 @@ class Index extends React.Component {
Please <a href="mailto:hello@nextstrain.org">contact us at hello@nextstrain.org </a>
if this continues to happen.</splashStyles.CenteredFocusParagraph>
</FlexCenter>}
{ this.state.groupNotFound &&
<FlexCenter>
<splashStyles.CenteredFocusParagraph>
{`The Nextstrain Group "${this.state.groupName}" doesn't exist yet. `}
Please <a href="mailto:hello@nextstrain.org">contact us at hello@nextstrain.org </a>
if you believe this to be an error.</splashStyles.CenteredFocusParagraph>
</FlexCenter>}
</GenericPage>
);
}
Expand Down

0 comments on commit ce29c44

Please sign in to comment.