X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/065f393316fad3472ab2afe526c7965be1fe392d..6cb43ce8d9ab8345a1b2a5abd961c7c134f5c607:/src/store/store.ts diff --git a/src/store/store.ts b/src/store/store.ts index 499d89e82f..53a01e2a3a 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -6,32 +6,72 @@ 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 { detailsPanelReducer, DetailsPanelState } from './details-panel/details-panel-reducer'; +import { contextMenuReducer, ContextMenuState } from './context-menu/context-menu-reducer'; +import { reducer as formReducer } from 'redux-form'; +import { FavoritesState, favoritesReducer } from './favorites/favorites-reducer'; +import { snackbarReducer, SnackbarState } from './snackbar/snackbar-reducer'; +import { dataExplorerMiddleware } from "./data-explorer/data-explorer-middleware"; +import { FAVORITE_PANEL_ID } from "./favorite-panel/favorite-panel-action"; +import { PROJECT_PANEL_ID } from "./project-panel/project-panel-action"; +import { ProjectPanelMiddlewareService } from "./project-panel/project-panel-middleware-service"; +import { FavoritePanelMiddlewareService } from "./favorite-panel/favorite-panel-middleware-service"; +import { CollectionCreatorState, collectionCreationReducer } from './collections/creator/collection-creator-reducer'; +import { CollectionPanelState, collectionPanelReducer } from './collection-panel/collection-panel-reducer'; 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; + collectionCreation: CollectionCreatorState; router: RouterState; + dataExplorer: DataExplorerState; + sidePanel: SidePanelState; + collectionPanel: CollectionPanelState; + detailsPanel: DetailsPanelState; + contextMenu: ContextMenuState; + favorites: FavoritesState; + snackbar: SnackbarState; } const rootReducer = combineReducers({ auth: authReducer, projects: projectsReducer, - router: routerReducer + collectionCreation: collectionCreationReducer, + router: routerReducer, + dataExplorer: dataExplorerReducer, + sidePanel: sidePanelReducer, + collectionPanel: collectionPanelReducer, + detailsPanel: detailsPanelReducer, + contextMenu: contextMenuReducer, + form: formReducer, + favorites: favoritesReducer, + snackbar: snackbarReducer, }); +export function configureStore(history: History) { + const projectPanelMiddleware = dataExplorerMiddleware( + new ProjectPanelMiddlewareService(PROJECT_PANEL_ID) + ); + const favoritePanelMiddleware = dataExplorerMiddleware( + new FavoritePanelMiddlewareService(FAVORITE_PANEL_ID) + ); -export default function configureStore(initialState: RootState, history: History) { const middlewares: Middleware[] = [ routerMiddleware(history), - thunkMiddleware + thunkMiddleware, + projectPanelMiddleware, + favoritePanelMiddleware ]; const enhancer = composeEnhancers(applyMiddleware(...middlewares)); - return createStore(rootReducer, initialState!, enhancer); + return createStore(rootReducer, enhancer); }