Merge branch 'master' into 13903-edit-collection-popup
authorJanicki Artur <artur.janicki@contractors.roche.com>
Fri, 3 Aug 2018 06:10:09 +0000 (08:10 +0200)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Fri, 3 Aug 2018 06:10:09 +0000 (08:10 +0200)
refs #13903

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

1  2 
src/store/collection-panel/collection-panel-action.ts
src/store/collections/creator/collection-creator-action.ts
src/store/store.ts
src/views/workbench/workbench.tsx

index c0d3366eaee8fb65d49c73ffcb46510a94c9ee8f,1a23fbe2253ace597f922e6d1c0c02ad988298cd..673f9f02e9ce59b631f336f94844b01d5f0278b2
@@@ -16,12 -18,12 +17,12 @@@ export const collectionPanelActions = u
  export type CollectionPanelAction = UnionOf<typeof collectionPanelActions>;
  
  export const loadCollection = (uuid: string, kind: ResourceKind) =>
-     (dispatch: Dispatch) => {
+     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
          dispatch(collectionPanelActions.LOAD_COLLECTION({ uuid, kind }));
-         return collectionService
 -        return new CommonResourceService(services.apiClient, "collections")
++        return services.collectionService
              .get(uuid)
              .then(item => {
-                 dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item }));
+                 dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: item as CollectionResource }));
              });
      };
  
index 2a977e33ada271fbc8a7fbf5a165232c39fb7a35,1dc82365130459ae2a01a4829ad55ecab5c43398..2f2b83850e5f226aeb9e3a857e1c5f937aa5e3e8
@@@ -20,11 -20,11 +20,11 @@@ export const collectionCreateActions = 
      });
  
  export const createCollection = (collection: Partial<CollectionResource>) =>
-     (dispatch: Dispatch, getState: () => RootState) => {
+     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
 -        const { ownerUuid } = getState().collectionCreation.creator;
 +        const { ownerUuid } = getState().collections.creator;
          const collectiontData = { ownerUuid, ...collection };
          dispatch(collectionCreateActions.CREATE_COLLECTION(collectiontData));
-         return collectionService
+         return services.collectionService
              .create(collectiontData)
              .then(collection => dispatch(collectionCreateActions.CREATE_COLLECTION_SUCCESS(collection)));
      };
index 73b73f9976682756619341972c2867261018888b,37343619fe2c4319288574a615bffe01f1e3e485..02dcc9b27d6c1dba16404890134920866a948c2a
@@@ -21,8 -21,9 +21,9 @@@ import { FAVORITE_PANEL_ID } from "./fa
  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';
 +import { CollectionsState, collectionsReducer } from './collections/collections-reducer';
+ import { ServiceRepository } from "../services/services";
  
  const composeEnhancers =
      (process.env.NODE_ENV === 'development' &&
@@@ -43,27 -44,29 +44,29 @@@ export interface RootState 
      snackbar: SnackbarState;
  }
  
- const rootReducer = combineReducers({
-     auth: authReducer,
-     projects: projectsReducer,
-     collections: collectionsReducer,
-     router: routerReducer,
-     dataExplorer: dataExplorerReducer,
-     sidePanel: sidePanelReducer,
-     collectionPanel: collectionPanelReducer,
-     detailsPanel: detailsPanelReducer,
-     contextMenu: contextMenuReducer,
-     form: formReducer,
-     favorites: favoritesReducer,
-     snackbar: snackbarReducer,
- });
+ export type RootStore = Store<RootState, Action> & { dispatch: Dispatch<any> };
+ export function configureStore(history: History, services: ServiceRepository): RootStore {
+       const rootReducer = combineReducers({
+           auth: authReducer(services),
+           projects: projectsReducer,
 -          collectionCreation: collectionCreationReducer,
++        collections: collectionsReducer,
+           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)
+         new ProjectPanelMiddlewareService(services, PROJECT_PANEL_ID)
      );
      const favoritePanelMiddleware = dataExplorerMiddleware(
-         new FavoritePanelMiddlewareService(FAVORITE_PANEL_ID)
+         new FavoritePanelMiddlewareService(services, FAVORITE_PANEL_ID)
      );
  
      const middlewares: Middleware[] = [
index 048e44d4ac9baf462215e19df88e397af33e2f3b,f0067aa4e6f34e4e97534513302855e31b3d4e29..dcce725b8cbbb213c08ed1f70ca902438d0d87a4
@@@ -42,10 -41,10 +41,11 @@@ import { CreateCollectionDialog } from 
  import { CollectionPanel } from '../collection-panel/collection-panel';
  import { loadCollection } from '../../store/collection-panel/collection-panel-action';
  import { getCollectionUrl } from '../../models/collection';
 +import { UpdateCollectionDialog } from '../../views-components/update-collection-dialog/update-collection-dialog.';
+ import { AuthService } from "../../services/auth-service/auth-service";
  
- const drawerWidth = 240;
- const appBarHeight = 100;
+ const DRAWER_WITDH = 240;
+ const APP_BAR_HEIGHT = 100;
  
  type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar';