diff --git a/platform/viewer/src/routes/DataSourceWrapper.jsx b/platform/viewer/src/routes/DataSourceWrapper.jsx
new file mode 100644
index 000000000..5734e0e7f
--- /dev/null
+++ b/platform/viewer/src/routes/DataSourceWrapper.jsx
@@ -0,0 +1,32 @@
+/* eslint-disable react/jsx-props-no-spreading */
+import React from 'react';
+import PropTypes from 'prop-types';
+//
+import { extensionManager } from '../App.js';
+
+/**
+ * Uses route properties to determine the data source that should be passed
+ * to the child layout template. In some instances, initiates requests and
+ * passes data as props.
+ *
+ * @param {object} props
+ * @param {function} props.children - Layout Template React Component
+ */
+function DataSourceWrapper(props) {
+ const { children: LayoutTemplate, ...rest } = props;
+ console.log('data source wrapper', props);
+ console.log(extensionManager);
+
+ return (
+
+
+
+ );
+}
+
+DataSourceWrapper.propTypes = {
+ /** Layout Component to wrap with a Data Source */
+ children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
+};
+
+export default DataSourceWrapper;
diff --git a/platform/viewer/src/routes/index.js b/platform/viewer/src/routes/index.js
index 5f06d0150..381663bfc 100644
--- a/platform/viewer/src/routes/index.js
+++ b/platform/viewer/src/routes/index.js
@@ -2,16 +2,23 @@ import React from 'react';
import { Switch, Route } from 'react-router-dom';
// Route Components
+import DataSourceWrapper from './DataSourceWrapper';
import StudyListContainer from './StudyListContainer';
import NotFound from './NotFound';
const bakedInRoutes = [
- { path: '/', exact: true, component: StudyListContainer },
+ {
+ path: '/',
+ exact: true,
+ component: DataSourceWrapper,
+ props: { children: StudyListContainer },
+ },
{ component: NotFound },
];
const createRoutes = routes => {
console.log('Creating Routes: ', routes, bakedInRoutes);
+ // TODO: Shouldn't need to guard input routes with an empty array?
const allRoutes = [...(routes || []), ...bakedInRoutes];
return (
@@ -23,8 +30,10 @@ const createRoutes = routes => {
path={route.path}
exact={route.exact}
strict={route.strict}
- // eslint-disable-next-line react/jsx-props-no-spreading
- render={props => }
+ render={props => (
+ // eslint-disable-next-line react/jsx-props-no-spreading
+
+ )}
/>
);
})}