Generate render tool.
This commit is contained in:
1 parent
7bd041a02c
commit
f4470c9625
13 files changed
+612
-47
No files matched your search
@@ -17,9 +17,12 @@ export default class ExtensionManager {
|
||||
this.modules[moduleType] = [];
|
||||
});
|
||||
this.dataSourceMap = {};
|
||||
this.defaultDataSourceName = appConfig.defaultDataSourceName;
|
||||
this.activeDataSource = undefined;
|
||||
}
|
||||
|
||||
console.log('modules map');
|
||||
console.log(this.modulesMap);
|
||||
setActiveDataSource(dataSourceName) {
|
||||
this.activeDataSource = dataSourceName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,6 +140,10 @@ export default class ExtensionManager {
|
||||
};
|
||||
|
||||
getDataSources = dataSourceName => {
|
||||
if (dataSourceName === undefined) {
|
||||
dataSourceName = this.activeDataSource;
|
||||
}
|
||||
|
||||
// Note: this currently uses the data source name, which feels weird...
|
||||
return this.dataSourceMap[dataSourceName];
|
||||
};
|
||||
|
||||
@@ -23,4 +23,5 @@ window.config = {
|
||||
},
|
||||
},
|
||||
],
|
||||
defaultDataSourceName: 'dicomweb',
|
||||
};
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
// redux as reduxOHIF,
|
||||
} from '@ohif/core';
|
||||
|
||||
// TODO -> this feels bad.
|
||||
|
||||
/**
|
||||
* @param {object|func} appConfigOrFunc - application configuration, or a function that returns application configuration
|
||||
* @param {object[]} defaultExtensions - array of extension objects
|
||||
|
||||
@@ -27,12 +27,15 @@ export default function ModeRoute({
|
||||
: [StudyInstanceUIDs];
|
||||
|
||||
const { extensions, sopClassHandlers } = mode;
|
||||
// TODO:
|
||||
// - Check query/params for specific dataSource
|
||||
// - If provided, query for that dataSource instance
|
||||
// - If not provided, select default datasource
|
||||
// - Update `extensionManager` to have a method to retrieve the default source
|
||||
const dataSources = extensionManager.getDataSources(dataSourceName);
|
||||
|
||||
if (dataSourceName === undefined) {
|
||||
dataSourceName = extensionManager.defaultDataSourceName;
|
||||
}
|
||||
|
||||
extensionManager.setActiveDataSource(dataSourceName);
|
||||
|
||||
const dataSources = extensionManager.getDataSources();
|
||||
|
||||
const dataSource = dataSources[0];
|
||||
const route = mode.routes[0];
|
||||
|
||||
|
||||
@@ -68,6 +68,30 @@ export default function buildModeRoutes(
|
||||
exact: true,
|
||||
});
|
||||
});
|
||||
|
||||
const defaultDataSourceName = extensionManager.defaultDataSourceName;
|
||||
|
||||
// Add default DataSource route.
|
||||
const path = `/${mode.id}`;
|
||||
|
||||
// TODO move up.
|
||||
const component = ({ location }) => (
|
||||
<ViewModelProvider>
|
||||
<ModeRoute
|
||||
location={location}
|
||||
mode={mode}
|
||||
dataSourceName={defaultDataSourceName}
|
||||
extensionManager={extensionManager}
|
||||
servicesManager={servicesManager}
|
||||
/>
|
||||
</ViewModelProvider>
|
||||
);
|
||||
|
||||
routes.push({
|
||||
path,
|
||||
component,
|
||||
exact: true,
|
||||
});
|
||||
});
|
||||
|
||||
return routes;
|
||||
|
||||
@@ -29,8 +29,7 @@ const createRoutes = (
|
||||
const routes =
|
||||
buildModeRoutes(modes, dataSources, extensionManager, servicesManager) ||
|
||||
[];
|
||||
// TODO: Shouldn't need to guard input routes with an empty array?
|
||||
const allRoutes = [...(routes || []), ...bakedInRoutes];
|
||||
const allRoutes = [...routes, ...bakedInRoutes];
|
||||
|
||||
console.log(
|
||||
'Creating Routes: ',
|
||||
|
||||
Reference in new issue
Block a user