Merge branch '14013-upload-collection-files-using-webdav'
[arvados.git] / src / store / collection-panel / collection-panel-files / collection-panel-files-actions.ts
index 31a9d5d5e1f5a5b7238748e9ce9735e055f9d1db..3d8308013e7dcda1b016017b81fa22b0b589abba 100644 (file)
@@ -4,12 +4,12 @@
 
 import { default as unionize, ofType, UnionOf } from "unionize";
 import { Dispatch } from "redux";
-import { CollectionFilesTree, CollectionFileType } from "../../../models/collection-file";
-import { ServiceRepository } from "../../../services/services";
+import { CollectionFilesTree, CollectionFileType } from "~/models/collection-file";
+import { ServiceRepository } from "~/services/services";
 import { RootState } from "../../store";
 import { snackbarActions } from "../../snackbar/snackbar-actions";
 import { dialogActions } from "../../dialog/dialog-actions";
-import { getNodeValue, getNodeDescendants } from "../../../models/tree";
+import { getNodeValue, getNodeDescendants } from '~/models/tree';
 import { CollectionPanelDirectory, CollectionPanelFile } from "./collection-panel-files-state";
 
 export const collectionPanelFilesAction = unionize({
@@ -44,8 +44,7 @@ export const removeCollectionsSelectedFiles = () =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const tree = getState().collectionPanelFiles;
         const allFiles = getNodeDescendants('')(tree)
-            .map(id => getNodeValue(id)(tree))
-            .filter(file => file !== undefined) as Array<CollectionPanelDirectory | CollectionPanelFile>;
+            .map(node => node.value);
 
         const selectedDirectories = allFiles.filter(file => file.selected && file.type === CollectionFileType.DIRECTORY);
         const selectedFiles = allFiles.filter(file => file.selected && !selectedDirectories.some(dir => dir.id === file.path));
@@ -86,4 +85,4 @@ export const openMultipleFilesRemoveDialog = () =>
             text: 'Are you sure you want to remove selected files?',
             confirmButtonLabel: 'Remove'
         }
-    });
\ No newline at end of file
+    });