refactor: 💡 ServicesManager factory functions vs instances (#1272)
* refactor: 💡 ServicesManager factory functions vs instances Refactor servicesManager to take factory functions instead of instances Closes: #1265 * Remove testing code
This commit is contained in:
1 parent
29bac8df7a
commit
daa3ddccdb
13 files changed
+220
-180
No files matched your search
+13
-12
@@ -28,11 +28,11 @@ import {
|
||||
ExtensionManager,
|
||||
ServicesManager,
|
||||
HotkeysManager,
|
||||
createUINotificationService,
|
||||
createUIModalService,
|
||||
createUIDialogService,
|
||||
createUIContextMenuService,
|
||||
createUILabellingFlowService,
|
||||
UINotificationService,
|
||||
UIModalService,
|
||||
UIDialogService,
|
||||
UIContextMenuService,
|
||||
UILabellingFlowService,
|
||||
utils,
|
||||
redux as reduxOHIF,
|
||||
} from '@ohif/core';
|
||||
@@ -70,13 +70,6 @@ const commandsManagerConfig = {
|
||||
getActiveContexts: () => getActiveContexts(store.getState()),
|
||||
};
|
||||
|
||||
/** Services */
|
||||
const UINotificationService = createUINotificationService();
|
||||
const UIModalService = createUIModalService();
|
||||
const UIDialogService = createUIDialogService();
|
||||
const UIContextMenuService = createUIContextMenuService();
|
||||
const UILabellingFlowService = createUILabellingFlowService();
|
||||
|
||||
/** Managers */
|
||||
const commandsManager = new CommandsManager(commandsManagerConfig);
|
||||
const hotkeysManager = new HotkeysManager(commandsManager);
|
||||
@@ -165,6 +158,14 @@ class App extends Component {
|
||||
|
||||
render() {
|
||||
const { whiteLabelling, routerBasename } = this._appConfig;
|
||||
const {
|
||||
UINotificationService,
|
||||
UIDialogService,
|
||||
UILabellingFlowService,
|
||||
UIModalService,
|
||||
UIContextMenuService,
|
||||
} = servicesManager.services;
|
||||
|
||||
if (this._userManager) {
|
||||
return (
|
||||
<AppContext.Provider value={{ appConfig: this._appConfig }}>
|
||||
|
||||
Reference in new issue
Block a user