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.

84 lines
2.8KB

  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 WBLaunchWorkflowPage from 'wb-launch-workflow-page';
  13. import arvadosTypeName from 'arvados-type-name';
  14. class WBApp extends Component {
  15. constructor(...args) {
  16. super(...args);
  17. this.state.arvHost = window.localStorage['arvHost'];
  18. this.state.arvToken = window.localStorage['arvToken'];
  19. if ('currentUser' in window.localStorage)
  20. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  21. this.state.toolboxItems = ('toolboxItems' in window.localStorage) ?
  22. JSON.parse(window.localStorage['toolboxItems']) : [];
  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. }
  34. }
  35. breadcrumbClicked(item) {
  36. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  37. if (objectType === 'user')
  38. route('/browse/' + item.uuid)
  39. else if (objectType === 'group' && item.group_class === 'project')
  40. route('/browse/' + item.uuid);
  41. else if (objectType === 'container_request')
  42. route('/process/' + item.uuid)
  43. }
  44. addToToolbox(uuid) {
  45. this.state.toolboxItems.push(uuid);
  46. window.localStorage['toolboxItems'] =
  47. JSON.stringify(this.state.toolboxItems);
  48. }
  49. render() {
  50. return (
  51. <Router>
  52. <WBLandingPage path="/" />
  53. <WBSignIn path="/sign-in" appState={ this.state } />
  54. <WBSignOut path='/sign-out' app={ this } />
  55. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?"
  56. appState={ this.state }
  57. app={ this } />
  58. <WBProcessView path="/process/:uuid" app={ this } />
  59. <WBCollectionView path="/collection/:uuid" app={ this } />
  60. <WBCollectionBrowse path='/collection-browse/:uuid/:collectionPath?/:page?' app={ this } />
  61. <WBUsersPage path='/users/:page?' app={ this } />
  62. <WBWorkflowView path="/workflow/:uuid" app={ this } />
  63. <WBLaunchWorkflowPage path="/workflow-launch/:workflowUuid/:projectUuid?" app={ this } />
  64. </Router>
  65. );
  66. }
  67. }
  68. export default WBApp;