|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import makeArvadosRequest from 'make-arvados-request';
- import arvadosTypeName from 'arvados-type-name';
- import arvadosObjectName from 'arvados-object-name';
-
- function fetchObjectParents(arvHost, arvToken, uuid) {
- let parents = [];
-
- let cb = xhr => {
- const item = xhr.response.items[0];
- if (!item)
- return parents.reverse();
-
- item.name = arvadosObjectName(item);
- parents.push(item);
-
- if (!item.owner_uuid ||
- item.owner_uuid.endsWith('-tpzed-000000000000000')) {
-
- return parents.reverse();
- }
-
- const objectType = arvadosTypeName(item.owner_uuid);
- const filters = [
- ['uuid', '=', item.owner_uuid]
- ];
-
- return makeArvadosRequest(arvHost, arvToken,
- '/arvados/v1/' + objectType + 's' +
- '?filters=' + encodeURIComponent(JSON.stringify(filters))).then(cb);
- };
-
- const objectType = arvadosTypeName(uuid);
- const filters = [
- ['uuid', '=', uuid]
- ];
- let prom = makeArvadosRequest(arvHost, arvToken,
- '/arvados/v1/' + objectType + 's' +
- '?filters=' + encodeURIComponent(JSON.stringify(filters)));
- prom = prom.then(cb);
-
- return prom;
- }
-
- export default fetchObjectParents;
|