-export const loadCollectionFiles = (uuid: string) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(progressIndicatorActions.START_WORKING(COLLECTION_PANEL_LOAD_FILES));
- const files = await services.collectionService.files(uuid);
-
- // Given the array of directories and files, create the appropriate tree nodes,
- // sort them, and add the complete url to each.
- const tree = createCollectionFilesTree(files);
- const sorted = sortFilesTree(tree);
- const mapped = mapTreeValues(services.collectionService.extendFileURL)(sorted);
- dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES(mapped));
- dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_PANEL_LOAD_FILES));
- };
+export const setCollectionFiles = (files, joinParents = true) => (dispatch: any) => {
+ const tree = createCollectionFilesTree(files, joinParents);
+ const sorted = sortFilesTree(tree);
+ const mapped = mapTreeValues(servicesProvider.getServices().collectionService.extendFileURL)(sorted);
+ dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES(mapped));
+};