Skip to content

Commit

Permalink
Display message if sequence ontology is unavailable (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
dariober committed Oct 3, 2024
1 parent 89ccf49 commit 87c546a
Showing 1 changed file with 32 additions and 0 deletions.
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 { TrackLines } from './SixFrameFeatureDisplay/components'
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 @@ export const DisplayComponent = observer(function DisplayComponent({
}: {
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 @@ export const DisplayComponent = observer(function DisplayComponent({
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

0 comments on commit 87c546a

Please sign in to comment.