From 4a24786b1ab2199d3841226eed83be56a83645fc Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Fri, 3 Aug 2018 13:01:38 +0200 Subject: [PATCH] Fix CR comments Feature #13855 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/models/tree.ts | 2 +- src/store/collection-panel/collection-panel-action.ts | 2 +- .../collection-panel-files/collection-panel-files-actions.ts | 3 +-- .../collection-panel-files-reducer.test.ts | 4 ++-- ...nel-files-reducer.ts => collection-panel-files-reducer.ts} | 2 +- src/store/store.ts | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) rename src/store/collection-panel/collection-panel-files/{collections-panel-files-reducer.ts => collection-panel-files-reducer.ts} (98%) diff --git a/src/models/tree.ts b/src/models/tree.ts index b9ef7729..8b66e50d 100644 --- a/src/models/tree.ts +++ b/src/models/tree.ts @@ -21,7 +21,7 @@ export const setNode = (node: TreeNode) => (tree: Tree): Tree => { const [newTree] = [tree] .map(tree => getNode(node.id)(tree) === node ? tree - : Object.assign({}, tree, { [node.id]: node })) + : {...tree, [node.id]: node}) .map(addChild(node.parent, node.id)); return newTree; }; diff --git a/src/store/collection-panel/collection-panel-action.ts b/src/store/collection-panel/collection-panel-action.ts index 419f0404..ee95590c 100644 --- a/src/store/collection-panel/collection-panel-action.ts +++ b/src/store/collection-panel/collection-panel-action.ts @@ -29,7 +29,7 @@ export const loadCollection = (uuid: string, kind: ResourceKind) => return services.collectionFilesService.getFiles(item.uuid); }) .then(files => { - dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES({ files })); + dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES(files)); }); }; diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts index 7423c491..463d49c5 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts @@ -3,11 +3,10 @@ // SPDX-License-Identifier: AGPL-3.0 import { default as unionize, ofType, UnionOf } from "unionize"; -import { KeepManifest } from "../../../models/keep-manifest"; import { CollectionFilesTree } from "../../../models/collection-file"; export const collectionPanelFilesAction = unionize({ - SET_COLLECTION_FILES: ofType<{ files: CollectionFilesTree }>(), + SET_COLLECTION_FILES: ofType(), TOGGLE_COLLECTION_FILE_COLLAPSE: ofType<{ id: string }>(), TOGGLE_COLLECTION_FILE_SELECTION: ofType<{ id: string }>(), SELECT_ALL_COLLECTION_FILES: ofType<{}>(), diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.test.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.test.ts index 636b5925..1a6bb7d7 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.test.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.test.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { collectionPanelFilesReducer } from "./collections-panel-files-reducer"; +import { collectionPanelFilesReducer } from "./collection-panel-files-reducer"; import { collectionPanelFilesAction } from "./collection-panel-files-actions"; import { CollectionFile, CollectionDirectory, createCollectionFile, createCollectionDirectory } from "../../../models/collection-file"; import { createTree, setNode, getNodeValue, mapTreeValues, Tree } from "../../../models/tree"; @@ -31,7 +31,7 @@ describe('CollectionPanelFilesReducer', () => { const collectionPanelFilesTree = collectionPanelFilesReducer( createTree(), - collectionPanelFilesAction.SET_COLLECTION_FILES({ files: collectionFilesTree })); + collectionPanelFilesAction.SET_COLLECTION_FILES(collectionFilesTree)); it('SET_COLLECTION_FILES', () => { expect(getNodeValue('Directory 1')(collectionPanelFilesTree)).toEqual({ diff --git a/src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts similarity index 98% rename from src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts rename to src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts index c27000e2..ca518f0e 100644 --- a/src/store/collection-panel/collection-panel-files/collections-panel-files-reducer.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts @@ -9,7 +9,7 @@ import { CollectionFileType } from "../../../models/collection-file"; export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = createTree(), action: CollectionPanelFilesAction) => { return collectionPanelFilesAction.match(action, { - SET_COLLECTION_FILES: ({ files }) => + SET_COLLECTION_FILES: files => mapTree(mapCollectionFileToCollectionPanelFile)(files), TOGGLE_COLLECTION_FILE_COLLAPSE: data => diff --git a/src/store/store.ts b/src/store/store.ts index 6e57465c..aeb6a09c 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -17,7 +17,7 @@ import { reducer as formReducer } from 'redux-form'; import { FavoritesState, favoritesReducer } from './favorites/favorites-reducer'; import { snackbarReducer, SnackbarState } from './snackbar/snackbar-reducer'; import { CollectionPanelFilesState } from './collection-panel/collection-panel-files/collection-panel-files-state'; -import { collectionPanelFilesReducer } from './collection-panel/collection-panel-files/collections-panel-files-reducer'; +import { collectionPanelFilesReducer } from './collection-panel/collection-panel-files/collection-panel-files-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"; -- 2.30.2