Unverified Commit 0bf38aae authored by Imran Salam's avatar Imran Salam Committed by GitHub
Browse files

Remove message and retry button for PDBe error responses (#475)

parent 50afc556
Pipeline #137400 passed with stages
in 5 minutes and 28 seconds
......@@ -60,8 +60,3 @@ $content-width: $gene_image_width;
justify-content: center;
margin-top: 40px;
}
.errorMessage{
color: $red;
margin-right:20px;
font-weight: $normal;
}
......@@ -20,7 +20,6 @@ import set from 'lodash/fp/set';
import { Pick2 } from 'ts-multipick';
import { CircleLoader } from 'src/shared/components/loader/Loader';
import { PrimaryButton } from 'src/shared/components/button/Button';
import ProteinDomainImage from 'src/content/app/entity-viewer/gene-view/components/protein-domain-image/ProteinDomainImage';
import ProteinImage from 'src/content/app/entity-viewer/gene-view/components/protein-image/ProteinImage';
import ProteinFeaturesCount from 'src/content/app/entity-viewer/gene-view/components/protein-features-count/ProteinFeaturesCount';
......@@ -177,6 +176,10 @@ const ProteinsListItemInfo = (props: Props) => {
};
}, [summaryStatsLoadingState, uniprotXref]);
const showLoadingIndicator =
domainsLoadingState === LoadingState.LOADING ||
summaryStatsLoadingState === LoadingState.LOADING;
return (
<div className={styles.proteinsListItemInfo}>
{productWithProteinDomains && (
......@@ -237,58 +240,17 @@ const ProteinsListItemInfo = (props: Props) => {
</div>
)}
</>
<StatusContent
summaryLoadingState={summaryStatsLoadingState}
domainsLoadingState={domainsLoadingState}
setSummaryStatsLoadingState={setSummaryStatsLoadingState}
setDomainsLoadingState={setDomainsLoadingState}
/>
{showLoadingIndicator && (
<div className={styles.statusContainer}>
<CircleLoader />
</div>
)}
<div className={styles.keyline}></div>
</div>
</div>
);
};
type StatusContentProps = {
summaryLoadingState: LoadingState;
domainsLoadingState: LoadingState;
setSummaryStatsLoadingState: (loadingState: LoadingState) => void;
setDomainsLoadingState: (loadingState: LoadingState) => void;
};
const StatusContent = (props: StatusContentProps) => {
if (
props.domainsLoadingState === LoadingState.LOADING ||
props.summaryLoadingState === LoadingState.LOADING
) {
return (
<div className={styles.statusContainer}>
<CircleLoader />
</div>
);
}
const retryHandler = () => {
if (props.domainsLoadingState === LoadingState.ERROR) {
props.setDomainsLoadingState(LoadingState.LOADING);
}
if (props.summaryLoadingState === LoadingState.ERROR) {
props.setSummaryStatsLoadingState(LoadingState.LOADING);
}
};
return props.domainsLoadingState === LoadingState.ERROR ||
props.summaryLoadingState === LoadingState.ERROR ? (
<div className={styles.statusContainer}>
<span className={styles.errorMessage}>
Failed to get data from PDBe Knowledge Base.
</span>
<PrimaryButton onClick={retryHandler}>Try again</PrimaryButton>
</div>
) : null;
};
type ProteinExternalReferenceProps = {
source: ExternalSource;
accessionId: string;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment