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.

36 lines
1.2KB

  1. //
  2. // Copyright (C) Stanislaw Adaszewski, 2020
  3. // Contact: s.adaszewski@gmail.com
  4. // Website: https://adared.ch/wba
  5. // License: GNU Affero General Public License, Version 3
  6. //
  7. import arvadosTypeName from 'arvados-type-name';
  8. function urlForObject(item, mode='primary') {
  9. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  10. if (objectType === 'user')
  11. return ('/browse/' + item.uuid);
  12. else if (objectType === 'group' && item.group_class === 'project') {
  13. if (mode === 'properties')
  14. return ('/project/' + item.uuid);
  15. else
  16. return ('/browse/' + item.uuid);
  17. } else if (objectType === 'container_request')
  18. return ('/process/' + item.uuid);
  19. else if (objectType === 'workflow') {
  20. if (mode === 'launch')
  21. return ('/workflow-launch/' + item.uuid)
  22. else
  23. return ('/workflow/' + item.uuid);
  24. } else if (objectType === 'collection') {
  25. if (mode === 'primary' || mode === 'browse')
  26. return ('/collection-browse/' + item.uuid);
  27. else
  28. return ('/collection/' + item.uuid);
  29. } else if (objectType === 'container')
  30. return ('/container/' + item.uuid);
  31. }
  32. export default urlForObject;