chore: Clean up unused files, imports, and work on getting end-to-end tests and unit tests running (#2272)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2021-03-01 16:52:54 +01:00
1 parent 414ebc6850
commit 0db81b30f3
374 files changed
+14138 -21288

No files matched your search

-1
View File
@@ -23,7 +23,6 @@ import appInit from './appInit.js';
// TODO: Temporarily for testing
import '@ohif/mode-longitudinal';
import '@ohif/mode-segmentation';
/**
* ENV Variable to determine routing behavior
@@ -1,5 +0,0 @@
export default {
webWorkerManager: {
initialize: jest.fn(),
},
};
@@ -1,4 +0,0 @@
const createUserManager = () => jest.fn().mockReturnValue({});
const loadUser = () => jest.fn();
export { createUserManager, loadUser };
-3
View File
@@ -14,7 +14,6 @@ import {
HangingProtocolService,
CineService,
// utils,
// redux as reduxOHIF,
} from '@ohif/core';
// TODO -> this feels bad.
@@ -30,9 +29,7 @@ function appInit(appConfigOrFunc, defaultExtensions) {
: appConfigOrFunc),
};
// TODO: Wire this up to Rodrigo's basic Context "ContextService"
const commandsManagerConfig = {
/** Used by commands to inject `viewports` from "redux" */
getAppState: () => {},
/** Used by commands to determine active context */
getActiveContexts: () => [
@@ -143,7 +143,6 @@ function ViewerViewportGrid(props) {
};
const onDropHandler = (viewportIndex, { displaySetInstanceUID }) => {
console.warn(`DROPPED: ${displaySetInstanceUID}`);
viewportGridService.setDisplaysetForViewport({
viewportIndex,
displaySetInstanceUID,
@@ -1,39 +0,0 @@
/**
*
*
* @param {*} plugin
* @param {*} viewportData
* @param {*} viewportIndex
* @param {*} children
* @returns
*/
function _getViewportComponent(
viewportData,
viewportIndex,
children,
availablePlugins,
pluginName,
defaultPluginName
) {
if (viewportData.displaySet) {
pluginName = pluginName || defaultPluginName;
const ViewportComponent = availablePlugins[pluginName];
if (!ViewportComponent) {
throw new Error(
`No Viewport Component available for name ${pluginName}.
Available plugins: ${JSON.stringify(availablePlugins)}`
);
}
return (
<ViewportComponent
viewportData={viewportData}
viewportIndex={viewportIndex}
children={[children]}
/>
);
}
return <EmptyViewport />;
}
-22
View File
@@ -1,22 +0,0 @@
/**
* Entry point index.js for UMD packaging
*/
import 'regenerator-runtime/runtime';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
function installViewer(config, containerId = 'root', callback) {
const container = document.getElementById(containerId);
if (!container) {
throw new Error(
"No root element found to install viewer. Please add a <div> with the id 'root', or pass a DOM element into the installViewer function."
);
}
return ReactDOM.render(<App config={config} />, container, callback);
}
export { App, installViewer };
-8
View File
@@ -241,19 +241,11 @@ export default function ModeRoute({
dataSource,
]);
const reducer = (state, action) => {
console.log(state, action);
};
return (
<ImageViewerProvider
initialState={{ StudyInstanceUIDs: StudyInstanceUIDsAsArray }}
reducer={reducer}
>
<CombinedContextProvider>
{/* TODO: extensionManager is already provided to the extension module.
* Use it from there instead of passing as a prop here.
*/}
<DragAndDropProvider>
<LayoutComponent
{...layoutTemplateData.props}
@@ -27,6 +27,10 @@ import {
UserPreferences,
} from '@ohif/ui';
import i18n from '@ohif/i18n';
const { availableLanguages, defaultLanguage, currentLanguage } = i18n;
const seriesInStudiesMap = new Map();
/**
@@ -328,7 +332,7 @@ function WorkList({
{appConfig.modes.map((mode, i) => {
const isFirst = i === 0;
// TODO: Homes need a default/target route? We mostly support a single one for now.
// TODO: Modes need a default/target route? We mostly support a single one for now.
// We should also be using the route path, but currently are not
// mode.id
// mode.routes[x].path
@@ -384,8 +388,12 @@ function WorkList({
),
hotkeyDefinitions,
onCancel: hide,
onSubmit: ({ hotkeyDefinitions }) => {
hotkeysManager.setHotkeys(hotkeyDefinitions);
currentLanguage: currentLanguage(),
availableLanguages,
defaultLanguage,
onSubmit: (state) => {
i18n.changeLanguage(state.language.value);
hotkeysManager.setHotkeys(state.hotkeyDefinitions);
hide();
},
onReset: () => hotkeysManager.restoreDefaultBindings(),
@@ -459,6 +467,18 @@ const defaultFilterValues = {
resultsPerPage: 25,
};
function _tryParseInt(str, defaultValue) {
var retValue = defaultValue;
if (str !== null) {
if (str.length > 0) {
if (!isNaN(str)) {
retValue = parseInt(str);
}
}
}
return retValue;
}
function _getQueryFilterValues(query) {
const queryFilterValues = {
patientName: query.get('patientName'),
@@ -484,18 +504,6 @@ function _getQueryFilterValues(query) {
);
return queryFilterValues;
function _tryParseInt(str, defaultValue) {
var retValue = defaultValue;
if (str !== null) {
if (str.length > 0) {
if (!isNaN(str)) {
retValue = parseInt(str);
}
}
}
return retValue;
}
}
function _sortStringDates(s1, s2, sortModifier) {
@@ -1,6 +1,5 @@
import React from 'react';
import ModeRoute from '@routes/Mode';
import { ViewModelProvider } from '@ohif/core';
/*
Routes uniquely define an entry point to:
@@ -52,7 +51,6 @@ export default function buildModeRoutes({
// TODO move up.
const component = ({ location }) => (
<ViewModelProvider>
<ModeRoute
location={location}
mode={mode}
@@ -61,7 +59,6 @@ export default function buildModeRoutes({
servicesManager={servicesManager}
hotkeysManager={hotkeysManager}
/>
</ViewModelProvider>
);
routes.push({
@@ -78,7 +75,6 @@ export default function buildModeRoutes({
// TODO move up.
const component = ({ location }) => (
<ViewModelProvider>
<ModeRoute
location={location}
mode={mode}
@@ -87,7 +83,6 @@ export default function buildModeRoutes({
servicesManager={servicesManager}
hotkeysManager={hotkeysManager}
/>
</ViewModelProvider>
);
routes.push({