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.

112 lines
3.7KB

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