fix: Switch DICOMFileUploader to use the UIModalService (#1904)
This commit is contained in:
1 parent
d870ac914a
commit
7772fee21a
6 files changed
+108
-63
No files matched your search
@@ -28,13 +28,14 @@ const serviceImplementation = {
|
||||
/**
|
||||
* Show a new UI modal;
|
||||
*
|
||||
* @param {ModalProps} props { content, contentProps, shouldCloseOnEsc, isOpen, closeButton, title, customClassName }
|
||||
* @param {ModalProps} props { content, contentProps, shouldCloseOnEsc, isOpen, onClose, closeButton, title, customClassName }
|
||||
*/
|
||||
function _show({
|
||||
content = null,
|
||||
contentProps = null,
|
||||
shouldCloseOnEsc = false,
|
||||
isOpen = true,
|
||||
onClose = null,
|
||||
closeButton = true,
|
||||
title = null,
|
||||
customClassName = null,
|
||||
@@ -44,6 +45,7 @@ function _show({
|
||||
contentProps,
|
||||
shouldCloseOnEsc,
|
||||
isOpen,
|
||||
onClose,
|
||||
closeButton,
|
||||
title,
|
||||
customClassName,
|
||||
|
||||
@@ -41,13 +41,14 @@
|
||||
"@ohif/i18n": "^0.2.3",
|
||||
"browser-detect": "^0.2.28",
|
||||
"classnames": "2.2.6",
|
||||
"dom-helpers": "^3.3.1",
|
||||
"i18next": "^17.0.3",
|
||||
"i18next-browser-languagedetector": "^3.0.1",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.isequal": "4.5.0",
|
||||
"moment": "2.24.0",
|
||||
"prop-types": "15.6.2",
|
||||
"react-bootstrap-modal": "4.2.0",
|
||||
"prop-types-extra": "^1.1.1",
|
||||
"react-dates": "21.2.1",
|
||||
"react-dnd": "9.4.0",
|
||||
"react-dnd-html5-backend": "^9.4.0",
|
||||
@@ -56,6 +57,8 @@
|
||||
"react-error-boundary": "^2.2.1",
|
||||
"react-i18next": "^10.11.0",
|
||||
"react-modal": "^3.11.1",
|
||||
"react-overlays": "^0.8.0",
|
||||
"react-transition-group": "2.0.0",
|
||||
"react-with-direction": "1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -32,6 +32,7 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
|
||||
contentProps: null,
|
||||
shouldCloseOnEsc: false,
|
||||
isOpen: true,
|
||||
onClose: null,
|
||||
closeButton: true,
|
||||
title: null,
|
||||
customClassName: '',
|
||||
@@ -73,6 +74,7 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
|
||||
content: ModalContent,
|
||||
contentProps,
|
||||
isOpen,
|
||||
onClose,
|
||||
title,
|
||||
customClassName,
|
||||
shouldCloseOnEsc,
|
||||
@@ -88,7 +90,13 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
|
||||
isOpen={isOpen}
|
||||
title={title}
|
||||
closeButton={closeButton}
|
||||
onClose={hide}
|
||||
onClose={() => {
|
||||
if (onClose) {
|
||||
onClose();
|
||||
}
|
||||
|
||||
hide();
|
||||
}}
|
||||
>
|
||||
<ModalContent {...contentProps} show={show} hide={hide} />
|
||||
</Modal>
|
||||
|
||||
@@ -1,49 +1,44 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Modal from 'react-bootstrap-modal';
|
||||
import DicomUploader from './DicomUploader';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { servicesManager } from './../App.js';
|
||||
|
||||
class DicomFileUploaderModal extends Component {
|
||||
static propTypes = {
|
||||
url: PropTypes.string,
|
||||
retrieveAuthHeaderFunction: PropTypes.func,
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
function DicomFileUploaderModal({
|
||||
isOpen = false,
|
||||
onClose,
|
||||
url,
|
||||
retrieveAuthHeaderFunction,
|
||||
t,
|
||||
}) {
|
||||
const { UIModalService } = servicesManager.services;
|
||||
|
||||
state = {
|
||||
uploaded: false,
|
||||
};
|
||||
|
||||
render() {
|
||||
if (!this.props.url) {
|
||||
return null;
|
||||
const showDicomStorePickerModal = () => {
|
||||
if (!UIModalService) {
|
||||
return
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
show={this.props.isOpen}
|
||||
onHide={this.props.onClose}
|
||||
aria-labelledby="ModalHeader"
|
||||
className="modal fade themed in"
|
||||
backdrop={false}
|
||||
size={'md'}
|
||||
keyboard={true}
|
||||
>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>
|
||||
{this.props.t('Upload DICOM Files')}
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<DicomUploader
|
||||
url={this.props.url}
|
||||
retrieveAuthHeaderFunction={this.props.retrieveAuthHeaderFunction}
|
||||
/>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
UIModalService.show({
|
||||
content: DicomUploader,
|
||||
title: t('Upload DICOM Files'),
|
||||
contentProps: {
|
||||
url,
|
||||
retrieveAuthHeaderFunction
|
||||
},
|
||||
onClose,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<React.Fragment>{isOpen && showDicomStorePickerModal()}</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
DicomFileUploaderModal.propTypes = {
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
retrieveAuthHeaderFunction: PropTypes.func.isRequired,
|
||||
onClose: PropTypes.func,
|
||||
url: PropTypes.string,
|
||||
};
|
||||
|
||||
export default withTranslation('Common')(DicomFileUploaderModal);
|
||||
@@ -36,6 +36,7 @@ function DicomStorePickerModal({
|
||||
user,
|
||||
url,
|
||||
},
|
||||
onClose
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user