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.

100 lines
3.2KB

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