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.

wb-app.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import { h, Component } from 'preact';
  2. import { Router, route } from 'preact-router';
  3. import WBBrowse from 'wb-browse';
  4. import WBSignIn from 'wb-sign-in';
  5. import WBSignOut from 'wb-sign-out';
  6. import WBLandingPage from 'wb-landing-page';
  7. import WBProcessView from 'wb-process-view';
  8. import WBContainerView from 'wb-container-view';
  9. import WBCollectionView from 'wb-collection-view';
  10. import WBCollectionBrowse from 'wb-collection-browse';
  11. import WBUsersPage from 'wb-users-page';
  12. import WBWorkflowView from 'wb-workflow-view';
  13. import WBLaunchWorkflowPage from 'wb-launch-workflow-page';
  14. import WBDownloadPage from 'wb-download-page';
  15. import arvadosTypeName from 'arvados-type-name';
  16. class WBApp extends Component {
  17. constructor(...args) {
  18. super(...args);
  19. this.state.arvHost = window.localStorage['arvHost'];
  20. this.state.arvToken = window.localStorage['arvToken'];
  21. if ('currentUser' in window.localStorage)
  22. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  23. this.loadToolbox();
  24. }
  25. navbarItemUrl(item) {
  26. if (item['id'] === 'sign-out') {
  27. return ('/sign-out');
  28. } else if (item['id'] === 'home') {
  29. return ('/browse/' + this.state.currentUser.uuid);
  30. } else if (item['id'] === 'all-projects') {
  31. return ('/browse');
  32. } else if (item['id'] === 'all-users') {
  33. return ('/users');
  34. } else if (item['id'] === 'shared-with-me') {
  35. return ('/shared-with-me');
  36. }
  37. }
  38. breadcrumbClicked(item) {
  39. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  40. if (objectType === 'user')
  41. route('/browse/' + item.uuid)
  42. else if (objectType === 'group' && item.group_class === 'project')
  43. route('/browse/' + item.uuid);
  44. else if (objectType === 'container_request')
  45. route('/process/' + item.uuid)
  46. }
  47. addToToolbox(uuid) {
  48. this.state.toolboxItems.push(uuid);
  49. window.localStorage['toolboxItems'] =
  50. JSON.stringify(this.state.toolboxItems);
  51. }
  52. clearToolbox() {
  53. this.state.toolboxItems = [];
  54. delete window.localStorage['toolboxItems'];
  55. }
  56. loadToolbox() {
  57. this.state.toolboxItems = ('toolboxItems' in window.localStorage) ?
  58. JSON.parse(window.localStorage['toolboxItems']) : [];
  59. }
  60. render() {
  61. return (
  62. <Router>
  63. <WBLandingPage path="/" />
  64. <WBSignIn path="/sign-in" appState={ this.state } />
  65. <WBSignOut path='/sign-out' app={ this } />
  66. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?"
  67. app={ this } mode="browse" />
  68. <WBBrowse path="/shared-with-me/:activePage?"
  69. app={ this } mode="shared-with-me" />
  70. <WBProcessView path="/process/:uuid/:page?" app={ this } />
  71. <WBContainerView path="/container/:uuid" app={ this } />
  72. <WBCollectionView path="/collection/:uuid" app={ this } />
  73. <WBCollectionBrowse path='/collection-browse/:uuid/:collectionPath?/:page?' app={ this } />
  74. <WBUsersPage path='/users/:page?' app={ this } />
  75. <WBWorkflowView path="/workflow/:uuid" app={ this } />
  76. <WBLaunchWorkflowPage path="/workflow-launch/:workflowUuid" app={ this } />
  77. <WBDownloadPage path="/download/:blocksBlobUrl/:inline?" app={ this } />
  78. </Router>
  79. );
  80. }
  81. }
  82. export default WBApp;