Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
kyostiebi committed Aug 21, 2023
1 parent af6469c commit 3f3ffd0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/apollo-collaboration-server/.development.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
URL=http://localhost

# MongoDB connection
MONGODB_URI=mongodb://localhost:27017/apolloDb
MONGODB_URI=mongodb://127.0.0.1:27017/apolloDb
# Alternatively, can be a path to a file with the URI
# MONGODB_URI_FILE=/run/secrets/mongodb-uri

Expand Down
57 changes: 31 additions & 26 deletions packages/jbrowse-plugin-apollo/src/components/AddFeature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,6 @@ enum PhaseEnum {
two = 2,
}

async function fetchValidDescendantTerms(
parentFeature: AnnotationFeatureI | undefined,
ontologyStore: OntologyStore,
_signal: AbortSignal,
) {
if (parentFeature) {
// since this is a child of an existing feature, restrict the autocomplete choices to valid
// parts of that feature
const parentTypeTerms = (
await ontologyStore.getTermsWithLabelOrSynonym(parentFeature.type, {
includeSubclasses: false,
})
).filter(isOntologyClass)
if (parentTypeTerms.length) {
const subpartTerms = await ontologyStore.getClassesThat(
'part_of',
parentTypeTerms,
)
return subpartTerms
}
}
return undefined
}

export function AddFeature({
session,
handleClose,
Expand All @@ -75,8 +51,37 @@ export function AddFeature({
const [phase, setPhase] = useState('')
const [phaseAsNumber, setPhaseAsNumber] = useState<PhaseEnum>()
const [showPhase, setShowPhase] = useState<boolean>(false)

const [errorMessage, setErrorMessage] = useState('')
const [tmpText, setTmpText] = useState('')

async function fetchValidDescendantTerms(
parentFeature: AnnotationFeatureI | undefined,
ontologyStore: OntologyStore,
_signal: AbortSignal,
) {
if (parentFeature) {
// since this is a child of an existing feature, restrict the autocomplete choices to valid
// parts of that feature
const parentTypeTerms = (
await ontologyStore.getTermsWithLabelOrSynonym(parentFeature.type, {
includeSubclasses: false,
})
).filter(isOntologyClass)
if (parentTypeTerms.length) {
const subpartTerms = await ontologyStore.getClassesThat(
'part_of',
parentTypeTerms,
)
if (subpartTerms.length > 0) {
setTmpText('')
} else {
setTmpText(`No possible child type for "${parentFeature.type}"`)
}
return subpartTerms
}
}
return undefined
}

async function onSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
Expand Down Expand Up @@ -192,6 +197,7 @@ export function AddFeature({
}
}}
/>
<div style={{ backgroundColor: 'yellow' }}>{tmpText}</div>
{showPhase ? (
<FormControl>
<InputLabel>Phase</InputLabel>
Expand All @@ -203,7 +209,6 @@ export function AddFeature({
</FormControl>
) : null}
</DialogContent>

<DialogActions>
<Button
variant="contained"
Expand Down

0 comments on commit 3f3ffd0

Please sign in to comment.