Skip to content

Commit

Permalink
Plugins param
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Aug 30, 2023
1 parent 0ab747c commit 03ab30e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@babel/preset-env": "^7.22.4",
"@babel/preset-react": "^7.22.3",
"babel-loader": "^9.1.2",
"prettier": "^3.0.3",
"webpack": "^5.85.0",
"webpack-cli": "^5.1.1"
}
Expand Down
40 changes: 31 additions & 9 deletions srcjs/components/JsonView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,39 @@ import { messageShiny } from '../utils'

export default function View(props) {
const configObject = JSON.parse(props.config)
const { assembly, tracks, defaultSession, theme, text_index } = configObject
const location = props.location
const state = createViewState({
const {
assembly,
tracks,
defaultSession,
location,
onChange: messageShiny,
configuration: { theme },
aggregateTextSearchAdapters: [text_index],
})
theme,
text_index,
plugins: pluginInput = [],
} = configObject
const location = props.location

const [viewState, setViewState] = useState()
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
;(async () => {
try {
const plugins = await loadPlugins(pluginInput)
const state = createViewState({
assembly,
tracks,
defaultSession,
location,
onChange: messageShiny,
configuration: { theme },
aggregateTextSearchAdapters: [text_index],
plugins: plugins.map(p => p.plugin),
})
state.session.view.showTrack('segdups_ucsc_hg19')
setViewState(state)
} catch (e) {
setError(e)
}
})()
}, [])

return <JBrowseLinearGenomeView viewState={state} />
return <JBrowseLinearGenomeView viewState={viewState} />
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3442,6 +3442,11 @@ pluralize@^8.0.0:
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==

prettier@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==

process@^0.11.10:
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
Expand Down

0 comments on commit 03ab30e

Please sign in to comment.