feat: 🎸 Allow routes to load Google Cloud DICOM Stores in the Study List (#1069)

This commit is contained in:
ladeirarodolfo authored and Erik Ziegler committed 2019-10-25 14:49:48 +02:00
1 parent 3bbeb1c521
commit 21b586b08f
9 files changed
+194 -45

No files matched your search

@@ -2,17 +2,26 @@ import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';
import ConnectedStudyList from './ConnectedStudyList';
import useServer from '../customHooks/useServer';
import OHIF from '@ohif/core';
const { urlUtil: UrlUtil } = OHIF.utils;
// Contexts
import AppContext from '../context/AppContext';
function StudyListRouting({ location }) {
function StudyListRouting({ match: routeMatch, location: routeLocation }) {
const {
project,
location,
dataset,
dicomStore,
studyInstanceUids,
seriesInstanceUids,
} = routeMatch.params;
const server = useServer({ project, location, dataset, dicomStore });
const { appConfig = {} } = useContext(AppContext);
const filters = UrlUtil.queryString.getQueryFilters(location);
const filters = UrlUtil.queryString.getQueryFilters(routeLocation);
let studyListFunctionsEnabled = false;
if (appConfig.studyListFunctionsEnabled) {
@@ -13,6 +13,7 @@ import ConnectedDicomFilesUploader from '../googleCloud/ConnectedDicomFilesUploa
import ConnectedDicomStorePicker from '../googleCloud/ConnectedDicomStorePicker';
import filesToStudies from '../lib/filesToStudies.js';
const { urlUtil: UrlUtil } = OHIF.utils;
// Contexts
import UserManagerContext from '../context/UserManagerContext';
import WhiteLabellingContext from '../context/WhiteLabellingContext';
@@ -202,9 +203,27 @@ class StudyListWithData extends Component {
const viewerPath = RoutesUtil.parseViewerPath(appConfig, server, {
studyInstanceUids: studyInstanceUID,
});
this.props.history.push(viewerPath);
if (UrlUtil.paramString.isValidPath(viewerPath)) {
this.props.history.push(viewerPath);
}
};
updateURL(modalOpened) {
if (!modalOpened) {
const { appConfig = {} } = this.context;
const { server } = this.props;
const listPath = RoutesUtil.parseStudyListPath(appConfig, server);
if (UrlUtil.paramString.isValidPath(listPath)) {
const { location = {} } = this.props.history;
if (location.pathname !== listPath) {
this.props.history.replace(listPath);
}
}
}
}
onSearch = searchData => {
this.searchForStudies(searchData);
};
@@ -235,9 +254,12 @@ class StudyListWithData extends Component {
let healthCareApiWindows = null;
if (appConfig.enableGoogleCloudAdapter) {
const modalOpened = this.state.modalComponentId === 'DicomStorePicker';
this.updateURL(modalOpened);
healthCareApiWindows = (
<ConnectedDicomStorePicker
isOpen={this.state.modalComponentId === 'DicomStorePicker'}
isOpen={modalOpened}
onClose={this.closeModals}
/>
);