Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display message if sequence ontology is unavailable (#453) #459

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import { SixFrameFeatureDisplay } from './SixFrameFeatureDisplay/stateModel'
import { TabularEditorPane } from './TabularEditor'

import { getSession } from '@jbrowse/core/util'

Check warning on line 17 in packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx#L17

Added line #L17 was not covered by tests
import { ApolloSessionModel } from './session'

const accordionControlHeight = 12

const useStyles = makeStyles()((theme) => ({
Expand Down Expand Up @@ -155,6 +158,11 @@
}: {
model: LinearApolloDisplayI
}) {
const session = getSession(model) as unknown as ApolloSessionModel
const { ontologyManager } = session.apolloDataStore
const { featureTypeOntology } = ontologyManager

Check warning on line 163 in packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx#L161-L163

Added lines #L161 - L163 were not covered by tests
const ontologyStore = featureTypeOntology?.dataStore

const { classes } = useStyles()

const {
Expand All @@ -177,6 +185,30 @@
useEffect(() => {
scrollSelectedFeatureIntoView(model, canvasScrollContainerRef)
}, [model, selectedFeature])

if (!ontologyStore) {
return (

Check warning on line 190 in packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx#L190

Added line #L190 was not covered by tests
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '25%',
}}
>
<p
style={{
color: 'DimGray',
fontSize: '100%',
backgroundColor: 'white',
}}
>
{'Sequence ontology not found. Please load one before continuing'}
</p>
</div>
)
}

return (
<div className={classes.details} style={{ height: overallHeight }}>
<AccordionControl
Expand Down