X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/7adbd161925c71840bf4ddb799b87f1734e5af7e..3ec7057e490b3d19b15663dd312328f637fa1d3b:/src/store/store.ts?ds=sidebyside diff --git a/src/store/store.ts b/src/store/store.ts index 499d89e8..cf07d6df 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -6,32 +6,57 @@ import { createStore, applyMiddleware, compose, Middleware, combineReducers } fr import { routerMiddleware, routerReducer, RouterState } from "react-router-redux"; import thunkMiddleware from 'redux-thunk'; import { History } from "history"; -import projectsReducer, { ProjectState } from "./project/project-reducer"; -import authReducer, { AuthState } from "./auth/auth-reducer"; + +import { projectsReducer, ProjectState } from "./project/project-reducer"; +import { sidePanelReducer, SidePanelState } from './side-panel/side-panel-reducer'; +import { authReducer, AuthState } from "./auth/auth-reducer"; +import { dataExplorerReducer, DataExplorerState } from './data-explorer/data-explorer-reducer'; +import { projectPanelMiddleware } from './project-panel/project-panel-middleware'; +import { detailsPanelReducer, DetailsPanelState } from './details-panel/details-panel-reducer'; +import { contextMenuReducer, ContextMenuState } from './context-menu/context-menu-reducer'; +import { favoritePanelMiddleware } from "./favorite-panel/favorite-panel-middleware"; +import { reducer as formReducer } from 'redux-form'; +import { FavoritesState, favoritesReducer } from './favorites/favorites-reducer'; +import { snackbarReducer, SnackbarState } from './snackbar/snackbar-reducer'; +import { ServiceRepository } from "../services/services"; const composeEnhancers = (process.env.NODE_ENV === 'development' && - window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || + window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose; export interface RootState { auth: AuthState; projects: ProjectState; router: RouterState; + dataExplorer: DataExplorerState; + sidePanel: SidePanelState; + detailsPanel: DetailsPanelState; + contextMenu: ContextMenuState; + favorites: FavoritesState; + snackbar: SnackbarState; } -const rootReducer = combineReducers({ - auth: authReducer, - projects: projectsReducer, - router: routerReducer -}); - +export function configureStore(history: History, services: ServiceRepository) { + const rootReducer = combineReducers({ + auth: authReducer(services), + projects: projectsReducer, + router: routerReducer, + dataExplorer: dataExplorerReducer, + sidePanel: sidePanelReducer, + detailsPanel: detailsPanelReducer, + contextMenu: contextMenuReducer, + form: formReducer, + favorites: favoritesReducer, + snackbar: snackbarReducer, + }); -export default function configureStore(initialState: RootState, history: History) { const middlewares: Middleware[] = [ routerMiddleware(history), - thunkMiddleware + thunkMiddleware.withExtraArgument(services), + projectPanelMiddleware(services), + favoritePanelMiddleware(services) ]; const enhancer = composeEnhancers(applyMiddleware(...middlewares)); - return createStore(rootReducer, initialState!, enhancer); + return createStore(rootReducer, enhancer); }