X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/6c40105be37e95350ad0537c38401d58e6f84e2c..099468843d687fdc8c6fbb0f0e3dc54f59d0de15:/src/models/collection-file.ts diff --git a/src/models/collection-file.ts b/src/models/collection-file.ts index 97afcac6..3688557a 100644 --- a/src/models/collection-file.ts +++ b/src/models/collection-file.ts @@ -52,7 +52,7 @@ export const createCollectionFile = (data: Partial): CollectionF ...data }); -export const createCollectionFilesTree = (data: Array) => { +export const createCollectionFilesTree = (data: Array, joinParents: Boolean = true) => { const directories = data.filter(item => item.type === CollectionFileType.DIRECTORY); directories.sort((a, b) => a.path.localeCompare(b.path)); const files = data.filter(item => item.type === CollectionFileType.FILE); @@ -60,22 +60,21 @@ export const createCollectionFilesTree = (data: Array setNode({ children: [], id: item.id, - parent: getParentId(item), + parent: joinParents ? getParentId(item) : '', value: item, active: false, selected: false, expanded: false, status: TreeNodeStatus.INITIAL - })(tree), createTree()); }; const getParentId = (item: CollectionDirectory | CollectionFile) => item.path - ? join('', [getCollectionId(item.id), item.path]) + ? join('', [getCollectionResourceCollectionUuid(item.id), item.path]) : item.path; -const getCollectionId = pipe( +export const getCollectionResourceCollectionUuid = pipe( split('/'), head, -); \ No newline at end of file +);