Merge pull request #2241 from OHIF/IDC-2223
feat(IDC-2223): Add error notification on microscopy viewport initialization errors
This commit is contained in:
commit
cb147dfc69
@ -62,11 +62,24 @@ class DicomMicroscopyViewport extends Component {
|
|||||||
);
|
);
|
||||||
const microscopyViewer = api.VLWholeSlideMicroscopyImageViewer;
|
const microscopyViewer = api.VLWholeSlideMicroscopyImageViewer;
|
||||||
|
|
||||||
this.viewer = new microscopyViewer({
|
try {
|
||||||
client: dicomWebClient,
|
this.viewer = new microscopyViewer({
|
||||||
metadata,
|
client: dicomWebClient,
|
||||||
retrieveRendered: false,
|
metadata,
|
||||||
});
|
retrieveRendered: false,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[Microscopy Viewer] Failed to load:', error);
|
||||||
|
const { UINotificationService } = this.props.servicesManager.services;
|
||||||
|
if (UINotificationService) {
|
||||||
|
UINotificationService.show({
|
||||||
|
title: 'Microscopy Viewport',
|
||||||
|
message:
|
||||||
|
'Failed to load viewport. Please check that you have hardware acceleration enabled.',
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.viewer.render({ container });
|
this.viewer.render({ container });
|
||||||
});
|
});
|
||||||
@ -92,8 +105,8 @@ class DicomMicroscopyViewport extends Component {
|
|||||||
{this.state.error ? (
|
{this.state.error ? (
|
||||||
<h2>{JSON.stringify(this.state.error)}</h2>
|
<h2>{JSON.stringify(this.state.error)}</h2>
|
||||||
) : (
|
) : (
|
||||||
<div style={style} ref={this.container} />
|
<div style={style} ref={this.container} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,14 +6,6 @@ const Component = React.lazy(() => {
|
|||||||
return import('./DicomMicroscopyViewport');
|
return import('./DicomMicroscopyViewport');
|
||||||
});
|
});
|
||||||
|
|
||||||
const DicomMicroscopyViewport = props => {
|
|
||||||
return (
|
|
||||||
<React.Suspense fallback={<div>Loading...</div>}>
|
|
||||||
<Component {...props} />
|
|
||||||
</React.Suspense>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* Only required property. Should be a unique value across all extensions.
|
* Only required property. Should be a unique value across all extensions.
|
||||||
@ -21,8 +13,14 @@ export default {
|
|||||||
id: 'microscopy',
|
id: 'microscopy',
|
||||||
version,
|
version,
|
||||||
|
|
||||||
getViewportModule() {
|
getViewportModule({ servicesManager }) {
|
||||||
return DicomMicroscopyViewport;
|
return props => {
|
||||||
|
return (
|
||||||
|
<React.Suspense fallback={<div>Loading...</div>}>
|
||||||
|
<Component {...props} servicesManager={servicesManager} />
|
||||||
|
</React.Suspense>
|
||||||
|
);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
getSopClassHandlerModule() {
|
getSopClassHandlerModule() {
|
||||||
return DicomMicroscopySopClassHandler;
|
return DicomMicroscopySopClassHandler;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user