projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '15803-unsetup' refs #15803
[arvados-workbench2.git]
/
src
/
services
/
collection-service
/
collection-service-files-response.ts
diff --git
a/src/services/collection-service/collection-service-files-response.ts
b/src/services/collection-service/collection-service-files-response.ts
index 619a4fc78582270558aa51ac07986ba578ed1c02..2e726d0bc8e0798fbae17df24f412f920d54906a 100644
(file)
--- a/
src/services/collection-service/collection-service-files-response.ts
+++ b/
src/services/collection-service/collection-service-files-response.ts
@@
-2,16
+2,10
@@
//
// SPDX-License-Identifier: AGPL-3.0
//
// SPDX-License-Identifier: AGPL-3.0
-import {
createCollectionFilesTree,
CollectionDirectory, CollectionFile, CollectionFileType, createCollectionDirectory, createCollectionFile } from "../../models/collection-file";
+import { CollectionDirectory, CollectionFile, CollectionFileType, createCollectionDirectory, createCollectionFile } from "../../models/collection-file";
import { getTagValue } from "~/common/xml";
import { getNodeChildren, Tree, mapTree } from '~/models/tree';
import { getTagValue } from "~/common/xml";
import { getNodeChildren, Tree, mapTree } from '~/models/tree';
-export const parseFilesResponse = (document: Document) => {
- const files = extractFilesData(document);
- const tree = createCollectionFilesTree(files);
- return sortFilesTree(tree);
-};
-
export const sortFilesTree = (tree: Tree<CollectionDirectory | CollectionFile>) => {
return mapTree<CollectionDirectory | CollectionFile>(node => {
const children = getNodeChildren(node.id)(tree);
export const sortFilesTree = (tree: Tree<CollectionDirectory | CollectionFile>) => {
return mapTree<CollectionDirectory | CollectionFile>(node => {
const children = getNodeChildren(node.id)(tree);
@@
-41,16
+35,16
@@
export const extractFilesData = (document: Document) => {
.replace(collectionUrlPrefix, '')
.replace(nameSuffix, '');
.replace(collectionUrlPrefix, '')
.replace(nameSuffix, '');
-
+ const parentPath = directory.replace(/\/$/, '');
const data = {
url,
id: [
collectionUuid ? collectionUuid : '',
const data = {
url,
id: [
collectionUuid ? collectionUuid : '',
- directory ?
'/' + directory.replace(/^\//, '')
: '',
+ directory ?
parentPath
: '',
'/' + name
].join(''),
name,
'/' + name
].join(''),
name,
- path:
directory
,
+ path:
parentPath
,
};
return getTagValue(element, 'D:resourcetype', '')
};
return getTagValue(element, 'D:resourcetype', '')