Add exit mpr action

This commit is contained in:
igoroctaviano 2021-01-20 20:59:03 -03:00
parent f07f21117d
commit 8038009afd
2 changed files with 13 additions and 10 deletions

View File

@ -363,7 +363,7 @@ class OHIFVTKViewport extends Component {
const { UINotificationService } = this.props.servicesManager.services;
if (this.props.viewportIndex === 0) {
const message = error.message.includes('buffer')
? 'Buffer allocation limit exceeded'
? 'Dataset is too big to display in MPR'
: error.message;
console.error(errorTitle, error);
UINotificationService.show({
@ -371,15 +371,14 @@ class OHIFVTKViewport extends Component {
message,
type: 'error',
autoClose: false,
/* action: {
label: 'Download',
onClick: () => {
const listOfUIDs = [window.location.href.split('/').pop()];
this.props.commandsManager.runCommand('downloadAndZip', {
listOfUIDs,
});
action: {
label: 'Exit 2D MPR',
onClick: ({ close }) => {
// context: 'ACTIVE_VIEWPORT::VTK',
close();
this.props.commandsManager.runCommand('setCornerstoneLayout');
},
}, */
},
});
}
this.setState({ isLoaded: true });

View File

@ -5,6 +5,10 @@ const SnackbarItem = ({ options, onClose }) => {
onClose(options.id);
};
const handleClick = () => {
options.action.onClick({ ...options, close: handleClose });
};
useEffect(() => {
if (options.autoClose) {
setTimeout(() => {
@ -25,7 +29,7 @@ const SnackbarItem = ({ options, onClose }) => {
{options.title && <div className="sb-title">{options.title}</div>}
{options.message && <div className="sb-message">{options.message}</div>}
{options.action && (
<button className="sb-action" onClick={options.action.onClick}>
<button className="sb-action" onClick={handleClick}>
{options.action.label}
</button>
)}