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.

106 lines
3.5KB

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