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.

114 lines
3.9KB

  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. } else if (item['id'] === 'whatsnew') {
  40. return ('https://sites.google.com/roche.com/workbenchadvanced');
  41. }
  42. }
  43. breadcrumbClicked(item) {
  44. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  45. if (objectType === 'user')
  46. route('/browse/' + item.uuid)
  47. else if (objectType === 'group' && item.group_class === 'project')
  48. route('/browse/' + item.uuid);
  49. else if (objectType === 'container_request')
  50. route('/process/' + item.uuid)
  51. }
  52. addToToolbox(uuid) {
  53. this.state.toolboxItems.push(uuid);
  54. window.localStorage['toolboxItems'] =
  55. JSON.stringify(this.state.toolboxItems);
  56. }
  57. clearToolbox() {
  58. this.state.toolboxItems = [];
  59. delete window.localStorage['toolboxItems'];
  60. }
  61. loadToolbox() {
  62. this.state.toolboxItems = ('toolboxItems' in window.localStorage) ?
  63. JSON.parse(window.localStorage['toolboxItems']) : [];
  64. }
  65. render() {
  66. return (
  67. <Router>
  68. <WBLandingPage path="/" />
  69. <WBSignIn path="/sign-in/:mode?" appState={ this.state } />
  70. <WBSignOut path='/sign-out' app={ this } />
  71. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?/:textSearch?"
  72. app={ this } mode="browse" />
  73. <WBBrowse path="/shared-with-me/:activePage?/:textSearch?"
  74. app={ this } mode="shared-with-me" />
  75. <WBProcessView path="/process/:uuid/:page?" app={ this } />
  76. <WBContainerView path="/container/:uuid" app={ this } />
  77. <WBCollectionView path="/collection/:uuid" app={ this } />
  78. <WBCollectionBrowse path='/collection-browse/:uuid/:collectionPath?/:page?' app={ this } />
  79. <WBUsersPage path='/users/:page?/:textSearch?' app={ this } />
  80. <WBWorkflowView path="/workflow/:uuid" app={ this } />
  81. <WBLaunchWorkflowPage path="/workflow-launch/:workflowUuid" app={ this } />
  82. <WBDownloadPage path="/download/:blocksBlobUrl/:inline?" app={ this } />
  83. <WBImageViewerPage path="/image-viewer/:blobUrl" app={ this } />
  84. <WBSharingPage path="/sharing/:uuid" app={ this } />
  85. <WBProjectView path="/project/:uuid" app={ this } />
  86. </Router>
  87. );
  88. }
  89. }
  90. export default WBApp;