X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/01e4b29eb65a760650476a8f5f059413130921f4..2b3f667039ba2e7efe0852d58ae2c62899b773f0:/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts index 08b60308..57961538 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts @@ -2,9 +2,9 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile, mergeCollectionPanelFilesStates } from "./collection-panel-files-state"; +import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile, mergeCollectionPanelFilesStates } from './collection-panel-files-state'; import { CollectionPanelFilesAction, collectionPanelFilesAction } from "./collection-panel-files-actions"; -import { createTree, mapTreeValues, getNode, setNode, getNodeAncestors, getNodeDescendants, setNodeValueWith, mapTree } from "~/models/tree"; +import { createTree, mapTreeValues, getNode, setNode, getNodeAncestorsIds, getNodeDescendantsIds, setNodeValueWith, mapTree } from "~/models/tree"; import { CollectionFileType } from "~/models/collection-file"; export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = createTree(), action: CollectionPanelFilesAction) => { @@ -44,7 +44,7 @@ const toggleSelected = (id: string) => (tree: CollectionPanelFilesState) => const toggleDescendants = (id: string) => (tree: CollectionPanelFilesState) => { const node = getNode(id)(tree); if (node && node.value.type === CollectionFileType.DIRECTORY) { - return getNodeDescendants(id)(tree) + return getNodeDescendantsIds(id)(tree) .reduce((newTree, id) => setNodeValueWith(v => ({ ...v, selected: node.value.selected }))(id)(newTree), tree); } @@ -52,7 +52,7 @@ const toggleDescendants = (id: string) => (tree: CollectionPanelFilesState) => { }; const toggleAncestors = (id: string) => (tree: CollectionPanelFilesState) => { - const ancestors = getNodeAncestors(id)(tree).reverse(); + const ancestors = getNodeAncestorsIds(id)(tree).reverse(); return ancestors.reduce((newTree, parent) => parent ? toggleParentNode(parent)(newTree) : newTree, tree); };