Skip to content

Commit

Permalink
It worked page
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Sep 10, 2023
1 parent 5e54fd3 commit 86aa499
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 52 deletions.
52 changes: 16 additions & 36 deletions products/jbrowse-web/src/components/NoConfigMessage.tsx
@@ -1,5 +1,4 @@
import React from 'react'
import { inDevelopment } from '@jbrowse/core/util'

export default function NoConfigMessage() {
const links = [
Expand All @@ -21,50 +20,31 @@ export default function NoConfigMessage() {
['test_data/wgbs/config.json', 'WGBS methylation'],
['test_data/methylation_test/config.json', 'Nanopore methylation'],
['test_data/volvox/config_main_thread.json', 'Volvox (mainthreadrpc)'],
['test_data/volvox/config_auth.json', 'Volvox (auth)'],
['test_data/volvox/config_auth_main.json', 'Volvox (auth, mainthreadrpc)'],
['test_data/volvox/config_auth.json', 'Volvox (auth)'],
['test_data/volvoxhub/config.json', 'Volvox (with ucsc-hub)'],
]
const { href, search } = window.location
const { config, ...rest } = Object.fromEntries(new URLSearchParams(search))
const root = href.split('?')[0]
return (
<div>
<h4>
Configuration not found. You may have arrived here if you requested a
config that does not exist or you have not set up your JBrowse yet.
</h4>
{inDevelopment ? (
<>
<div>Sample JBrowse configs:</div>
<ul>
{links.map(([link, name]) => {
const params = new URLSearchParams(
Object.entries({
...rest,
config: link,
}),
)
return (
<li key={name}>
<a href={`${root}?${params}`}>{name}</a>
</li>
)
})}
</ul>
</>
) : (
<>
<div>Sample JBrowse config:</div>
<ul>
<li>
<a href="?config=test_data/volvox/config.json">
Volvox sample data
</a>
<div>Sample JBrowse configs:</div>
<ul>
{links.map(([link, name]) => {
const params = new URLSearchParams(
Object.entries({
...rest,
config: link,
}),
)
return (
<li key={name}>
<a href={`${root}?${params}`}>{name}</a>
</li>
</ul>
</>
)}
)
})}
</ul>
</div>
)
}
33 changes: 17 additions & 16 deletions products/jbrowse-web/src/components/StartScreenErrorMessage.tsx
@@ -1,29 +1,30 @@
import React from 'react'
import { ErrorMessage } from '@jbrowse/core/ui'
import NoConfigMessage from './NoConfigMessage'
import { inDevelopment } from '@jbrowse/core/util'

export default function StartScreenErrorMessage({ error }: { error: unknown }) {
return (
<>
<NoConfigMessage />
{`${error}`.match(/HTTP 404 fetching config.json/) ? (
<div
style={{
margin: 8,
padding: 8,
border: '1px solid black',
background: '#9f9',
}}
>
No config.json found. If you want to learn how to complete your setup,
visit our{' '}
<a href="https://jbrowse.org/jb2/docs/quickstart_web/">
quick start guide
</a>
.
<div>
<h1>It worked!</h1>
<p>
JBrowse 2 is installed. Your next step is to add and configure an
assembly. Follow our{' '}
<a href="https://jbrowse.org/jb2/docs/quickstart_web/">
quick start guide
</a>{' '}
to continue or browse the sample data{' '}
<a href="?config=test_data/volvox/config.json">here</a>.
</p>
{inDevelopment ? <NoConfigMessage /> : null}
</div>
) : (
<ErrorMessage error={error} />
<div>
<h1>Error</h1>
<ErrorMessage error={error} />
</div>
)}
</>
)
Expand Down

0 comments on commit 86aa499

Please sign in to comment.