diff --git a/extensions/default/src/Panels/PanelMeasurementTable.tsx b/extensions/default/src/Panels/PanelMeasurementTable.tsx index fb890117828..78c6a905d8c 100644 --- a/extensions/default/src/Panels/PanelMeasurementTable.tsx +++ b/extensions/default/src/Panels/PanelMeasurementTable.tsx @@ -8,14 +8,6 @@ import { utils } from '@ohif/core'; const { downloadCSVReport } = utils; -// tools with measurements to display inside the panel -const MEASUREMENT_TOOLS = [ - 'EllipticalROI', - 'RectangleROI', - 'Length', - 'Bidirectional', -]; - export default function PanelMeasurementTable({ servicesManager, commandsManager, @@ -185,12 +177,8 @@ PanelMeasurementTable.propTypes = { function _getMappedMeasurements(MeasurementService) { const measurements = MeasurementService.getMeasurements(); - // filter out measurements whose toolName is not in MEASUREMENT_TOOLS - const measurementTools = measurements.filter(measurement => - MEASUREMENT_TOOLS.includes(measurement.toolName) - ); - const mappedMeasurements = measurementTools.map((m, index) => + const mappedMeasurements = measurements.map((m, index) => _mapMeasurementToDisplay(m, index, MeasurementService.VALUE_TYPES) ); diff --git a/extensions/default/src/ViewerLayout/index.tsx b/extensions/default/src/ViewerLayout/index.tsx index 562760b0435..fb5fb5503e4 100644 --- a/extensions/default/src/ViewerLayout/index.tsx +++ b/extensions/default/src/ViewerLayout/index.tsx @@ -122,10 +122,29 @@ function ViewerLayout({ }; }, []); - const getPanelData = id => { + const getComponent = id => { const entry = extensionManager.getModuleEntry(id); - // TODO, not sure why sidepanel content has to be JSX, and not a children prop? - const content = entry.component; + + if (!entry) { + throw new Error( + `${id} is not a valid entry for an extension module, please check your configuration or make sure the extension is registered.` + ); + } + + let content; + if (entry && entry.component) { + content = entry.component; + } else { + throw new Error( + `No component found from extension ${id}. Check the reference string to the extension in your Mode configuration` + ); + } + + return { entry, content }; + }; + + const getPanelData = id => { + const { content, entry } = getComponent(id); return { iconName: entry.iconName, @@ -156,7 +175,7 @@ function ViewerLayout({ }, [HangingProtocolService]); const getViewportComponentData = viewportComponent => { - const entry = extensionManager.getModuleEntry(viewportComponent.namespace); + const { entry } = getComponent(viewportComponent.namespace); return { component: entry.component, diff --git a/platform/core/src/services/MeasurementService/MeasurementService.js b/platform/core/src/services/MeasurementService/MeasurementService.js index 789218acf1e..f7258941d03 100644 --- a/platform/core/src/services/MeasurementService/MeasurementService.js +++ b/platform/core/src/services/MeasurementService/MeasurementService.js @@ -498,8 +498,7 @@ class MeasurementService { measurement.source = source; } catch (error) { throw new Error( - `Failed to map '${sourceInfo}' measurement for annotationType ${annotationType}:`, - error.message + `Failed to map '${sourceInfo}' measurement for annotationType ${annotationType}: ${error.message}` ); } diff --git a/platform/ui/src/components/ErrorBoundary/ErrorBoundary.tsx b/platform/ui/src/components/ErrorBoundary/ErrorBoundary.tsx index b101e695cea..3f89f7991f0 100644 --- a/platform/ui/src/components/ErrorBoundary/ErrorBoundary.tsx +++ b/platform/ui/src/components/ErrorBoundary/ErrorBoundary.tsx @@ -1,11 +1,18 @@ import React, { useState } from 'react'; import { ErrorBoundary as ReactErrorBoundary } from 'react-error-boundary'; +import { Icon, IconButton } from '@ohif/ui'; import PropTypes from 'prop-types'; import Modal from '../Modal'; const isProduction = process.env.NODE_ENV === 'production'; -const DefaultFallback = ({ error, componentStack, context, resetErrorBoundary, fallbackRoute }) => { +const DefaultFallback = ({ + error, + context, + resetErrorBoundary, + fallbackRoute, +}) => { + const [showDetails, setShowDetails] = useState(false); const title = `Something went wrong${!isProduction && ` in ${context}`}.`; const subtitle = `Sorry, something went wrong there. Try again.`; return ( @@ -13,17 +20,33 @@ const DefaultFallback = ({ error, componentStack, context, resetErrorBoundary, f
{title}
{subtitle}
{!isProduction && ( -Context: {context}-
Error Message: {error.message}-
Stack: {componentStack}+
Context: {context}
+Error Message: {error.message}
+ +Stack: {error.stack}
+ )}