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!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
951B

  1. import makeArvadosRequest from 'make-arvados-request';
  2. import arvadosTypeName from 'arvados-type-name';
  3. function wbCopyCollection(arvHost, arvToken, uuid, newOwnerUuid) {
  4. const typeName = arvadosTypeName(uuid);
  5. if (typeName !== 'collection')
  6. throw Error('Specified UUID does not refer to a collection');
  7. let prom = makeArvadosRequest(arvHost, arvToken,
  8. '/arvados/v1/collections/' + uuid);
  9. prom = prom.then(xhr => {
  10. const { name, description, properties, portable_data_hash,
  11. manifest_text } = xhr.response;
  12. const dup = { name: name + ' (Copied at ' + new Date().toISOString() + ')',
  13. description, properties, portable_data_hash, manifest_text,
  14. owner_uuid: newOwnerUuid };
  15. return makeArvadosRequest(arvHost, arvToken,
  16. '/arvados/v1/collections', {
  17. 'method': 'POST',
  18. 'data': JSON.stringify(dup)
  19. });
  20. });
  21. return prom;
  22. }
  23. export default wbCopyCollection;