, attr: string) {
@@ -32,7 +37,7 @@ function removeAttr(obj: Record
, attr: string) {
return obj
}
-export default function AboutContents({
+const AboutDialogContents = observer(function ({
config,
}: {
config: AnyConfigurationModel
@@ -41,6 +46,7 @@ export default function AboutContents({
const conf = readConfObject(config)
const session = getSession(config)
const { classes } = useStyles()
+ const [showRefNames, setShowRefNames] = useState(false)
const hideUris =
getConf(session, ['formatAbout', 'hideUris']) ||
@@ -71,18 +77,26 @@ export default function AboutContents({
{!hideUris ? (
- {
- const snap = removeAttr(clone(conf), 'baseUri')
- copy(JSON.stringify(snap, null, 2))
- setCopied(true)
- setTimeout(() => setCopied(false), 1000)
- }}
- >
- {copied ? 'Copied to clipboard!' : 'Copy config'}
-
+
+ setShowRefNames(true)}
+ >
+ Show ref names
+
+ {
+ const snap = removeAttr(clone(conf), 'baseUri')
+ copy(JSON.stringify(snap, null, 2))
+ setCopied(true)
+ setTimeout(() => setCopied(false), 1000)
+ }}
+ >
+ {copied ? 'Copied to clipboard!' : 'Copy config'}
+
+
) : null}
) : null}
+ {showRefNames ? (
+ setShowRefNames(false)}
+ />
+ ) : null}
)
-}
+})
+
+export default AboutDialogContents
diff --git a/packages/product-core/src/ui/RefNameInfoDialog.tsx b/packages/product-core/src/ui/RefNameInfoDialog.tsx
new file mode 100644
index 0000000000..5bab3fca73
--- /dev/null
+++ b/packages/product-core/src/ui/RefNameInfoDialog.tsx
@@ -0,0 +1,126 @@
+import React, { useState, useEffect } from 'react'
+import { Button, DialogContent, Typography } from '@mui/material'
+import {
+ readConfObject,
+ AnyConfigurationModel,
+} from '@jbrowse/core/configuration'
+import { Dialog, LoadingEllipses } from '@jbrowse/core/ui'
+import { getSession } from '@jbrowse/core/util'
+import { observer } from 'mobx-react'
+import { makeStyles } from 'tss-react/mui'
+import copy from 'copy-to-clipboard'
+
+const MAX_REF_NAMES = 10_000
+
+const useStyles = makeStyles()(theme => ({
+ container: {
+ minWidth: 800,
+ },
+ refNames: {
+ maxHeight: 300,
+ width: '100%',
+ overflow: 'auto',
+ flexGrow: 1,
+ background: theme.palette.background.default,
+ },
+}))
+
+const RefNameInfoDialog = observer(function ({
+ config,
+ onClose,
+}: {
+ config: AnyConfigurationModel
+ onClose: () => void
+}) {
+ const [error, setError] = useState()
+ const [refNames, setRefNames] = useState>()
+ const [copied, setCopied] = useState(false)
+ const { classes } = useStyles()
+ const session = getSession(config)
+ const { rpcManager } = session
+
+ useEffect(() => {
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
+ ;(async () => {
+ try {
+ const assemblyNames = [
+ ...new Set(readConfObject(config, 'assemblyNames') as string[]),
+ ]
+ const map = await Promise.all(
+ assemblyNames.map(async assemblyName => {
+ const adapterConfig = readConfObject(config, 'adapter')
+ return [
+ assemblyName,
+ (await rpcManager.call(config.trackId, 'CoreGetRefNames', {
+ adapterConfig,
+ // hack for synteny adapters
+ regions: [{ assemblyName }],
+ })) as string[],
+ ] as const
+ }),
+ )
+ setRefNames(Object.fromEntries(map))
+ } catch (e) {
+ console.error(e)
+ setError(e)
+ }
+ })()
+ }, [config, rpcManager])
+
+ const names = refNames ? Object.entries(refNames) : []
+ const result = names
+ .flatMap(([assemblyName, refNames]) => {
+ return [
+ `--- ${assemblyName} ---`,
+ ...refNames.slice(0, MAX_REF_NAMES),
+ `${
+ refNames.length > MAX_REF_NAMES
+ ? `\nToo many refNames to show in browser for ${assemblyName}, use "Copy ref names" button to copy to clipboard`
+ : ''
+ }`,
+ ]
+ })
+ .filter(f => !!f)
+ .join('\n')
+
+ return (
+
+
+ {error ? (
+ {`${error}`}
+ ) : refNames === undefined ? (
+
+ ) : (
+ <>
+ {
+ copy(
+ names
+ .flatMap(([assemblyName, refNames]) => [
+ `--- ${assemblyName} ---`,
+ ...refNames,
+ ])
+ .filter(f => !!f)
+ .join('\n'),
+ )
+ setCopied(true)
+ setTimeout(() => setCopied(false), 1000)
+ }}
+ >
+ {copied ? 'Copied to clipboard!' : 'Copy ref names'}
+
+
+ {result}
+ >
+ )}
+
+
+ )
+})
+
+export default RefNameInfoDialog
diff --git a/plugins/alignments/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap b/plugins/alignments/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap
index 2ae866665c..938d2b1179 100644
--- a/plugins/alignments/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap
+++ b/plugins/alignments/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap
@@ -21,7 +21,6 @@ exports[`open up a widget 1`] = `
-
ctgA_3_555_0:0:0_2:0... - match
diff --git a/plugins/variants/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap b/plugins/variants/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap
index a11dee23c9..0f17aac7ba 100644
--- a/plugins/variants/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap
+++ b/plugins/variants/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap
@@ -21,7 +21,6 @@ exports[`renders with just the required model elements 1`] = `