diff --git a/packages/core/ui/ErrorMessageStackTraceDialog.tsx b/packages/core/ui/ErrorMessageStackTraceDialog.tsx index 6a7eaed4a8..726c011573 100644 --- a/packages/core/ui/ErrorMessageStackTraceDialog.tsx +++ b/packages/core/ui/ErrorMessageStackTraceDialog.tsx @@ -88,6 +88,42 @@ function stripMessage(trace: string, error: unknown) { } } +function Contents({ text }: { text: string }) { + const err = encodeURIComponent( + 'I got this error from JBrowse, here is the stack trace:\n\n```\n' + + text + + '\n```\n', + ) + const githubLink = `https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${err}` + const emailLink = `mailto:jbrowse2dev@gmail.com?subject=JBrowse%202%20error&body=${err}` + + return ( + <> + + Post a new issue at{' '} + + GitHub + {' '} + or send an email to{' '} + + jbrowse2dev@gmail.com + {' '} + +
+        {text}
+      
+ + ) +} + export default function ErrorMessageStackTraceDialog({ error, onClose, @@ -128,42 +164,13 @@ export default function ErrorMessageStackTraceDialog({ window.JBrowseSession ? `JBrowse ${window.JBrowseSession.version}` : '', ].join('\n') - const err = encodeURIComponent( - 'I got this error from JBrowse, here is the stack trace:\n\n```\n' + - errorBoxText + - '\n```\n', - ) - const githubLink = `https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${err}` - const emailLink = `mailto:jbrowse2dev@gmail.com?subject=JBrowse%202%20error&body=${err}` return ( {mappedStackTrace === undefined ? ( ) : ( - <> - - Post a new issue at{' '} - - GitHub - {' '} - or send an email to{' '} - - jbrowse2dev@gmail.com - {' '} - -
-              {errorBoxText}
-            
- + )}
diff --git a/packages/product-core/src/ui/FileInfoPanel.tsx b/packages/product-core/src/ui/FileInfoPanel.tsx index 46c708067c..3323adbe92 100644 --- a/packages/product-core/src/ui/FileInfoPanel.tsx +++ b/packages/product-core/src/ui/FileInfoPanel.tsx @@ -1,15 +1,14 @@ import React, { useState, useEffect } from 'react' -import { Typography } from '@mui/material' import { readConfObject, AnyConfigurationModel, } from '@jbrowse/core/configuration' -import LoadingEllipses from '@jbrowse/core/ui/LoadingEllipses' import { getSession } from '@jbrowse/core/util' import { BaseCard, Attributes, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail' +import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui' type FileInfo = Record | string @@ -24,32 +23,19 @@ export default function FileInfoPanel({ const { rpcManager } = session useEffect(() => { - const aborter = new AbortController() - const { signal } = aborter - let cancelled = false // eslint-disable-next-line @typescript-eslint/no-floating-promises ;(async () => { try { const adapterConfig = readConfObject(config, 'adapter') const result = await rpcManager.call(config.trackId, 'CoreGetInfo', { adapterConfig, - signal, }) - if (!cancelled) { - setInfo(result as FileInfo) - } + setInfo(result as FileInfo) } catch (e) { - if (!cancelled) { - console.error(e) - setError(e) - } + console.error(e) + setError(e) } })() - - return () => { - aborter.abort() - cancelled = true - } }, [config, rpcManager]) const details = @@ -64,7 +50,7 @@ export default function FileInfoPanel({ return info !== null ? ( {error ? ( - {`${error}`} + ) : info === undefined ? ( ) : ( diff --git a/plugins/alignments/src/shared/BaseDisplayComponent.tsx b/plugins/alignments/src/shared/BaseDisplayComponent.tsx index 918f7117c2..633b272b98 100644 --- a/plugins/alignments/src/shared/BaseDisplayComponent.tsx +++ b/plugins/alignments/src/shared/BaseDisplayComponent.tsx @@ -6,11 +6,12 @@ import { } from '@jbrowse/plugin-linear-genome-view' import { makeStyles } from 'tss-react/mui' import { observer } from 'mobx-react' +import { getContainingView } from '@jbrowse/core/util' +import { Button, Tooltip } from '@mui/material' // local import { LinearReadCloudDisplayModel } from '../LinearReadCloudDisplay/model' import { LinearReadArcsDisplayModel } from '../LinearReadArcsDisplay/model' -import { getContainingView } from '@jbrowse/core/util' const useStyles = makeStyles()(theme => ({ loading: { @@ -38,8 +39,13 @@ const BaseDisplayComponent = observer(function ({ + + + } /> ) : regionTooLarge ? ( model.regionCannotBeRendered() diff --git a/plugins/arc/src/LinearPairedArcDisplay/components/BaseDisplayComponent.tsx b/plugins/arc/src/LinearPairedArcDisplay/components/BaseDisplayComponent.tsx index 57c228b4c6..91bd153bc7 100644 --- a/plugins/arc/src/LinearPairedArcDisplay/components/BaseDisplayComponent.tsx +++ b/plugins/arc/src/LinearPairedArcDisplay/components/BaseDisplayComponent.tsx @@ -1,4 +1,5 @@ -import React from 'react' +import React, { lazy } from 'react' +import { IconButton, Tooltip } from '@mui/material' import { LoadingEllipses } from '@jbrowse/core/ui' import { BlockMsg } from '@jbrowse/plugin-linear-genome-view' import { makeStyles } from 'tss-react/mui' @@ -7,6 +8,16 @@ import { observer } from 'mobx-react' // local import { LinearArcDisplayModel } from '../model' +// icons +import RefreshIcon from '@mui/icons-material/Refresh' +import ReportIcon from '@mui/icons-material/Report' + +import { getSession } from '@jbrowse/core/util' + +const ErrorMessageStackTraceDialog = lazy( + () => import('@jbrowse/core/ui/ErrorMessageStackTraceDialog'), +) + const useStyles = makeStyles()(theme => ({ loading: { backgroundColor: theme.palette.background.default, @@ -33,8 +44,30 @@ const BaseDisplayComponent = observer(function ({ + + model.reload()} + > + + + + + { + getSession(model).queueDialog(onClose => [ + ErrorMessageStackTraceDialog, + { onClose, error: model.error as Error }, + ]) + }} + > + + + + + } /> ) : regionTooLarge ? ( model.regionCannotBeRendered() diff --git a/plugins/data-management/src/HierarchicalTrackSelectorWidget/components/dialogs/ManageConnectionsDialog.tsx b/plugins/data-management/src/HierarchicalTrackSelectorWidget/components/dialogs/ManageConnectionsDialog.tsx index 601b9c892d..6926e543b7 100644 --- a/plugins/data-management/src/HierarchicalTrackSelectorWidget/components/dialogs/ManageConnectionsDialog.tsx +++ b/plugins/data-management/src/HierarchicalTrackSelectorWidget/components/dialogs/ManageConnectionsDialog.tsx @@ -26,6 +26,16 @@ const useStyles = makeStyles()(theme => ({ }, })) +function DisabledButton() { + return ( + + + + + + ) +} + const ManageConnectionsDialog = observer(function ({ session, handleClose, @@ -53,11 +63,7 @@ const ManageConnectionsDialog = observer(function ({ ) : ( - - - - - + )} {name} diff --git a/plugins/linear-genome-view/src/BaseLinearDisplay/components/BlockMsg.tsx b/plugins/linear-genome-view/src/BaseLinearDisplay/components/BlockMsg.tsx index 7d6b984b82..2ab327747d 100644 --- a/plugins/linear-genome-view/src/BaseLinearDisplay/components/BlockMsg.tsx +++ b/plugins/linear-genome-view/src/BaseLinearDisplay/components/BlockMsg.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Tooltip, Button, Alert, AlertColor } from '@mui/material' +import { Tooltip, Alert, AlertColor } from '@mui/material' import { makeStyles } from 'tss-react/mui' const useStyles = makeStyles()({ @@ -12,26 +12,17 @@ const useStyles = makeStyles()({ export default function BlockMsg({ message, severity, - buttonText, - icon, action, }: { message: string severity?: AlertColor - buttonText?: string - icon?: React.ReactNode - action?: () => void + action?: React.ReactNode }) { const { classes } = useStyles() - const button = action ? ( - - ) : null return ( diff --git a/plugins/linear-genome-view/src/BaseLinearDisplay/components/LinearBlocks.tsx b/plugins/linear-genome-view/src/BaseLinearDisplay/components/LinearBlocks.tsx index d1a50abb3b..7e5d10ba36 100644 --- a/plugins/linear-genome-view/src/BaseLinearDisplay/components/LinearBlocks.tsx +++ b/plugins/linear-genome-view/src/BaseLinearDisplay/components/LinearBlocks.tsx @@ -58,10 +58,10 @@ const RenderedBlocks = observer(function ({ block={block} key={`${model.id}-${block.key}`} > - {state && state.ReactComponent ? ( + {state?.ReactComponent ? ( ) : null} - {state && state.maxHeightReached ? ( + {state?.maxHeightReached ? (
import('@jbrowse/core/ui/ErrorMessageStackTraceDialog'), +) + const useStyles = makeStyles()(theme => { const bg = theme.palette.action.disabledBackground return { @@ -22,12 +29,10 @@ const useStyles = makeStyles()(theme => { } }) -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const LoadingMessage = observer(({ model }: { model: any }) => { +const LoadingMessage = observer(({ model }: { model: { status?: string } }) => { const { classes } = useStyles() const { status: blockStatus } = model - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const { message: displayStatus } = getParent(model, 2) + const { message: displayStatus } = getParent<{ message?: string }>(model, 2) const status = displayStatus || blockStatus return (
@@ -39,17 +44,44 @@ const LoadingMessage = observer(({ model }: { model: any }) => { const ServerSideRenderedBlockContent = observer(function ({ model, }: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - model: any + model: { + error?: unknown + reload: () => void + message: React.ReactNode + filled?: boolean + status?: string + reactElement?: React.ReactElement + } }) { if (model.error) { return ( } - action={model.reload} + action={ + <> + + model.reload()} + > + + + + + { + getSession(model).queueDialog(onClose => [ + ErrorMessageStackTraceDialog, + { onClose, error: model.error as Error }, + ]) + }} + > + + + + + } /> ) } else if (model.message) { diff --git a/plugins/linear-genome-view/src/BaseLinearDisplay/components/TooLargeMessage.tsx b/plugins/linear-genome-view/src/BaseLinearDisplay/components/TooLargeMessage.tsx index 3856d247a5..82ea071cdd 100644 --- a/plugins/linear-genome-view/src/BaseLinearDisplay/components/TooLargeMessage.tsx +++ b/plugins/linear-genome-view/src/BaseLinearDisplay/components/TooLargeMessage.tsx @@ -3,6 +3,7 @@ import { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter' // locals import BlockMsg from '../components/BlockMsg' +import { Button } from '@mui/material' function TooLargeMessage({ model, @@ -18,11 +19,16 @@ function TooLargeMessage({ return ( { - model.setFeatureDensityStatsLimit(model.featureDensityStats) - model.reload() - }} - buttonText="Force load" + action={ + + } message={[ regionTooLargeReason, 'Zoom in to see features or force load (may be slow)',