IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

fetch-object-parents.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import makeArvadosRequest from 'make-arvados-request';
  2. import arvadosTypeName from 'arvados-type-name';
  3. import arvadosObjectName from 'arvados-object-name';
  4. function fetchObjectParents(arvHost, arvToken, uuid) {
  5. let parents = [];
  6. let cb = xhr => {
  7. const item = xhr.response.items[0];
  8. if (!item)
  9. return parents.reverse();
  10. item.name = arvadosObjectName(item);
  11. parents.push(item);
  12. if (!item.owner_uuid ||
  13. item.owner_uuid.endsWith('-tpzed-000000000000000')) {
  14. return parents.reverse();
  15. }
  16. const objectType = arvadosTypeName(item.owner_uuid);
  17. const filters = [
  18. ['uuid', '=', item.owner_uuid]
  19. ];
  20. return makeArvadosRequest(arvHost, arvToken,
  21. '/arvados/v1/' + objectType + 's' +
  22. '?filters=' + encodeURIComponent(JSON.stringify(filters))).then(cb);
  23. };
  24. const objectType = arvadosTypeName(uuid);
  25. const filters = [
  26. ['uuid', '=', uuid]
  27. ];
  28. let prom = makeArvadosRequest(arvHost, arvToken,
  29. '/arvados/v1/' + objectType + 's' +
  30. '?filters=' + encodeURIComponent(JSON.stringify(filters)));
  31. prom = prom.then(cb);
  32. return prom;
  33. }
  34. export default fetchObjectParents;