Add logger to viewport grid
This commit is contained in:
parent
df8c4db2ed
commit
8581405352
@ -60,7 +60,7 @@ const LoggerProvider = ({ children, service }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the implementation of a log service that can be used by extensions.
|
* Sets the implementation of a log service that can be used by extensions
|
||||||
*
|
*
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
@ -74,7 +74,7 @@ const LoggerProvider = ({ children, service }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Higher Order Component to use the log methods through a Class Component.
|
* Higher Order Component to use the log methods through a Class Component
|
||||||
*
|
*
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import React, { useEffect } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { utils } from '@ohif/core';
|
import { utils } from '@ohif/core';
|
||||||
import { useSnackbarContext } from '@ohif/ui';
|
import { useSnackbarContext, useLogger } from '@ohif/ui';
|
||||||
//
|
//
|
||||||
import ViewportPane from './ViewportPane.js';
|
import ViewportPane from './ViewportPane.js';
|
||||||
import DefaultViewport from './DefaultViewport.js';
|
import DefaultViewport from './DefaultViewport.js';
|
||||||
@ -36,14 +36,15 @@ const ViewportGrid = function (props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const snackbar = useSnackbarContext();
|
const snackbar = useSnackbarContext();
|
||||||
|
const logger = useLogger();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isStudyLoaded) {
|
if (isStudyLoaded) {
|
||||||
viewportData.forEach(displaySet => {
|
viewportData.forEach(displaySet => {
|
||||||
const promises = loadAndCacheDerivedDisplaySets(displaySet, studies);
|
const promises = loadAndCacheDerivedDisplaySets(displaySet, studies);
|
||||||
|
|
||||||
promises.forEach(promise => {
|
promises.forEach(promise => {
|
||||||
promise.catch(error => {
|
promise.catch(error => {
|
||||||
|
logger.error({ error, message: error.message });
|
||||||
snackbar.show({
|
snackbar.show({
|
||||||
title: 'Error loading derived display set:',
|
title: 'Error loading derived display set:',
|
||||||
message: error.message,
|
message: error.message,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user