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.

73 lines
2.3KB

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