-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
88 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
plugins/linear-genome-view/src/LinearGenomeView/components/ImportFormRefNameAutocomplete.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react' | ||
import { observer } from 'mobx-react' | ||
import { getSession } from '@jbrowse/core/util' | ||
import BaseResult from '@jbrowse/core/TextSearch/BaseResults' | ||
|
||
// locals | ||
import RefNameAutocomplete from './RefNameAutocomplete' | ||
import { fetchResults } from './util' | ||
import { LinearGenomeViewModel } from '..' | ||
|
||
type LGV = LinearGenomeViewModel | ||
|
||
const ImportFormRefNameAutocomplete = observer(function ({ | ||
model, | ||
selectedAsm, | ||
value, | ||
setValue, | ||
setOption, | ||
}: { | ||
value: string | ||
setValue: (arg: string) => void | ||
model: LGV | ||
selectedAsm: string | ||
setOption: (arg: BaseResult) => void | ||
}) { | ||
const session = getSession(model) | ||
const { assemblyManager, textSearchManager } = session | ||
const { rankSearchResults } = model | ||
const searchScope = model.searchScope(selectedAsm) | ||
const assembly = assemblyManager.get(selectedAsm) | ||
return ( | ||
<RefNameAutocomplete | ||
fetchResults={queryString => | ||
fetchResults({ | ||
queryString, | ||
assembly, | ||
textSearchManager, | ||
rankSearchResults, | ||
searchScope, | ||
}) | ||
} | ||
model={model} | ||
assemblyName={selectedAsm} | ||
value={value} | ||
minWidth={270} | ||
onChange={str => setValue(str)} | ||
onSelect={val => setOption(val)} | ||
TextFieldProps={{ | ||
variant: 'outlined', | ||
helperText: 'Enter sequence name, feature name, or location', | ||
}} | ||
/> | ||
) | ||
}) | ||
|
||
export default ImportFormRefNameAutocomplete |