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.

70 lines
2.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 WBCollectionView from 'wb-collection-view';
  9. import WBCollectionBrowse from 'wb-collection-browse';
  10. import WBUsersPage from 'wb-users-page';
  11. import arvadosTypeName from 'arvados-type-name';
  12. class WBApp extends Component {
  13. constructor(...args) {
  14. super(...args);
  15. this.state.arvHost = window.localStorage['arvHost'];
  16. this.state.arvToken = window.localStorage['arvToken'];
  17. if ('currentUser' in window.localStorage)
  18. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  19. }
  20. navbarItemUrl(item) {
  21. if (item['id'] === 'sign-out') {
  22. return ('/sign-out');
  23. } else if (item['id'] === 'home') {
  24. return ('/browse/' + this.state.currentUser.uuid);
  25. } else if (item['id'] === 'all-projects') {
  26. return ('/browse');
  27. } else if (item['id'] === 'all-users') {
  28. return ('/users');
  29. }
  30. }
  31. breadcrumbClicked(item) {
  32. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  33. if (objectType === 'user')
  34. route('/browse/' + item.uuid)
  35. else if (objectType === 'group' && item.group_class === 'project')
  36. route('/browse/' + item.uuid);
  37. else if (objectType === 'container_request')
  38. route('/process/' + item.uuid)
  39. }
  40. render() {
  41. return (
  42. <Router>
  43. <WBLandingPage path="/" />
  44. <WBSignIn path="/sign-in" appState={ this.state } />
  45. <WBSignOut path='/sign-out' />
  46. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?"
  47. appState={ this.state }
  48. app={ this } />
  49. <WBProcessView path="/process/:uuid" app={ this } />
  50. <WBCollectionView path="/collection/:uuid" app={ this } />
  51. <WBCollectionBrowse path='/collection-browse/:uuid/:collectionPath?/:page?' app={ this } />
  52. <WBUsersPage path='/users/:page?' app={ this } />
  53. </Router>
  54. );
  55. }
  56. }
  57. export default WBApp;